@shuffleio/shuffle-mcps 0.0.7 → 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 +110 -1
- package/dist/index.cjs +1915 -773
- 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 +1941 -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.cjs
CHANGED
|
@@ -30,6 +30,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
var index_exports = {};
|
|
31
31
|
__export(index_exports, {
|
|
32
32
|
API_CONFIG: () => API_CONFIG,
|
|
33
|
+
AgentActivityList: () => AgentActivityList_default,
|
|
34
|
+
AgentExecutionDrawer: () => AgentExecutionDrawer_default,
|
|
35
|
+
AgentRunDrawer: () => AgentRunDrawer_default,
|
|
33
36
|
AgentUI: () => AgentUI_default,
|
|
34
37
|
AppAuthSection: () => AppAuthSection,
|
|
35
38
|
AppDetailDrawer: () => AppDetailDrawer,
|
|
@@ -45,6 +48,7 @@ __export(index_exports, {
|
|
|
45
48
|
getApiUrl: () => getApiUrl,
|
|
46
49
|
getAuthHeader: () => getAuthHeader,
|
|
47
50
|
refreshAllIntegrationStatus: () => refreshAllIntegrationStatus,
|
|
51
|
+
searchAgentActivity: () => searchAgentActivity,
|
|
48
52
|
setToastImpl: () => setToastImpl,
|
|
49
53
|
toast: () => toast,
|
|
50
54
|
useAppAuth: () => useAppAuth,
|
|
@@ -52,6 +56,7 @@ __export(index_exports, {
|
|
|
52
56
|
useAppLookup: () => useAppLookup
|
|
53
57
|
});
|
|
54
58
|
module.exports = __toCommonJS(index_exports);
|
|
59
|
+
var import_shuffle_mcp2 = require("./shuffle-mcp-24XBNRGE.css");
|
|
55
60
|
|
|
56
61
|
// ShuffleMCP.tsx
|
|
57
62
|
var import_react9 = __toESM(require("react"), 1);
|
|
@@ -443,6 +448,50 @@ var fetchAuthenticatedApps = (crossOrgId) => {
|
|
|
443
448
|
return promise;
|
|
444
449
|
};
|
|
445
450
|
|
|
451
|
+
// appsCache.ts
|
|
452
|
+
var TTL_MS2 = 3e4;
|
|
453
|
+
var cache2 = /* @__PURE__ */ new Map();
|
|
454
|
+
var cacheKey2 = (o) => `${o.baseUrl}|${o.path || "/api/v1/apps"}|${o.apiKey || ""}|${o.orgId || ""}`;
|
|
455
|
+
var doFetch2 = async (o) => {
|
|
456
|
+
const headers = {};
|
|
457
|
+
if (o.apiKey) headers["Authorization"] = `Bearer ${o.apiKey}`;
|
|
458
|
+
if (o.orgId) headers["Org-Id"] = o.orgId;
|
|
459
|
+
const response = await fetch(`${o.baseUrl}${o.path || "/api/v1/apps"}`, {
|
|
460
|
+
credentials: "include",
|
|
461
|
+
headers
|
|
462
|
+
});
|
|
463
|
+
if (!response.ok) return [];
|
|
464
|
+
const data = await response.json();
|
|
465
|
+
if (Array.isArray(data)) return data;
|
|
466
|
+
return Array.isArray(data?.data) ? data.data : [];
|
|
467
|
+
};
|
|
468
|
+
var fetchApps = (opts) => {
|
|
469
|
+
const key = cacheKey2(opts);
|
|
470
|
+
const entry = cache2.get(key) || {};
|
|
471
|
+
if (entry.data && entry.fetchedAt && Date.now() - entry.fetchedAt < TTL_MS2) {
|
|
472
|
+
return Promise.resolve(entry.data);
|
|
473
|
+
}
|
|
474
|
+
if (entry.promise) return entry.promise;
|
|
475
|
+
const promise = doFetch2(opts).then((data) => {
|
|
476
|
+
cache2.set(key, { data, fetchedAt: Date.now() });
|
|
477
|
+
return data;
|
|
478
|
+
}).catch((err) => {
|
|
479
|
+
cache2.delete(key);
|
|
480
|
+
throw err;
|
|
481
|
+
});
|
|
482
|
+
cache2.set(key, { ...entry, promise });
|
|
483
|
+
return promise;
|
|
484
|
+
};
|
|
485
|
+
var fetchAppsViaApiConfig = () => {
|
|
486
|
+
const headers = getAuthHeader();
|
|
487
|
+
const orgId = headers["Org-Id"] || null;
|
|
488
|
+
return fetchApps({
|
|
489
|
+
baseUrl: API_CONFIG.baseUrl,
|
|
490
|
+
apiKey: API_CONFIG.apiKey,
|
|
491
|
+
orgId
|
|
492
|
+
});
|
|
493
|
+
};
|
|
494
|
+
|
|
446
495
|
// auth-utils.ts
|
|
447
496
|
function deduplicateAuthApps(apps) {
|
|
448
497
|
const appMap = /* @__PURE__ */ new Map();
|
|
@@ -611,35 +660,25 @@ var IntegrationStatus = ({ collapsed, filterApps, onAddClick, iconSize = 26, onD
|
|
|
611
660
|
}
|
|
612
661
|
if (dedupedIntegrations.length < 10) {
|
|
613
662
|
try {
|
|
614
|
-
const
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
id: app.id || app.name,
|
|
634
|
-
name: app.name,
|
|
635
|
-
icon: app.large_image || "",
|
|
636
|
-
category: app.categories?.[0] || "Integration",
|
|
637
|
-
hasValidAuth: false,
|
|
638
|
-
authInstances: [],
|
|
639
|
-
isActiveOnly: true
|
|
640
|
-
});
|
|
641
|
-
added++;
|
|
642
|
-
}
|
|
663
|
+
const appsData = await fetchAppsViaApiConfig();
|
|
664
|
+
if (Array.isArray(appsData)) {
|
|
665
|
+
const activatedApps = appsData.filter((app) => app.activated);
|
|
666
|
+
const slotsRemaining = 10 - dedupedIntegrations.length;
|
|
667
|
+
let added = 0;
|
|
668
|
+
for (const app of activatedApps) {
|
|
669
|
+
if (added >= slotsRemaining) break;
|
|
670
|
+
if (!authNameSet.has((app.name || "").toLowerCase())) {
|
|
671
|
+
authNameSet.add((app.name || "").toLowerCase());
|
|
672
|
+
dedupedIntegrations.push({
|
|
673
|
+
id: app.id || app.name,
|
|
674
|
+
name: app.name,
|
|
675
|
+
icon: app.large_image || "",
|
|
676
|
+
category: app.categories?.[0] || "Integration",
|
|
677
|
+
hasValidAuth: false,
|
|
678
|
+
authInstances: [],
|
|
679
|
+
isActiveOnly: true
|
|
680
|
+
});
|
|
681
|
+
added++;
|
|
643
682
|
}
|
|
644
683
|
}
|
|
645
684
|
}
|
|
@@ -1264,8 +1303,8 @@ function AppTitleHeader({
|
|
|
1264
1303
|
py: 0.5,
|
|
1265
1304
|
minHeight: 0,
|
|
1266
1305
|
flexShrink: 0,
|
|
1267
|
-
bgcolor: "
|
|
1268
|
-
"&:hover": { bgcolor: "
|
|
1306
|
+
bgcolor: "hsl(var(--primary))",
|
|
1307
|
+
"&:hover": { bgcolor: "hsl(var(--primary) / 0.85)" }
|
|
1269
1308
|
},
|
|
1270
1309
|
children: "+ Add"
|
|
1271
1310
|
}
|
|
@@ -1286,7 +1325,7 @@ function AppTitleHeader({
|
|
|
1286
1325
|
py: 0.5,
|
|
1287
1326
|
minHeight: 0,
|
|
1288
1327
|
flexShrink: 0,
|
|
1289
|
-
...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: "
|
|
1328
|
+
...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)" } }
|
|
1290
1329
|
},
|
|
1291
1330
|
children: activateLoading ? "\u2026" : isActivated ? "Deactivate" : "Activate"
|
|
1292
1331
|
}
|
|
@@ -1354,7 +1393,10 @@ var AppAuthCard = ({
|
|
|
1354
1393
|
apiAuthEntries,
|
|
1355
1394
|
onSelectAuth,
|
|
1356
1395
|
onRefreshAuth,
|
|
1357
|
-
disableUrlPrefill
|
|
1396
|
+
disableUrlPrefill,
|
|
1397
|
+
hideHeader,
|
|
1398
|
+
hideStatusChips,
|
|
1399
|
+
hideDocsLink
|
|
1358
1400
|
}) => {
|
|
1359
1401
|
const getBestDefaultAuth = (entries) => {
|
|
1360
1402
|
if (entries.length === 0) return ADD_NEW_AUTH;
|
|
@@ -1574,6 +1616,22 @@ var AppAuthCard = ({
|
|
|
1574
1616
|
setLocalCredentials((prev) => ({ ...urlDefaults, ...prev }));
|
|
1575
1617
|
}
|
|
1576
1618
|
}, [auth?.parameters, disableUrlPrefill]);
|
|
1619
|
+
(0, import_react4.useEffect)(() => {
|
|
1620
|
+
const incoming = authState.credentials || {};
|
|
1621
|
+
setLocalCredentials((prev) => {
|
|
1622
|
+
let changed = false;
|
|
1623
|
+
const next = { ...prev };
|
|
1624
|
+
for (const [k, v] of Object.entries(incoming)) {
|
|
1625
|
+
const lk = k.toLowerCase();
|
|
1626
|
+
const isUrlish = lk.includes("url") || lk.includes("endpoint") || lk.includes("host");
|
|
1627
|
+
if (isUrlish && typeof v === "string" && v !== prev[k]) {
|
|
1628
|
+
next[k] = v;
|
|
1629
|
+
changed = true;
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
return changed ? next : prev;
|
|
1633
|
+
});
|
|
1634
|
+
}, [authState.credentials]);
|
|
1577
1635
|
const [docsOpen, setDocsOpen] = (0, import_react4.useState)(false);
|
|
1578
1636
|
const [docsContent, setDocsContent] = (0, import_react4.useState)("");
|
|
1579
1637
|
const [docsLoading, setDocsLoading] = (0, import_react4.useState)(false);
|
|
@@ -1647,10 +1705,9 @@ var AppAuthCard = ({
|
|
|
1647
1705
|
const renderOAuth2Fields = () => {
|
|
1648
1706
|
if (!auth || !isOAuth2) return null;
|
|
1649
1707
|
const availableScopes = auth.scope || [];
|
|
1650
|
-
const isCloudOrDev = isDevEnvironment() || isCloudDomain();
|
|
1651
1708
|
const hasManualCredentials = !!localCredentials["client_id"]?.trim() && !!localCredentials["client_secret"]?.trim();
|
|
1652
1709
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_material3.Box, { sx: { display: "flex", flexDirection: "column", gap: 3 }, children: [
|
|
1653
|
-
|
|
1710
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1654
1711
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material3.Collapse, { in: !hasManualCredentials, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_material3.Box, { sx: { display: "flex", flexDirection: "column", gap: 3 }, children: [
|
|
1655
1712
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1656
1713
|
import_material3.Button,
|
|
@@ -1837,7 +1894,7 @@ var AppAuthCard = ({
|
|
|
1837
1894
|
{
|
|
1838
1895
|
label: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_material3.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
1839
1896
|
param.name,
|
|
1840
|
-
param.required && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material3.Typography, { component: "span", sx: { color: "
|
|
1897
|
+
param.required && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material3.Typography, { component: "span", sx: { color: "hsl(var(--destructive))", fontSize: "0.8rem" }, children: "*" })
|
|
1841
1898
|
] }),
|
|
1842
1899
|
type: param.name.toLowerCase().includes("password") || param.name.toLowerCase().includes("secret") || param.name.toLowerCase().includes("key") ? "password" : "text",
|
|
1843
1900
|
placeholder: param.example || `Enter ${param.name}`,
|
|
@@ -1851,13 +1908,13 @@ var AppAuthCard = ({
|
|
|
1851
1908
|
"& .MuiOutlinedInput-root": {
|
|
1852
1909
|
backgroundColor: "hsl(var(--muted))",
|
|
1853
1910
|
borderRadius: 2,
|
|
1854
|
-
"& fieldset": { borderColor: fieldErrors[fieldKey] ? "
|
|
1855
|
-
"&:hover fieldset": { borderColor: fieldErrors[fieldKey] ? "
|
|
1856
|
-
"&.Mui-focused fieldset": { borderColor: fieldErrors[fieldKey] ? "
|
|
1911
|
+
"& fieldset": { borderColor: fieldErrors[fieldKey] ? "hsl(var(--destructive))" : "hsl(var(--border))" },
|
|
1912
|
+
"&:hover fieldset": { borderColor: fieldErrors[fieldKey] ? "hsl(var(--destructive))" : "hsl(var(--border))" },
|
|
1913
|
+
"&.Mui-focused fieldset": { borderColor: fieldErrors[fieldKey] ? "hsl(var(--destructive))" : "hsl(var(--primary))" }
|
|
1857
1914
|
},
|
|
1858
1915
|
"& .MuiInputBase-input": { color: "hsl(var(--foreground))" },
|
|
1859
1916
|
"& .MuiInputLabel-root": { color: "hsl(var(--muted-foreground))" },
|
|
1860
|
-
"& .MuiFormHelperText-root": { color: fieldErrors[fieldKey] ? "
|
|
1917
|
+
"& .MuiFormHelperText-root": { color: fieldErrors[fieldKey] ? "hsl(var(--destructive))" : "hsl(var(--muted-foreground))" }
|
|
1861
1918
|
}
|
|
1862
1919
|
},
|
|
1863
1920
|
fieldKey
|
|
@@ -1931,7 +1988,7 @@ var AppAuthCard = ({
|
|
|
1931
1988
|
maxWidth: "100%"
|
|
1932
1989
|
},
|
|
1933
1990
|
children: [
|
|
1934
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1991
|
+
!hideHeader && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1935
1992
|
import_material3.CardContent,
|
|
1936
1993
|
{
|
|
1937
1994
|
onClick: onToggle,
|
|
@@ -2020,7 +2077,7 @@ var AppAuthCard = ({
|
|
|
2020
2077
|
width: { xs: "100%", sm: "auto" },
|
|
2021
2078
|
justifyContent: { xs: "flex-start", sm: "flex-end" }
|
|
2022
2079
|
}, children: [
|
|
2023
|
-
isNoAuthRequired(auth) ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2080
|
+
!hideStatusChips && (isNoAuthRequired(auth) ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2024
2081
|
import_material3.Chip,
|
|
2025
2082
|
{
|
|
2026
2083
|
label: "Auth not required",
|
|
@@ -2071,8 +2128,8 @@ var AppAuthCard = ({
|
|
|
2071
2128
|
)
|
|
2072
2129
|
}
|
|
2073
2130
|
)
|
|
2074
|
-
] }),
|
|
2075
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material3.Tooltip, { title: "View documentation", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2131
|
+
] })),
|
|
2132
|
+
!hideDocsLink && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material3.Tooltip, { title: "View documentation", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2076
2133
|
import_material3.IconButton,
|
|
2077
2134
|
{
|
|
2078
2135
|
size: "small",
|
|
@@ -2352,8 +2409,8 @@ var AppAuthCard = ({
|
|
|
2352
2409
|
width: 8,
|
|
2353
2410
|
height: 8,
|
|
2354
2411
|
borderRadius: "50%",
|
|
2355
|
-
backgroundColor: localTestStatus === "success" ? "
|
|
2356
|
-
boxShadow: localTestStatus === "success" ? "0 0 8px
|
|
2412
|
+
backgroundColor: localTestStatus === "success" ? "hsl(var(--severity-low))" : localTestStatus === "pending_validation" ? "hsl(var(--severity-medium))" : localTestStatus === "error" ? "hsl(var(--destructive))" : "hsl(var(--muted-foreground))",
|
|
2413
|
+
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)"
|
|
2357
2414
|
} }),
|
|
2358
2415
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material3.Typography, { sx: {
|
|
2359
2416
|
color: "hsl(var(--muted-foreground))",
|
|
@@ -2384,11 +2441,11 @@ var AppAuthCard = ({
|
|
|
2384
2441
|
display: "flex",
|
|
2385
2442
|
alignItems: "center",
|
|
2386
2443
|
justifyContent: "center",
|
|
2387
|
-
backgroundColor: localTestStatus === "success" ? "
|
|
2388
|
-
border: `1px solid ${localTestStatus === "success" ? "
|
|
2444
|
+
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)",
|
|
2445
|
+
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)"}`,
|
|
2389
2446
|
flexShrink: 0
|
|
2390
2447
|
}, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_CheckCircle2.default, { sx: {
|
|
2391
|
-
color: localTestStatus === "success" ? "
|
|
2448
|
+
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))",
|
|
2392
2449
|
fontSize: 20
|
|
2393
2450
|
} }) }),
|
|
2394
2451
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_material3.Box, { sx: { minWidth: 0, flex: 1 }, children: [
|
|
@@ -2482,7 +2539,7 @@ var AppAuthCard = ({
|
|
|
2482
2539
|
) })
|
|
2483
2540
|
] }) }),
|
|
2484
2541
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material3.Typography, { sx: {
|
|
2485
|
-
color: localTestStatus === "success" ? "
|
|
2542
|
+
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))",
|
|
2486
2543
|
fontSize: "0.75rem",
|
|
2487
2544
|
mt: 0.25,
|
|
2488
2545
|
fontWeight: localTestStatus !== "untested" || isTested || isConfigured ? 500 : 400
|
|
@@ -2502,9 +2559,9 @@ var AppAuthCard = ({
|
|
|
2502
2559
|
disabled: authState.status === "testing",
|
|
2503
2560
|
startIcon: authState.status === "testing" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material3.CircularProgress, { size: 16, sx: { color: "inherit" } }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_CheckCircle2.default, { sx: { fontSize: 18 } }),
|
|
2504
2561
|
sx: {
|
|
2505
|
-
borderColor: authState.status === "testing" ? "transparent" : "
|
|
2562
|
+
borderColor: authState.status === "testing" ? "transparent" : "hsl(var(--primary) / 0.5)",
|
|
2506
2563
|
color: authState.status === "testing" ? "hsl(var(--foreground))" : "hsl(var(--primary))",
|
|
2507
|
-
background: authState.status === "testing" ? "linear-gradient(90deg,
|
|
2564
|
+
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",
|
|
2508
2565
|
backgroundSize: authState.status === "testing" ? "200% 100%" : "auto",
|
|
2509
2566
|
animation: authState.status === "testing" ? "shimmer 1.5s infinite linear" : "none",
|
|
2510
2567
|
fontWeight: 600,
|
|
@@ -2522,7 +2579,7 @@ var AppAuthCard = ({
|
|
|
2522
2579
|
},
|
|
2523
2580
|
"&:hover": {
|
|
2524
2581
|
borderColor: "hsl(var(--primary))",
|
|
2525
|
-
backgroundColor: authState.status === "testing" ? void 0 : "
|
|
2582
|
+
backgroundColor: authState.status === "testing" ? void 0 : "hsl(var(--primary) / 0.08)"
|
|
2526
2583
|
},
|
|
2527
2584
|
"&.Mui-disabled": {
|
|
2528
2585
|
color: authState.status === "testing" ? "hsl(var(--foreground))" : "hsl(var(--muted-foreground))",
|
|
@@ -2541,11 +2598,11 @@ var AppAuthCard = ({
|
|
|
2541
2598
|
{
|
|
2542
2599
|
severity: "error",
|
|
2543
2600
|
sx: {
|
|
2544
|
-
backgroundColor: "
|
|
2545
|
-
color: "
|
|
2546
|
-
border: "1px solid
|
|
2601
|
+
backgroundColor: "hsl(var(--destructive) / 0.1)",
|
|
2602
|
+
color: "hsl(var(--destructive))",
|
|
2603
|
+
border: "1px solid hsl(var(--destructive) / 0.2)",
|
|
2547
2604
|
borderRadius: 2,
|
|
2548
|
-
"& .MuiAlert-icon": { color: "
|
|
2605
|
+
"& .MuiAlert-icon": { color: "hsl(var(--destructive))" }
|
|
2549
2606
|
},
|
|
2550
2607
|
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_material3.Box, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 2, width: "100%" }, children: [
|
|
2551
2608
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material3.Typography, { sx: { fontSize: "0.875rem", flex: 1 }, children: localTestMessages.errorMessage }),
|
|
@@ -2558,16 +2615,16 @@ var AppAuthCard = ({
|
|
|
2558
2615
|
target: "_blank",
|
|
2559
2616
|
rel: "noopener noreferrer",
|
|
2560
2617
|
sx: {
|
|
2561
|
-
borderColor: "
|
|
2562
|
-
color: "
|
|
2618
|
+
borderColor: "hsl(var(--destructive) / 0.5)",
|
|
2619
|
+
color: "hsl(var(--destructive))",
|
|
2563
2620
|
textTransform: "none",
|
|
2564
2621
|
fontSize: "0.75rem",
|
|
2565
2622
|
py: 0.5,
|
|
2566
2623
|
px: 1.5,
|
|
2567
2624
|
flexShrink: 0,
|
|
2568
2625
|
"&:hover": {
|
|
2569
|
-
borderColor: "
|
|
2570
|
-
backgroundColor: "
|
|
2626
|
+
borderColor: "hsl(var(--destructive))",
|
|
2627
|
+
backgroundColor: "hsl(var(--destructive) / 0.1)"
|
|
2571
2628
|
}
|
|
2572
2629
|
},
|
|
2573
2630
|
children: "View Execution"
|
|
@@ -2584,12 +2641,12 @@ var AppAuthCard = ({
|
|
|
2584
2641
|
{
|
|
2585
2642
|
severity: localTestMessages.warningMessage ? "warning" : "success",
|
|
2586
2643
|
sx: {
|
|
2587
|
-
backgroundColor: localTestMessages.warningMessage ? "
|
|
2588
|
-
color: localTestMessages.warningMessage ? "
|
|
2589
|
-
border: localTestMessages.warningMessage ? "1px solid
|
|
2644
|
+
backgroundColor: localTestMessages.warningMessage ? "hsl(var(--severity-medium) / 0.1)" : "hsl(var(--severity-low) / 0.1)",
|
|
2645
|
+
color: localTestMessages.warningMessage ? "hsl(var(--severity-medium))" : "hsl(var(--severity-low))",
|
|
2646
|
+
border: localTestMessages.warningMessage ? "1px solid hsl(var(--severity-medium) / 0.2)" : "1px solid hsl(var(--severity-low) / 0.2)",
|
|
2590
2647
|
borderRadius: 2,
|
|
2591
2648
|
"& .MuiAlert-icon": {
|
|
2592
|
-
color: localTestMessages.warningMessage ? "
|
|
2649
|
+
color: localTestMessages.warningMessage ? "hsl(var(--severity-medium))" : "hsl(var(--severity-low))"
|
|
2593
2650
|
}
|
|
2594
2651
|
},
|
|
2595
2652
|
children: localTestMessages.warningMessage ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_material3.Box, { children: [
|
|
@@ -2606,11 +2663,11 @@ var AppAuthCard = ({
|
|
|
2606
2663
|
{
|
|
2607
2664
|
severity: "warning",
|
|
2608
2665
|
sx: {
|
|
2609
|
-
backgroundColor: "
|
|
2610
|
-
color: "
|
|
2611
|
-
border: "1px solid
|
|
2666
|
+
backgroundColor: "hsl(var(--severity-medium) / 0.1)",
|
|
2667
|
+
color: "hsl(var(--severity-medium))",
|
|
2668
|
+
border: "1px solid hsl(var(--severity-medium) / 0.2)",
|
|
2612
2669
|
borderRadius: 2,
|
|
2613
|
-
"& .MuiAlert-icon": { color: "
|
|
2670
|
+
"& .MuiAlert-icon": { color: "hsl(var(--severity-medium))" }
|
|
2614
2671
|
},
|
|
2615
2672
|
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_material3.Box, { children: [
|
|
2616
2673
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material3.Typography, { sx: { fontWeight: 600, mb: 0.5 }, children: "Test passed (Status 200), but not marked as validated" }),
|
|
@@ -2621,7 +2678,7 @@ var AppAuthCard = ({
|
|
|
2621
2678
|
href: `${API_CONFIG.baseUrl}/admin?tab=app_auth`,
|
|
2622
2679
|
target: "_blank",
|
|
2623
2680
|
sx: {
|
|
2624
|
-
color: "
|
|
2681
|
+
color: "hsl(var(--severity-medium))",
|
|
2625
2682
|
fontWeight: 500,
|
|
2626
2683
|
fontSize: "0.85rem",
|
|
2627
2684
|
textDecoration: "underline",
|
|
@@ -2646,12 +2703,12 @@ var AppAuthCard = ({
|
|
|
2646
2703
|
{
|
|
2647
2704
|
severity: "warning",
|
|
2648
2705
|
sx: {
|
|
2649
|
-
backgroundColor: "
|
|
2650
|
-
color: "
|
|
2651
|
-
border: "1px solid
|
|
2706
|
+
backgroundColor: "hsl(var(--severity-medium) / 0.1)",
|
|
2707
|
+
color: "hsl(var(--severity-medium))",
|
|
2708
|
+
border: "1px solid hsl(var(--severity-medium) / 0.2)",
|
|
2652
2709
|
borderRadius: 2,
|
|
2653
2710
|
mb: 2,
|
|
2654
|
-
"& .MuiAlert-icon": { color: "
|
|
2711
|
+
"& .MuiAlert-icon": { color: "hsl(var(--severity-medium))" }
|
|
2655
2712
|
},
|
|
2656
2713
|
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material3.Typography, { 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." })
|
|
2657
2714
|
}
|
|
@@ -2665,9 +2722,9 @@ var AppAuthCard = ({
|
|
|
2665
2722
|
{
|
|
2666
2723
|
severity: "error",
|
|
2667
2724
|
sx: {
|
|
2668
|
-
backgroundColor: "
|
|
2669
|
-
color: "
|
|
2670
|
-
border: "1px solid
|
|
2725
|
+
backgroundColor: "hsl(var(--destructive) / 0.1)",
|
|
2726
|
+
color: "hsl(var(--destructive))",
|
|
2727
|
+
border: "1px solid hsl(var(--destructive) / 0.3)",
|
|
2671
2728
|
borderRadius: 2
|
|
2672
2729
|
},
|
|
2673
2730
|
children: error
|
|
@@ -2677,11 +2734,11 @@ var AppAuthCard = ({
|
|
|
2677
2734
|
{
|
|
2678
2735
|
severity: "info",
|
|
2679
2736
|
sx: {
|
|
2680
|
-
backgroundColor: "
|
|
2681
|
-
color: "
|
|
2682
|
-
border: "1px solid
|
|
2737
|
+
backgroundColor: "hsl(var(--severity-info) / 0.1)",
|
|
2738
|
+
color: "hsl(var(--severity-info))",
|
|
2739
|
+
border: "1px solid hsl(var(--severity-info) / 0.2)",
|
|
2683
2740
|
borderRadius: 2,
|
|
2684
|
-
"& .MuiAlert-icon": { color: "
|
|
2741
|
+
"& .MuiAlert-icon": { color: "hsl(var(--severity-info))" }
|
|
2685
2742
|
},
|
|
2686
2743
|
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_material3.Box, { children: [
|
|
2687
2744
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material3.Typography, { sx: { fontWeight: 600, mb: 0.5 }, children: "No authentication required" }),
|
|
@@ -2696,9 +2753,9 @@ var AppAuthCard = ({
|
|
|
2696
2753
|
{
|
|
2697
2754
|
severity: "error",
|
|
2698
2755
|
sx: {
|
|
2699
|
-
backgroundColor: "
|
|
2700
|
-
color: "
|
|
2701
|
-
border: "1px solid
|
|
2756
|
+
backgroundColor: "hsl(var(--destructive) / 0.1)",
|
|
2757
|
+
color: "hsl(var(--destructive))",
|
|
2758
|
+
border: "1px solid hsl(var(--destructive) / 0.3)",
|
|
2702
2759
|
borderRadius: 2
|
|
2703
2760
|
},
|
|
2704
2761
|
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_material3.Box, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 2, width: "100%" }, children: [
|
|
@@ -2712,16 +2769,16 @@ var AppAuthCard = ({
|
|
|
2712
2769
|
target: "_blank",
|
|
2713
2770
|
rel: "noopener noreferrer",
|
|
2714
2771
|
sx: {
|
|
2715
|
-
borderColor: "
|
|
2716
|
-
color: "
|
|
2772
|
+
borderColor: "hsl(var(--destructive) / 0.5)",
|
|
2773
|
+
color: "hsl(var(--destructive))",
|
|
2717
2774
|
textTransform: "none",
|
|
2718
2775
|
fontSize: "0.75rem",
|
|
2719
2776
|
py: 0.5,
|
|
2720
2777
|
px: 1.5,
|
|
2721
2778
|
flexShrink: 0,
|
|
2722
2779
|
"&:hover": {
|
|
2723
|
-
borderColor: "
|
|
2724
|
-
backgroundColor: "
|
|
2780
|
+
borderColor: "hsl(var(--destructive))",
|
|
2781
|
+
backgroundColor: "hsl(var(--destructive) / 0.1)"
|
|
2725
2782
|
}
|
|
2726
2783
|
},
|
|
2727
2784
|
children: "View Execution"
|
|
@@ -2735,9 +2792,9 @@ var AppAuthCard = ({
|
|
|
2735
2792
|
{
|
|
2736
2793
|
severity: "error",
|
|
2737
2794
|
sx: {
|
|
2738
|
-
backgroundColor: "
|
|
2739
|
-
color: "
|
|
2740
|
-
border: "1px solid
|
|
2795
|
+
backgroundColor: "hsl(var(--destructive) / 0.1)",
|
|
2796
|
+
color: "hsl(var(--destructive))",
|
|
2797
|
+
border: "1px solid hsl(var(--destructive) / 0.3)",
|
|
2741
2798
|
borderRadius: 2
|
|
2742
2799
|
},
|
|
2743
2800
|
children: "Failed to save authentication. Please try again."
|
|
@@ -3172,9 +3229,10 @@ var AppMcpChat = ({ appName, appIcon, appId, categories }) => {
|
|
|
3172
3229
|
const inputRef = (0, import_react5.useRef)(null);
|
|
3173
3230
|
const suggestions = (0, import_react5.useMemo)(() => getSuggestions(appName, categories), [appName, categories]);
|
|
3174
3231
|
const primaryCategory = (0, import_react5.useMemo)(() => getPrimaryCategory(appName, categories), [appName, categories]);
|
|
3232
|
+
const MIN_INPUT_LENGTH = 6;
|
|
3175
3233
|
const runAction = async () => {
|
|
3176
3234
|
const trimmed = input.trim();
|
|
3177
|
-
if (
|
|
3235
|
+
if (trimmed.length < MIN_INPUT_LENGTH || runState === "running") return;
|
|
3178
3236
|
setQuery(trimmed);
|
|
3179
3237
|
setInput("");
|
|
3180
3238
|
setRunState("running");
|
|
@@ -3395,7 +3453,8 @@ ${JSON.stringify(data, null, 2)}
|
|
|
3395
3453
|
{
|
|
3396
3454
|
component: "button",
|
|
3397
3455
|
onClick: runAction,
|
|
3398
|
-
disabled:
|
|
3456
|
+
disabled: input.trim().length < MIN_INPUT_LENGTH,
|
|
3457
|
+
title: input.trim().length < MIN_INPUT_LENGTH ? `Enter at least ${MIN_INPUT_LENGTH} characters` : void 0,
|
|
3399
3458
|
sx: {
|
|
3400
3459
|
all: "unset",
|
|
3401
3460
|
display: "flex",
|
|
@@ -3405,11 +3464,11 @@ ${JSON.stringify(data, null, 2)}
|
|
|
3405
3464
|
height: 30,
|
|
3406
3465
|
borderRadius: "8px",
|
|
3407
3466
|
flexShrink: 0,
|
|
3408
|
-
cursor: input.trim() ? "pointer" : "
|
|
3409
|
-
backgroundColor: input.trim() ? "hsl(var(--primary))" : "hsl(var(--muted))",
|
|
3410
|
-
color: input.trim() ? "hsl(var(--primary-foreground))" : "hsl(var(--muted-foreground))",
|
|
3467
|
+
cursor: input.trim().length >= MIN_INPUT_LENGTH ? "pointer" : "not-allowed",
|
|
3468
|
+
backgroundColor: input.trim().length >= MIN_INPUT_LENGTH ? "hsl(var(--primary))" : "hsl(var(--muted))",
|
|
3469
|
+
color: input.trim().length >= MIN_INPUT_LENGTH ? "hsl(var(--primary-foreground))" : "hsl(var(--muted-foreground))",
|
|
3411
3470
|
transition: "all 0.15s ease",
|
|
3412
|
-
"&:hover": input.trim() ? {
|
|
3471
|
+
"&:hover": input.trim().length >= MIN_INPUT_LENGTH ? {
|
|
3413
3472
|
filter: "brightness(1.1)"
|
|
3414
3473
|
} : {}
|
|
3415
3474
|
},
|
|
@@ -3731,23 +3790,32 @@ function buildSingulCurl(appName, action, opts) {
|
|
|
3731
3790
|
const act = action?.name || "{action}";
|
|
3732
3791
|
const body = {
|
|
3733
3792
|
app: appName || "<appname>",
|
|
3793
|
+
action: act,
|
|
3734
3794
|
fields: action?.fields.length ? action.fields : [{ name: "field1", value: "value1" }]
|
|
3735
3795
|
};
|
|
3736
3796
|
const token = opts?.apiKey || "YOUR_TOKEN";
|
|
3737
3797
|
const orgLine = opts?.orgId ? `
|
|
3738
3798
|
-H "Org-Id: ${opts.orgId}" \\` : "";
|
|
3739
|
-
|
|
3799
|
+
const base2 = (opts?.baseUrl || "").replace(/\/+$/, "");
|
|
3800
|
+
return `curl -X POST ${base2}/api/v1/singul \\
|
|
3740
3801
|
-H "Authorization: Bearer ${token}" \\${orgLine}
|
|
3741
3802
|
-d '${JSON.stringify(body, null, 2)}'`;
|
|
3742
3803
|
}
|
|
3743
|
-
function buildSingulPython(appName, action) {
|
|
3804
|
+
function buildSingulPython(appName, action, opts) {
|
|
3744
3805
|
const act = action?.name || "send_message";
|
|
3745
3806
|
const app = appName || "<appname>";
|
|
3746
3807
|
const fields = action?.fields.length ? action.fields : [];
|
|
3747
3808
|
const fieldsStr = JSON.stringify(fields);
|
|
3748
|
-
|
|
3809
|
+
const token = opts?.apiKey || "APIKEY";
|
|
3810
|
+
const base2 = (opts?.baseUrl || "").replace(/\/+$/, "");
|
|
3811
|
+
return `from shufflepy import Singul
|
|
3749
3812
|
|
|
3750
|
-
|
|
3813
|
+
singul = Singul(
|
|
3814
|
+
"${token}",
|
|
3815
|
+
url="${base2}",
|
|
3816
|
+
)
|
|
3817
|
+
|
|
3818
|
+
response = singul.run("${app}", action="${act}", fields=${fieldsStr})
|
|
3751
3819
|
|
|
3752
3820
|
print(response)`;
|
|
3753
3821
|
}
|
|
@@ -3864,10 +3932,11 @@ var SingulActionsPreview = ({
|
|
|
3864
3932
|
const apiKey = API_CONFIG.apiKey;
|
|
3865
3933
|
const trackedOrg = getTrackedOrgId();
|
|
3866
3934
|
const orgId = trackedOrg && activeOrgId && trackedOrg !== activeOrgId ? trackedOrg : null;
|
|
3867
|
-
|
|
3935
|
+
const baseUrl = API_CONFIG.baseUrl;
|
|
3936
|
+
return { apiKey, orgId, baseUrl };
|
|
3868
3937
|
}, [activeOrgId]);
|
|
3869
3938
|
const buildSnippet = (0, import_react6.useCallback)(
|
|
3870
|
-
(action, l) => l === "python" ? buildSingulPython(appName, action) : buildSingulCurl(appName, action, curlOpts),
|
|
3939
|
+
(action, l) => l === "python" ? buildSingulPython(appName, action, curlOpts) : buildSingulCurl(appName, action, curlOpts),
|
|
3871
3940
|
[appName, curlOpts]
|
|
3872
3941
|
);
|
|
3873
3942
|
(0, import_react6.useEffect)(() => {
|
|
@@ -3918,7 +3987,7 @@ var SingulActionsPreview = ({
|
|
|
3918
3987
|
app_name: "http",
|
|
3919
3988
|
app_version: "1.4.0"
|
|
3920
3989
|
};
|
|
3921
|
-
const path = lang === "python" ? "/api/v1/apps/3e2bdf9d5069fe3f4746c29d68785a6a/run" : "/api/v1/apps/http/run";
|
|
3990
|
+
const path = lang === "python" ? "/api/v1/apps/3e2bdf9d5069fe3f4746c29d68785a6a/run?delete=true" : "/api/v1/apps/http/run?delete=true";
|
|
3922
3991
|
const res = await fetch(getApiUrl(path), {
|
|
3923
3992
|
method: "POST",
|
|
3924
3993
|
credentials: "include",
|
|
@@ -4341,14 +4410,8 @@ function AppDetailDrawer({
|
|
|
4341
4410
|
let appsList = null;
|
|
4342
4411
|
if (API_CONFIG.apiKey) {
|
|
4343
4412
|
try {
|
|
4344
|
-
const
|
|
4345
|
-
|
|
4346
|
-
headers: { ...getAuthHeader() }
|
|
4347
|
-
});
|
|
4348
|
-
if (res.ok) {
|
|
4349
|
-
const apps = await res.json();
|
|
4350
|
-
if (Array.isArray(apps)) appsList = apps;
|
|
4351
|
-
}
|
|
4413
|
+
const apps = await fetchAppsViaApiConfig();
|
|
4414
|
+
if (Array.isArray(apps)) appsList = apps;
|
|
4352
4415
|
} catch {
|
|
4353
4416
|
}
|
|
4354
4417
|
}
|
|
@@ -4659,7 +4722,7 @@ function AppDetailDrawer({
|
|
|
4659
4722
|
}
|
|
4660
4723
|
|
|
4661
4724
|
// ShuffleMCP.tsx
|
|
4662
|
-
var import_shuffle_mcp = require("./shuffle-mcp-
|
|
4725
|
+
var import_shuffle_mcp = require("./shuffle-mcp-24XBNRGE.css");
|
|
4663
4726
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
4664
4727
|
var DEFAULT_ALGOLIA_APP_ID = "JNSS5CFDZZ";
|
|
4665
4728
|
var DEFAULT_ALGOLIA_API_KEY = "33e4e3564f4f060e96e0531957bed552";
|
|
@@ -4749,18 +4812,12 @@ var ShuffleMCP = import_react9.default.forwardRef(({
|
|
|
4749
4812
|
}
|
|
4750
4813
|
const fetchPrivateApps = async () => {
|
|
4751
4814
|
try {
|
|
4752
|
-
const
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
...orgId ? { "Org-Id": orgId } : {}
|
|
4758
|
-
},
|
|
4759
|
-
credentials: "include"
|
|
4815
|
+
const apps = await fetchApps({
|
|
4816
|
+
baseUrl: apiBaseUrl,
|
|
4817
|
+
path: privateAppsPath,
|
|
4818
|
+
apiKey: apiKey || null,
|
|
4819
|
+
orgId: orgId || null
|
|
4760
4820
|
});
|
|
4761
|
-
if (!response.ok) return;
|
|
4762
|
-
const data = await response.json();
|
|
4763
|
-
const apps = Array.isArray(data) ? data : data?.data || [];
|
|
4764
4821
|
const normalized = apps.map((a) => ({
|
|
4765
4822
|
name: a.name || "",
|
|
4766
4823
|
description: a.description || "",
|
|
@@ -5005,6 +5062,8 @@ var ShuffleMCP = import_react9.default.forwardRef(({
|
|
|
5005
5062
|
"div",
|
|
5006
5063
|
{
|
|
5007
5064
|
className: `singul-dropdown-item ${selected ? "singul-selected" : ""} ${authState.validated ? "singul-validated" : ""} ${authState.configured ? "singul-configured" : ""}`,
|
|
5065
|
+
"data-app-name": app.name,
|
|
5066
|
+
"data-object-id": app.objectID,
|
|
5008
5067
|
style: {
|
|
5009
5068
|
...customStyles.dropdownItem,
|
|
5010
5069
|
...selected ? customStyles.selectedItem : {}
|
|
@@ -5138,7 +5197,7 @@ var ShuffleMCP = import_react9.default.forwardRef(({
|
|
|
5138
5197
|
displayResults.map((app, index) => renderAppItem(app, index)),
|
|
5139
5198
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "singul-end-of-results", style: {
|
|
5140
5199
|
padding: "10px 16px",
|
|
5141
|
-
color: "
|
|
5200
|
+
color: "hsl(var(--foreground) / 0.3)",
|
|
5142
5201
|
textAlign: "center",
|
|
5143
5202
|
fontSize: "11px",
|
|
5144
5203
|
gridColumn: "1 / -1"
|
|
@@ -5352,10 +5411,19 @@ function AppSearchDrawer({
|
|
|
5352
5411
|
onAddToCanvas,
|
|
5353
5412
|
priorityCategory,
|
|
5354
5413
|
connectionPathApps,
|
|
5355
|
-
pinnedApps
|
|
5414
|
+
pinnedApps,
|
|
5415
|
+
highlightAppName,
|
|
5416
|
+
highlightDelayMs = 5e3
|
|
5356
5417
|
}) {
|
|
5357
5418
|
const [detailAppName, setDetailAppName] = (0, import_react10.useState)(null);
|
|
5358
5419
|
const [detailAppId, setDetailAppId] = (0, import_react10.useState)(null);
|
|
5420
|
+
const [highlightActive, setHighlightActive] = (0, import_react10.useState)(false);
|
|
5421
|
+
(0, import_react10.useEffect)(() => {
|
|
5422
|
+
setHighlightActive(false);
|
|
5423
|
+
if (!open || !highlightAppName) return;
|
|
5424
|
+
const t = setTimeout(() => setHighlightActive(true), highlightDelayMs);
|
|
5425
|
+
return () => clearTimeout(t);
|
|
5426
|
+
}, [open, highlightAppName, highlightDelayMs]);
|
|
5359
5427
|
const handleClose = () => {
|
|
5360
5428
|
setDetailAppName(null);
|
|
5361
5429
|
setDetailAppId(null);
|
|
@@ -5497,13 +5565,16 @@ function AppSearchDrawer({
|
|
|
5497
5565
|
overflowY: "auto"
|
|
5498
5566
|
},
|
|
5499
5567
|
"& .singul-results-grid": {
|
|
5500
|
-
gridAutoRows: "
|
|
5568
|
+
gridAutoRows: "75px",
|
|
5501
5569
|
gap: "12px"
|
|
5502
5570
|
},
|
|
5503
5571
|
"& .singul-results-grid .singul-dropdown-item": {
|
|
5504
5572
|
minHeight: 75,
|
|
5573
|
+
maxHeight: 75,
|
|
5574
|
+
height: 75,
|
|
5505
5575
|
padding: "14px 16px",
|
|
5506
|
-
alignItems: "center"
|
|
5576
|
+
alignItems: "center",
|
|
5577
|
+
overflow: "hidden"
|
|
5507
5578
|
},
|
|
5508
5579
|
"& .singul-results-grid .singul-app-info": {
|
|
5509
5580
|
alignItems: "center",
|
|
@@ -5514,7 +5585,18 @@ function AppSearchDrawer({
|
|
|
5514
5585
|
height: 40,
|
|
5515
5586
|
borderRadius: 8,
|
|
5516
5587
|
padding: 4
|
|
5517
|
-
}
|
|
5588
|
+
},
|
|
5589
|
+
...highlightActive && highlightAppName ? {
|
|
5590
|
+
[`& .singul-dropdown-item[data-app-name="${highlightAppName}"]`]: {
|
|
5591
|
+
borderColor: "hsl(var(--primary)) !important",
|
|
5592
|
+
boxShadow: "0 0 0 2px hsl(var(--primary)), 0 0 18px 2px hsl(var(--primary) / 0.55)",
|
|
5593
|
+
animation: "shuffleHighlightPulse 1.6s ease-in-out infinite"
|
|
5594
|
+
},
|
|
5595
|
+
"@keyframes shuffleHighlightPulse": {
|
|
5596
|
+
"0%, 100%": { boxShadow: "0 0 0 2px hsl(var(--primary)), 0 0 12px 1px hsl(var(--primary) / 0.4)" },
|
|
5597
|
+
"50%": { boxShadow: "0 0 0 2px hsl(var(--primary)), 0 0 24px 4px hsl(var(--primary) / 0.75)" }
|
|
5598
|
+
}
|
|
5599
|
+
} : {}
|
|
5518
5600
|
},
|
|
5519
5601
|
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_framer_motion7.AnimatePresence, { mode: "wait", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
5520
5602
|
import_framer_motion7.motion.div,
|
|
@@ -5965,10 +6047,12 @@ var TimelineRow = ({
|
|
|
5965
6047
|
}
|
|
5966
6048
|
}
|
|
5967
6049
|
let toolApp;
|
|
5968
|
-
|
|
5969
|
-
|
|
6050
|
+
const skipToolIcon = item.category === "finalise" || item.category === "finish" || item.category === "ask" || details?.action === "finalise" || details?.action === "finish" || details?.action === "ask";
|
|
6051
|
+
if (!skipToolIcon && details?.tool && typeof details.tool === "string" && details.tool !== "singul" && details.tool !== "core") {
|
|
6052
|
+
const raw = details.tool;
|
|
6053
|
+
let tn = raw.toLowerCase().replace(/[\s-]+/g, "_");
|
|
5970
6054
|
if (tn.startsWith("app:")) tn = tn.split(":")[2] || tn;
|
|
5971
|
-
toolApp = appsById[tn];
|
|
6055
|
+
toolApp = appsById[raw] || appsById[tn];
|
|
5972
6056
|
}
|
|
5973
6057
|
const questions = [];
|
|
5974
6058
|
if (item.category === "ask" || details?.action === "ask") {
|
|
@@ -6030,7 +6114,9 @@ var TimelineRow = ({
|
|
|
6030
6114
|
maxHeight: 60,
|
|
6031
6115
|
overflow: "hidden",
|
|
6032
6116
|
"& p": { margin: 0 },
|
|
6033
|
-
"& pre, & code": { fontSize: "0.78rem" }
|
|
6117
|
+
"& pre, & code": { fontSize: "0.78rem" },
|
|
6118
|
+
"& a": { color: "hsl(var(--primary))", textDecoration: "underline", textUnderlineOffset: "2px" },
|
|
6119
|
+
"& a:hover": { opacity: 0.85 }
|
|
6034
6120
|
}, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_markdown4.default, { remarkPlugins: [import_remark_gfm4.default, import_remark_breaks.default], children: normalizeMarkdown(displayLabel) }) }),
|
|
6035
6121
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Tooltip, { title: `Duration: ${dur.toFixed(1)}s \xB7 ${itemStart ? new Date(itemStart * 1e3).toLocaleString() : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Box, { sx: { width: maxWidth, position: "relative", height: 10, flexShrink: 0 }, children: dur > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Box, { sx: {
|
|
6036
6122
|
position: "absolute",
|
|
@@ -6047,7 +6133,9 @@ var TimelineRow = ({
|
|
|
6047
6133
|
import_material12.Box,
|
|
6048
6134
|
{
|
|
6049
6135
|
sx: { display: "flex", alignItems: "center", gap: 0.25, ml: 1, minWidth: 96, justifyContent: "flex-end" },
|
|
6050
|
-
onClick: (e) =>
|
|
6136
|
+
onClick: (e) => {
|
|
6137
|
+
if (e.target.closest("button, a")) e.stopPropagation();
|
|
6138
|
+
},
|
|
6051
6139
|
children: [
|
|
6052
6140
|
item.type === "decision" && details?.run_details?.status === "WAITING" && (item.category === "ask" || details?.action === "ask") && questions.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
6053
6141
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Tooltip, { title: "Approve this step", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
@@ -6251,6 +6339,7 @@ var AgentUI = ({
|
|
|
6251
6339
|
compact = false,
|
|
6252
6340
|
hideAppPicker = false,
|
|
6253
6341
|
hideAttach = false,
|
|
6342
|
+
disableStartTab = false,
|
|
6254
6343
|
appPickerLabel = "Select Apps / MCPs",
|
|
6255
6344
|
appPickerTitle = "Select Apps / MCPs",
|
|
6256
6345
|
appPickerSubtitle = "Pick the tools the agent is allowed to use for this run",
|
|
@@ -6260,16 +6349,21 @@ var AgentUI = ({
|
|
|
6260
6349
|
readUrlParams = true,
|
|
6261
6350
|
executionId,
|
|
6262
6351
|
authorization,
|
|
6352
|
+
initialExecution,
|
|
6263
6353
|
onRun,
|
|
6354
|
+
onViewChange,
|
|
6264
6355
|
apiKey,
|
|
6265
6356
|
apiBaseUrl,
|
|
6266
|
-
orgId
|
|
6357
|
+
orgId,
|
|
6358
|
+
className,
|
|
6359
|
+
sx,
|
|
6360
|
+
contentSx
|
|
6267
6361
|
}) => {
|
|
6268
|
-
const
|
|
6362
|
+
const resolveUrl2 = (0, import_react11.useCallback)(
|
|
6269
6363
|
(path) => apiBaseUrl ? `${apiBaseUrl.replace(/\/+$/, "")}${path}` : getApiUrl(path),
|
|
6270
6364
|
[apiBaseUrl]
|
|
6271
6365
|
);
|
|
6272
|
-
const
|
|
6366
|
+
const resolveHeaders2 = (0, import_react11.useCallback)(() => {
|
|
6273
6367
|
const h = apiKey ? { Authorization: `Bearer ${apiKey}` } : { ...getAuthHeader() };
|
|
6274
6368
|
if (orgId) h["Org-Id"] = orgId;
|
|
6275
6369
|
return h;
|
|
@@ -6283,6 +6377,8 @@ var AgentUI = ({
|
|
|
6283
6377
|
];
|
|
6284
6378
|
const [chosenApps, setChosenApps] = (0, import_react11.useState)(apps ?? defaultApps ?? BUILTIN_DEFAULT_APPS);
|
|
6285
6379
|
const [availableApps, setAvailableApps] = (0, import_react11.useState)([]);
|
|
6380
|
+
const [executionApps, setExecutionApps] = (0, import_react11.useState)([]);
|
|
6381
|
+
const [resolvedToolApps, setResolvedToolApps] = (0, import_react11.useState)({});
|
|
6286
6382
|
const [appSearchOpen, setAppSearchOpen] = (0, import_react11.useState)(false);
|
|
6287
6383
|
const [agentRequestLoading, setAgentRequestLoading] = (0, import_react11.useState)(false);
|
|
6288
6384
|
const [execution, setExecution] = (0, import_react11.useState)(null);
|
|
@@ -6361,15 +6457,118 @@ var AgentUI = ({
|
|
|
6361
6457
|
};
|
|
6362
6458
|
const appsById = (0, import_react11.useMemo)(() => {
|
|
6363
6459
|
const m = {};
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
|
|
6460
|
+
const add = (a) => {
|
|
6461
|
+
if (!a?.name) return;
|
|
6462
|
+
const slug = a.name.toLowerCase().replace(/[\s-]+/g, "_");
|
|
6463
|
+
if (!m[slug] || !m[slug].icon && a.icon) m[slug] = a;
|
|
6464
|
+
if (a.id) {
|
|
6465
|
+
if (!m[a.id] || !m[a.id].icon && a.icon) m[a.id] = a;
|
|
6466
|
+
}
|
|
6467
|
+
};
|
|
6468
|
+
for (const a of chosenApps) add(a);
|
|
6469
|
+
for (const a of executionApps) add(a);
|
|
6470
|
+
for (const [k, v] of Object.entries(resolvedToolApps)) {
|
|
6471
|
+
if (!m[k] || !m[k].icon && v.icon) m[k] = v;
|
|
6472
|
+
add(v);
|
|
6367
6473
|
}
|
|
6368
6474
|
return m;
|
|
6369
|
-
}, [chosenApps]);
|
|
6475
|
+
}, [chosenApps, executionApps, resolvedToolApps]);
|
|
6370
6476
|
(0, import_react11.useEffect)(() => {
|
|
6371
6477
|
if (apps) setChosenApps(apps);
|
|
6372
6478
|
}, [apps]);
|
|
6479
|
+
(0, import_react11.useEffect)(() => {
|
|
6480
|
+
const decisions = agentData?.decisions || [];
|
|
6481
|
+
if (!Array.isArray(decisions) || decisions.length === 0) return;
|
|
6482
|
+
const norm2 = (s) => s.toLowerCase().replace(/[\s-]+/g, "_");
|
|
6483
|
+
const wanted = [];
|
|
6484
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6485
|
+
for (const dec of decisions) {
|
|
6486
|
+
const action = dec?.action || dec?.details?.action;
|
|
6487
|
+
const category = dec?.category || dec?.details?.category;
|
|
6488
|
+
if (action === "finish" || action === "finalise" || action === "ask") continue;
|
|
6489
|
+
if (category === "finish" || category === "finalise" || category === "ask") continue;
|
|
6490
|
+
const tool = dec?.details?.tool ?? dec?.tool;
|
|
6491
|
+
if (!tool || typeof tool !== "string") continue;
|
|
6492
|
+
if (tool === "singul" || tool === "core") continue;
|
|
6493
|
+
let raw = tool;
|
|
6494
|
+
let slug = norm2(tool);
|
|
6495
|
+
if (slug.startsWith("app:")) slug = slug.split(":")[2] || slug;
|
|
6496
|
+
if (appsById[raw]?.icon || appsById[slug]?.icon) continue;
|
|
6497
|
+
if (resolvedToolApps[raw]?.icon || resolvedToolApps[slug]?.icon) continue;
|
|
6498
|
+
const key = `${raw}|${slug}`;
|
|
6499
|
+
if (seen.has(key)) continue;
|
|
6500
|
+
seen.add(key);
|
|
6501
|
+
wanted.push({ raw, slug });
|
|
6502
|
+
}
|
|
6503
|
+
if (wanted.length === 0) return;
|
|
6504
|
+
let cancelled = false;
|
|
6505
|
+
(async () => {
|
|
6506
|
+
const found = {};
|
|
6507
|
+
try {
|
|
6508
|
+
const all = await fetchApps({
|
|
6509
|
+
baseUrl: apiBaseUrl ? apiBaseUrl.replace(/\/+$/, "") : API_CONFIG.baseUrl,
|
|
6510
|
+
apiKey: apiKey || API_CONFIG.apiKey,
|
|
6511
|
+
orgId: orgId || null
|
|
6512
|
+
});
|
|
6513
|
+
if (Array.isArray(all) && all.length > 0) {
|
|
6514
|
+
const byId = /* @__PURE__ */ new Map();
|
|
6515
|
+
const byName = /* @__PURE__ */ new Map();
|
|
6516
|
+
for (const a of all) {
|
|
6517
|
+
if (a?.id) byId.set(String(a.id), a);
|
|
6518
|
+
if (a?.name) byName.set(norm2(String(a.name)), a);
|
|
6519
|
+
}
|
|
6520
|
+
for (const { raw, slug } of wanted) {
|
|
6521
|
+
const hit = byId.get(raw) || byName.get(slug);
|
|
6522
|
+
if (!hit) continue;
|
|
6523
|
+
const icon = hit.large_image || hit.image_url || hit.image || "";
|
|
6524
|
+
const app = { id: hit.id, name: hit.name || slug, icon };
|
|
6525
|
+
found[raw] = app;
|
|
6526
|
+
found[slug] = app;
|
|
6527
|
+
}
|
|
6528
|
+
}
|
|
6529
|
+
} catch {
|
|
6530
|
+
}
|
|
6531
|
+
const stillMissing = wanted.filter(({ raw, slug }) => !found[raw] && !found[slug]);
|
|
6532
|
+
if (stillMissing.length > 0) {
|
|
6533
|
+
try {
|
|
6534
|
+
const { algoliasearch: algoliasearch2 } = await import("algoliasearch");
|
|
6535
|
+
const client = algoliasearch2("JNSS5CFDZZ", "33e4e3564f4f060e96e0531957bed552");
|
|
6536
|
+
await Promise.all(stillMissing.map(async ({ raw, slug }) => {
|
|
6537
|
+
try {
|
|
6538
|
+
try {
|
|
6539
|
+
const obj = await client.getObject({ indexName: "appsearch", objectID: raw });
|
|
6540
|
+
if (obj?.image_url || obj?.name) {
|
|
6541
|
+
const app = { id: obj.objectID || raw, name: obj.name || slug, icon: obj.image_url || "" };
|
|
6542
|
+
found[raw] = app;
|
|
6543
|
+
found[slug] = app;
|
|
6544
|
+
return;
|
|
6545
|
+
}
|
|
6546
|
+
} catch {
|
|
6547
|
+
}
|
|
6548
|
+
const res = await client.searchSingleIndex({
|
|
6549
|
+
indexName: "appsearch",
|
|
6550
|
+
searchParams: { query: slug.replace(/_/g, " "), hitsPerPage: 3 }
|
|
6551
|
+
});
|
|
6552
|
+
const hits = res.hits || [];
|
|
6553
|
+
const match = hits.find((h) => norm2(h.name || "") === slug) || hits[0];
|
|
6554
|
+
if (match?.image_url || match?.name) {
|
|
6555
|
+
const app = { id: match.objectID || raw, name: match.name || slug, icon: match.image_url || "" };
|
|
6556
|
+
found[raw] = app;
|
|
6557
|
+
found[slug] = app;
|
|
6558
|
+
}
|
|
6559
|
+
} catch {
|
|
6560
|
+
}
|
|
6561
|
+
}));
|
|
6562
|
+
} catch {
|
|
6563
|
+
}
|
|
6564
|
+
}
|
|
6565
|
+
if (cancelled || Object.keys(found).length === 0) return;
|
|
6566
|
+
setResolvedToolApps((prev) => ({ ...prev, ...found }));
|
|
6567
|
+
})();
|
|
6568
|
+
return () => {
|
|
6569
|
+
cancelled = true;
|
|
6570
|
+
};
|
|
6571
|
+
}, [JSON.stringify(agentData?.decisions?.map((d) => d?.details?.tool || d?.tool) || []), appsById]);
|
|
6373
6572
|
(0, import_react11.useEffect)(() => {
|
|
6374
6573
|
const missing = chosenApps.filter((a) => !a.icon && a.name);
|
|
6375
6574
|
if (missing.length === 0) return;
|
|
@@ -6401,18 +6600,17 @@ var AgentUI = ({
|
|
|
6401
6600
|
const stillMissing = missing.filter((a) => !resolved[a.name]);
|
|
6402
6601
|
if (stillMissing.length > 0) {
|
|
6403
6602
|
try {
|
|
6404
|
-
const
|
|
6405
|
-
|
|
6406
|
-
|
|
6603
|
+
const baseUrl = apiBaseUrl ? apiBaseUrl.replace(/\/+$/, "") : API_CONFIG.baseUrl;
|
|
6604
|
+
const apps2 = await fetchApps({
|
|
6605
|
+
baseUrl,
|
|
6606
|
+
apiKey: apiKey || API_CONFIG.apiKey,
|
|
6607
|
+
orgId: orgId || null
|
|
6407
6608
|
});
|
|
6408
|
-
if (
|
|
6409
|
-
const
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
const img = m?.large_image || m?.image_url || m?.image;
|
|
6414
|
-
if (img) resolved[a.name] = img;
|
|
6415
|
-
}
|
|
6609
|
+
if (Array.isArray(apps2)) {
|
|
6610
|
+
for (const a of stillMissing) {
|
|
6611
|
+
const m = apps2.find((x) => norm2(x.name || "") === norm2(a.name));
|
|
6612
|
+
const img = m?.large_image || m?.image_url || m?.image;
|
|
6613
|
+
if (img) resolved[a.name] = img;
|
|
6416
6614
|
}
|
|
6417
6615
|
}
|
|
6418
6616
|
} catch {
|
|
@@ -6428,7 +6626,7 @@ var AgentUI = ({
|
|
|
6428
6626
|
return () => {
|
|
6429
6627
|
cancelled = true;
|
|
6430
6628
|
};
|
|
6431
|
-
}, [chosenApps, availableApps,
|
|
6629
|
+
}, [chosenApps, availableApps, resolveUrl2, resolveHeaders2]);
|
|
6432
6630
|
(0, import_react11.useEffect)(() => {
|
|
6433
6631
|
if (!autoLoadApps) return;
|
|
6434
6632
|
if (apps || defaultApps) return;
|
|
@@ -6436,9 +6634,9 @@ var AgentUI = ({
|
|
|
6436
6634
|
let cancelled = false;
|
|
6437
6635
|
(async () => {
|
|
6438
6636
|
try {
|
|
6439
|
-
const resp = await fetch(
|
|
6637
|
+
const resp = await fetch(resolveUrl2("/api/v1/apps/authentication"), {
|
|
6440
6638
|
credentials: "include",
|
|
6441
|
-
headers: { ...
|
|
6639
|
+
headers: { ...resolveHeaders2() }
|
|
6442
6640
|
});
|
|
6443
6641
|
if (!resp.ok) return;
|
|
6444
6642
|
const result = await resp.json();
|
|
@@ -6467,14 +6665,123 @@ var AgentUI = ({
|
|
|
6467
6665
|
return () => {
|
|
6468
6666
|
cancelled = true;
|
|
6469
6667
|
};
|
|
6470
|
-
}, [autoLoadApps, apps, defaultApps, hasApiKey,
|
|
6668
|
+
}, [autoLoadApps, apps, defaultApps, hasApiKey, resolveUrl2, resolveHeaders2]);
|
|
6669
|
+
(0, import_react11.useEffect)(() => {
|
|
6670
|
+
const raw = agentData?.allowed_actions;
|
|
6671
|
+
if (!Array.isArray(raw) || raw.length === 0) {
|
|
6672
|
+
setExecutionApps([]);
|
|
6673
|
+
return;
|
|
6674
|
+
}
|
|
6675
|
+
const parsed = [];
|
|
6676
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6677
|
+
for (const entry of raw) {
|
|
6678
|
+
if (typeof entry !== "string") continue;
|
|
6679
|
+
const parts = entry.split(":");
|
|
6680
|
+
if (parts.length < 3 || parts[0] !== "app") continue;
|
|
6681
|
+
const id = parts[1] || "";
|
|
6682
|
+
const name = parts.slice(2).join(":") || "";
|
|
6683
|
+
if (!name && !id) continue;
|
|
6684
|
+
const key = `${id}|${name}`;
|
|
6685
|
+
if (seen.has(key)) continue;
|
|
6686
|
+
seen.add(key);
|
|
6687
|
+
parsed.push({ id, name });
|
|
6688
|
+
}
|
|
6689
|
+
if (parsed.length === 0) {
|
|
6690
|
+
setExecutionApps([]);
|
|
6691
|
+
return;
|
|
6692
|
+
}
|
|
6693
|
+
const resolveFromAvailable = (id, name) => {
|
|
6694
|
+
const byId = id ? availableApps.find((a) => a.id === id) : void 0;
|
|
6695
|
+
const byName = !byId && name ? availableApps.find((a) => (a.name || "").toLowerCase() === name.toLowerCase()) : void 0;
|
|
6696
|
+
const hit = byId || byName;
|
|
6697
|
+
return { id: id || hit?.id, name: hit?.name || name, icon: hit?.icon };
|
|
6698
|
+
};
|
|
6699
|
+
const initial = parsed.map(({ id, name }) => resolveFromAvailable(id, name));
|
|
6700
|
+
setExecutionApps(initial);
|
|
6701
|
+
if (initial.every((a) => !!a.icon)) return;
|
|
6702
|
+
let cancelled = false;
|
|
6703
|
+
const norm2 = (s) => (s || "").toLowerCase().replace(/[\s-]+/g, "_");
|
|
6704
|
+
(async () => {
|
|
6705
|
+
let next = initial;
|
|
6706
|
+
try {
|
|
6707
|
+
const all = await fetchApps({
|
|
6708
|
+
baseUrl: API_CONFIG.baseUrl,
|
|
6709
|
+
apiKey: apiKey || API_CONFIG.apiKey,
|
|
6710
|
+
orgId: orgId || null
|
|
6711
|
+
});
|
|
6712
|
+
if (!cancelled && Array.isArray(all) && all.length > 0) {
|
|
6713
|
+
const byIdMap = /* @__PURE__ */ new Map();
|
|
6714
|
+
const byNameMap = /* @__PURE__ */ new Map();
|
|
6715
|
+
for (const a of all) {
|
|
6716
|
+
if (a?.id) byIdMap.set(String(a.id), a);
|
|
6717
|
+
if (a?.name) byNameMap.set(norm2(String(a.name)), a);
|
|
6718
|
+
}
|
|
6719
|
+
next = next.map((a) => {
|
|
6720
|
+
if (a.icon) return a;
|
|
6721
|
+
const hit = a.id && byIdMap.get(a.id) || byNameMap.get(norm2(a.name || ""));
|
|
6722
|
+
if (!hit) return a;
|
|
6723
|
+
return {
|
|
6724
|
+
id: a.id || hit.id,
|
|
6725
|
+
name: hit.name || a.name,
|
|
6726
|
+
icon: hit.large_image || hit.image_url || hit.image || a.icon
|
|
6727
|
+
};
|
|
6728
|
+
});
|
|
6729
|
+
}
|
|
6730
|
+
} catch {
|
|
6731
|
+
}
|
|
6732
|
+
const stillMissing = next.filter((a) => !a.icon);
|
|
6733
|
+
if (stillMissing.length > 0) {
|
|
6734
|
+
try {
|
|
6735
|
+
const { algoliasearch: algoliasearch2 } = await import("algoliasearch");
|
|
6736
|
+
const client = algoliasearch2("JNSS5CFDZZ", "33e4e3564f4f060e96e0531957bed552");
|
|
6737
|
+
const resolved = {};
|
|
6738
|
+
await Promise.all(stillMissing.map(async (a) => {
|
|
6739
|
+
try {
|
|
6740
|
+
if (a.id) {
|
|
6741
|
+
try {
|
|
6742
|
+
const obj = await client.getObject({ indexName: "appsearch", objectID: a.id });
|
|
6743
|
+
if (obj?.image_url) {
|
|
6744
|
+
resolved[a.id || a.name] = { name: obj.name || a.name, icon: obj.image_url, id: obj.objectID || a.id };
|
|
6745
|
+
return;
|
|
6746
|
+
}
|
|
6747
|
+
} catch {
|
|
6748
|
+
}
|
|
6749
|
+
}
|
|
6750
|
+
const res = await client.searchSingleIndex({
|
|
6751
|
+
indexName: "appsearch",
|
|
6752
|
+
searchParams: { query: (a.name || "").replace(/_/g, " "), hitsPerPage: 3 }
|
|
6753
|
+
});
|
|
6754
|
+
const hits = res.hits || [];
|
|
6755
|
+
const match = hits.find((h) => norm2(h.name || "") === norm2(a.name || "")) || hits[0];
|
|
6756
|
+
if (match?.image_url) {
|
|
6757
|
+
resolved[a.id || a.name] = { name: match.name || a.name, icon: match.image_url, id: match.objectID || a.id || "" };
|
|
6758
|
+
}
|
|
6759
|
+
} catch {
|
|
6760
|
+
}
|
|
6761
|
+
}));
|
|
6762
|
+
if (Object.keys(resolved).length > 0) {
|
|
6763
|
+
next = next.map((a) => {
|
|
6764
|
+
if (a.icon) return a;
|
|
6765
|
+
const r = resolved[a.id || a.name];
|
|
6766
|
+
return r ? { id: r.id || a.id, name: r.name || a.name, icon: r.icon } : a;
|
|
6767
|
+
});
|
|
6768
|
+
}
|
|
6769
|
+
} catch {
|
|
6770
|
+
}
|
|
6771
|
+
}
|
|
6772
|
+
if (!cancelled) setExecutionApps(next);
|
|
6773
|
+
})();
|
|
6774
|
+
return () => {
|
|
6775
|
+
cancelled = true;
|
|
6776
|
+
};
|
|
6777
|
+
}, [JSON.stringify(agentData?.allowed_actions || []), availableApps]);
|
|
6471
6778
|
const getExecution = (0, import_react11.useCallback)(async (executionId2, authorization2) => {
|
|
6472
6779
|
if (!executionId2 || !authorization2) return;
|
|
6473
6780
|
try {
|
|
6474
|
-
const resp = await fetch(
|
|
6781
|
+
const resp = await fetch(resolveUrl2("/api/v1/streams/results"), {
|
|
6475
6782
|
method: "POST",
|
|
6476
6783
|
credentials: "include",
|
|
6477
|
-
headers: { "Content-Type": "application/json", ...
|
|
6784
|
+
headers: { "Content-Type": "application/json", ...resolveHeaders2() },
|
|
6478
6785
|
body: JSON.stringify({ execution_id: executionId2, authorization: authorization2 })
|
|
6479
6786
|
});
|
|
6480
6787
|
if (activeExecutionIdRef.current && activeExecutionIdRef.current !== executionId2) return;
|
|
@@ -6521,6 +6828,29 @@ var AgentUI = ({
|
|
|
6521
6828
|
getExecution(eid, auth);
|
|
6522
6829
|
}
|
|
6523
6830
|
}, [readUrlParams, executionId, authorization, getExecution]);
|
|
6831
|
+
(0, import_react11.useEffect)(() => {
|
|
6832
|
+
if (!initialExecution || !initialExecution.execution_id) return;
|
|
6833
|
+
setShowStarter(false);
|
|
6834
|
+
activeExecutionIdRef.current = initialExecution.execution_id;
|
|
6835
|
+
setExecution(initialExecution);
|
|
6836
|
+
let actionResult = null;
|
|
6837
|
+
if (Array.isArray(initialExecution.results)) {
|
|
6838
|
+
actionResult = initialExecution.results.find((r) => r?.action?.app_name === "AI Agent") || initialExecution.results[0];
|
|
6839
|
+
} else {
|
|
6840
|
+
actionResult = initialExecution;
|
|
6841
|
+
}
|
|
6842
|
+
setAgentActionResult(actionResult);
|
|
6843
|
+
const v = validateJson(actionResult?.result);
|
|
6844
|
+
if (v.valid) {
|
|
6845
|
+
setAgentData({
|
|
6846
|
+
...v.result,
|
|
6847
|
+
started_at: initialExecution.started_at,
|
|
6848
|
+
completed_at: initialExecution.completed_at,
|
|
6849
|
+
status: initialExecution.status
|
|
6850
|
+
});
|
|
6851
|
+
}
|
|
6852
|
+
setError(null);
|
|
6853
|
+
}, [initialExecution?.execution_id]);
|
|
6524
6854
|
(0, import_react11.useEffect)(() => {
|
|
6525
6855
|
if (!execution?.execution_id || !execution?.authorization) return;
|
|
6526
6856
|
const status = (execution.status || "").toUpperCase();
|
|
@@ -6660,10 +6990,10 @@ var AgentUI = ({
|
|
|
6660
6990
|
decision_id: decisionId
|
|
6661
6991
|
});
|
|
6662
6992
|
try {
|
|
6663
|
-
const resp = await fetch(
|
|
6993
|
+
const resp = await fetch(resolveUrl2(`/api/v1/workflows/${wfId}/run?${params.toString()}`), {
|
|
6664
6994
|
method: "GET",
|
|
6665
6995
|
credentials: "include",
|
|
6666
|
-
headers: { ...
|
|
6996
|
+
headers: { ...resolveHeaders2() }
|
|
6667
6997
|
});
|
|
6668
6998
|
const json = await resp.json();
|
|
6669
6999
|
if (json.success === false) {
|
|
@@ -6730,10 +7060,10 @@ var AgentUI = ({
|
|
|
6730
7060
|
body.source_workflow = execution.workflow?.id;
|
|
6731
7061
|
setAgentRequestLoading(true);
|
|
6732
7062
|
try {
|
|
6733
|
-
const resp = await fetch(
|
|
7063
|
+
const resp = await fetch(resolveUrl2(`/api/v1/apps/agent/run?rerun=true&decision_id=${encodeURIComponent(decisionId)}`), {
|
|
6734
7064
|
method: "POST",
|
|
6735
7065
|
credentials: "include",
|
|
6736
|
-
headers: { "Content-Type": "application/json", ...
|
|
7066
|
+
headers: { "Content-Type": "application/json", ...resolveHeaders2() },
|
|
6737
7067
|
body: JSON.stringify(body)
|
|
6738
7068
|
});
|
|
6739
7069
|
const json = await resp.json().catch(() => ({}));
|
|
@@ -6843,6 +7173,9 @@ var AgentUI = ({
|
|
|
6843
7173
|
const activeTab = showStarter ? "start" : viewMode;
|
|
6844
7174
|
const hasExecution = !!execution?.execution_id;
|
|
6845
7175
|
const showRunSwitcher = hasExecution || agentRequestLoading;
|
|
7176
|
+
(0, import_react11.useEffect)(() => {
|
|
7177
|
+
onViewChange?.(activeTab);
|
|
7178
|
+
}, [activeTab, onViewChange]);
|
|
6846
7179
|
const goToTab = (t) => {
|
|
6847
7180
|
if (t === "start") {
|
|
6848
7181
|
setShowStarter(true);
|
|
@@ -6865,15 +7198,19 @@ var AgentUI = ({
|
|
|
6865
7198
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Box, { sx: { display: "inline-flex", gap: 0.25, p: 0.25, borderRadius: 999, bgcolor: "hsl(var(--muted) / 0.6)" }, children: ["start", "simple", "detailed"].map((t) => {
|
|
6866
7199
|
const active = activeTab === t;
|
|
6867
7200
|
const label = t === "start" ? "Start" : t === "simple" ? "Simple" : "Detailed";
|
|
7201
|
+
const disabled = t === "start" && disableStartTab;
|
|
6868
7202
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
6869
7203
|
import_material12.Box,
|
|
6870
7204
|
{
|
|
6871
7205
|
component: "button",
|
|
6872
7206
|
type: "button",
|
|
6873
|
-
onClick: () =>
|
|
7207
|
+
onClick: () => {
|
|
7208
|
+
if (!disabled) goToTab(t);
|
|
7209
|
+
},
|
|
7210
|
+
disabled,
|
|
6874
7211
|
sx: {
|
|
6875
7212
|
all: "unset",
|
|
6876
|
-
cursor: "pointer",
|
|
7213
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
6877
7214
|
px: 1.75,
|
|
6878
7215
|
py: 0.5,
|
|
6879
7216
|
borderRadius: 999,
|
|
@@ -6881,8 +7218,9 @@ var AgentUI = ({
|
|
|
6881
7218
|
fontWeight: 600,
|
|
6882
7219
|
color: active ? "hsl(var(--primary-foreground))" : "hsl(var(--muted-foreground))",
|
|
6883
7220
|
bgcolor: active ? "hsl(var(--primary))" : "transparent",
|
|
7221
|
+
opacity: disabled ? 0.4 : 1,
|
|
6884
7222
|
transition: "background 0.12s ease, color 0.12s ease",
|
|
6885
|
-
"&:hover": active ? {} : { color: "hsl(var(--foreground))", bgcolor: "hsl(var(--muted))" }
|
|
7223
|
+
"&:hover": active || disabled ? {} : { color: "hsl(var(--foreground))", bgcolor: "hsl(var(--muted))" }
|
|
6886
7224
|
},
|
|
6887
7225
|
children: label
|
|
6888
7226
|
},
|
|
@@ -6905,645 +7243,1451 @@ var AgentUI = ({
|
|
|
6905
7243
|
}
|
|
6906
7244
|
) }) })
|
|
6907
7245
|
] });
|
|
6908
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
|
|
6915
|
-
|
|
6916
|
-
|
|
6917
|
-
|
|
6918
|
-
|
|
6919
|
-
|
|
6920
|
-
|
|
6921
|
-
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
display: "flex",
|
|
6927
|
-
alignItems: "center",
|
|
6928
|
-
justifyContent: "center",
|
|
6929
|
-
boxShadow: "0 8px 24px rgba(0,0,0,0.25)"
|
|
6930
|
-
}, children: heroIcon ?? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentIcon_default, { size: Math.round(heroIconSize * 0.67) }) }),
|
|
6931
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Typography, { component: "h1", sx: {
|
|
6932
|
-
fontSize: compact ? { xs: "1.25rem", md: "1.5rem" } : { xs: "1.75rem", md: "2.25rem" },
|
|
6933
|
-
fontWeight: 600,
|
|
6934
|
-
color: "hsl(var(--foreground))",
|
|
6935
|
-
textAlign: "center",
|
|
6936
|
-
letterSpacing: "-0.01em"
|
|
6937
|
-
}, children: title }),
|
|
6938
|
-
subtitle && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Typography, { sx: {
|
|
6939
|
-
fontSize: "0.95rem",
|
|
6940
|
-
color: "hsl(var(--muted-foreground))",
|
|
6941
|
-
textAlign: "center",
|
|
6942
|
-
mt: -1,
|
|
6943
|
-
maxWidth: 600
|
|
6944
|
-
}, children: subtitle }),
|
|
6945
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material12.Box, { sx: {
|
|
6946
|
-
width: "100%",
|
|
6947
|
-
display: "flex",
|
|
6948
|
-
flexDirection: "column",
|
|
6949
|
-
gap: 1,
|
|
6950
|
-
borderRadius: attachedImages.length > 0 ? 4 : 999,
|
|
6951
|
-
border: "1.5px solid hsl(var(--border))",
|
|
6952
|
-
bgcolor: "hsl(var(--card))",
|
|
6953
|
-
px: 3,
|
|
6954
|
-
py: 1.75,
|
|
6955
|
-
transition: "border-color 0.15s ease, box-shadow 0.15s ease, border-radius 0.15s ease",
|
|
6956
|
-
"&:focus-within": {
|
|
6957
|
-
borderColor: "hsl(var(--primary))",
|
|
6958
|
-
boxShadow: "0 0 0 3px hsla(var(--primary) / 0.12)"
|
|
6959
|
-
}
|
|
6960
|
-
}, children: [
|
|
6961
|
-
attachedImages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Box, { sx: { display: "flex", flexWrap: "wrap", gap: 0.75 }, children: attachedImages.map((img, idx) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material12.Box, { sx: {
|
|
6962
|
-
display: "inline-flex",
|
|
6963
|
-
alignItems: "center",
|
|
6964
|
-
gap: 1,
|
|
6965
|
-
p: 0.5,
|
|
6966
|
-
pr: 1,
|
|
6967
|
-
borderRadius: 1.5,
|
|
6968
|
-
border: "1px solid hsl(var(--border))",
|
|
6969
|
-
bgcolor: "hsl(var(--background))",
|
|
6970
|
-
maxWidth: "100%"
|
|
6971
|
-
}, children: [
|
|
6972
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Box, { component: "img", src: img.dataUrl, alt: img.name, sx: { width: 32, height: 32, borderRadius: 1, objectFit: "cover", flexShrink: 0 } }),
|
|
6973
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--foreground))", maxWidth: 190, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: img.name }),
|
|
6974
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.IconButton, { 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__ */ (0, import_jsx_runtime14.jsx)(import_Close4.default, { sx: { fontSize: 12 } }) })
|
|
6975
|
-
] }, `${img.name}-${idx}`)) }),
|
|
6976
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material12.Box, { sx: { display: "flex", alignItems: "flex-end", gap: 1, width: "100%" }, children: [
|
|
6977
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
6978
|
-
import_material12.InputBase,
|
|
6979
|
-
{
|
|
6980
|
-
inputRef,
|
|
6981
|
-
autoFocus: true,
|
|
6982
|
-
multiline: true,
|
|
6983
|
-
minRows: 1,
|
|
6984
|
-
maxRows: 6,
|
|
6985
|
-
fullWidth: true,
|
|
6986
|
-
value: actionInput,
|
|
6987
|
-
onChange: (e) => setActionInput(e.target.value),
|
|
6988
|
-
placeholder,
|
|
6989
|
-
onKeyDown,
|
|
6990
|
-
onPaste: (e) => {
|
|
6991
|
-
const items = e.clipboardData?.items;
|
|
6992
|
-
if (!items) return;
|
|
6993
|
-
const files = [];
|
|
6994
|
-
for (const item of Array.from(items)) {
|
|
6995
|
-
if (item.kind === "file" && item.type.startsWith("image/")) {
|
|
6996
|
-
const file = item.getAsFile();
|
|
6997
|
-
if (file) files.push(file);
|
|
6998
|
-
}
|
|
6999
|
-
}
|
|
7000
|
-
if (files.length > 0) {
|
|
7001
|
-
e.preventDefault();
|
|
7002
|
-
handleImagesSelected(files);
|
|
7003
|
-
}
|
|
7004
|
-
},
|
|
7005
|
-
disabled: agentRequestLoading,
|
|
7006
|
-
sx: {
|
|
7007
|
-
fontSize: "1rem",
|
|
7008
|
-
color: "hsl(var(--foreground))",
|
|
7009
|
-
"& textarea::placeholder": { color: "hsl(var(--muted-foreground))", opacity: 0.7 }
|
|
7010
|
-
}
|
|
7011
|
-
}
|
|
7012
|
-
),
|
|
7013
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7014
|
-
"input",
|
|
7015
|
-
{
|
|
7016
|
-
ref: fileInputRef,
|
|
7017
|
-
type: "file",
|
|
7018
|
-
accept: "image/*",
|
|
7019
|
-
multiple: true,
|
|
7020
|
-
style: { display: "none" },
|
|
7021
|
-
onChange: (e) => {
|
|
7022
|
-
handleImagesSelected(e.target.files);
|
|
7023
|
-
if (e.target) e.target.value = "";
|
|
7024
|
-
}
|
|
7025
|
-
}
|
|
7026
|
-
),
|
|
7027
|
-
!hideAttach && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7028
|
-
import_material12.IconButton,
|
|
7029
|
-
{
|
|
7030
|
-
type: "button",
|
|
7031
|
-
onClick: () => fileInputRef.current?.click(),
|
|
7032
|
-
disabled: agentRequestLoading,
|
|
7033
|
-
title: attachedImages.length > 0 ? `Add image (${attachedImages.length} attached)` : "Attach image",
|
|
7034
|
-
sx: {
|
|
7035
|
-
width: 36,
|
|
7036
|
-
height: 36,
|
|
7037
|
-
color: attachedImages.length > 0 ? "hsl(var(--primary))" : "hsl(var(--muted-foreground))",
|
|
7038
|
-
bgcolor: attachedImages.length > 0 ? "hsla(var(--primary) / 0.1)" : "transparent",
|
|
7039
|
-
"&:hover": { color: "hsl(var(--foreground))", bgcolor: "hsl(var(--muted))" }
|
|
7040
|
-
},
|
|
7041
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_AttachFile.default, { sx: { fontSize: 18 } })
|
|
7042
|
-
}
|
|
7043
|
-
),
|
|
7044
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Tooltip, { title: submitTooltip, placement: "top", arrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7045
|
-
import_material12.IconButton,
|
|
7046
|
-
{
|
|
7047
|
-
type: "submit",
|
|
7048
|
-
disabled: actionInput.trim().length < 3 || agentRequestLoading,
|
|
7049
|
-
sx: {
|
|
7050
|
-
width: 36,
|
|
7051
|
-
height: 36,
|
|
7052
|
-
bgcolor: actionInput.trim().length >= 3 ? "hsl(var(--primary))" : "hsl(var(--muted))",
|
|
7053
|
-
color: actionInput.trim().length >= 3 ? "hsl(var(--primary-foreground))" : "hsl(var(--muted-foreground))",
|
|
7054
|
-
"&:hover": actionInput.trim().length >= 3 ? { filter: "brightness(1.1)", bgcolor: "hsl(var(--primary))" } : {},
|
|
7055
|
-
"&.Mui-disabled": { bgcolor: "hsl(var(--muted))", color: "hsl(var(--muted-foreground))" }
|
|
7056
|
-
},
|
|
7057
|
-
children: agentRequestLoading ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.CircularProgress, { size: 16, sx: { color: "inherit" } }) : submitIcon ?? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_PlayArrowRounded2.default, {})
|
|
7058
|
-
}
|
|
7059
|
-
) }) })
|
|
7060
|
-
] })
|
|
7061
|
-
] }),
|
|
7062
|
-
!hideAppPicker && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Box, { sx: { display: "flex", justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material12.Box, { sx: {
|
|
7063
|
-
display: "inline-flex",
|
|
7064
|
-
flexWrap: "wrap",
|
|
7065
|
-
alignItems: "center",
|
|
7066
|
-
gap: 0.5,
|
|
7067
|
-
p: 0.5,
|
|
7068
|
-
borderRadius: 999,
|
|
7069
|
-
border: "1px solid hsl(var(--border))",
|
|
7070
|
-
bgcolor: "hsl(var(--card))",
|
|
7071
|
-
maxWidth: "100%"
|
|
7072
|
-
}, children: [
|
|
7073
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
7246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7247
|
+
import_material12.Box,
|
|
7248
|
+
{
|
|
7249
|
+
className,
|
|
7250
|
+
sx: [
|
|
7251
|
+
{ width: "100%", display: "flex", justifyContent: "center", pb: 4 },
|
|
7252
|
+
...Array.isArray(sx) ? sx : sx ? [sx] : []
|
|
7253
|
+
],
|
|
7254
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
7255
|
+
import_material12.Box,
|
|
7256
|
+
{
|
|
7257
|
+
sx: [
|
|
7258
|
+
{ width: "100%", maxWidth, display: "flex", flexDirection: "column", gap: 3 },
|
|
7259
|
+
...Array.isArray(contentSx) ? contentSx : contentSx ? [contentSx] : []
|
|
7260
|
+
],
|
|
7261
|
+
children: [
|
|
7262
|
+
showRunSwitcher && tabBar,
|
|
7263
|
+
showStarter ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
7074
7264
|
import_material12.Box,
|
|
7075
7265
|
{
|
|
7076
|
-
component: "
|
|
7077
|
-
|
|
7078
|
-
|
|
7079
|
-
|
|
7080
|
-
all: "unset",
|
|
7081
|
-
cursor: "pointer",
|
|
7082
|
-
display: "inline-flex",
|
|
7083
|
-
alignItems: "center",
|
|
7084
|
-
gap: 0.5,
|
|
7085
|
-
px: 1.5,
|
|
7086
|
-
py: 0.5,
|
|
7087
|
-
borderRadius: 999,
|
|
7088
|
-
fontSize: "0.8rem",
|
|
7089
|
-
fontWeight: 500,
|
|
7090
|
-
color: "hsl(var(--muted-foreground))",
|
|
7091
|
-
bgcolor: "transparent",
|
|
7092
|
-
transition: "color 0.12s ease, background-color 0.12s ease",
|
|
7093
|
-
"&:hover": { color: "hsl(var(--foreground))", bgcolor: "hsl(var(--muted) / 0.5)" }
|
|
7266
|
+
component: "form",
|
|
7267
|
+
onSubmit: (e) => {
|
|
7268
|
+
e.preventDefault();
|
|
7269
|
+
submitInput(actionInput);
|
|
7094
7270
|
},
|
|
7271
|
+
sx: { display: "flex", flexDirection: "column", alignItems: "center", gap: compact ? 2 : 3, py: compact ? 2 : 4 },
|
|
7095
7272
|
children: [
|
|
7096
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7097
|
-
|
|
7273
|
+
!hideHeroIcon && !compact && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Box, { sx: {
|
|
7274
|
+
width: heroIconSize,
|
|
7275
|
+
height: heroIconSize,
|
|
7276
|
+
borderRadius: 3,
|
|
7277
|
+
bgcolor: "hsl(var(--card))",
|
|
7278
|
+
border: "1px solid hsl(var(--border))",
|
|
7279
|
+
display: "flex",
|
|
7280
|
+
alignItems: "center",
|
|
7281
|
+
justifyContent: "center",
|
|
7282
|
+
boxShadow: "0 8px 24px rgba(0,0,0,0.25)"
|
|
7283
|
+
}, children: heroIcon ?? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentIcon_default, { size: Math.round(heroIconSize * 0.67) }) }),
|
|
7284
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Typography, { component: "h1", sx: {
|
|
7285
|
+
fontSize: compact ? { xs: "1.25rem", md: "1.5rem" } : { xs: "1.75rem", md: "2.25rem" },
|
|
7286
|
+
fontWeight: 600,
|
|
7287
|
+
color: "hsl(var(--foreground))",
|
|
7288
|
+
textAlign: "center",
|
|
7289
|
+
letterSpacing: "-0.01em"
|
|
7290
|
+
}, children: title }),
|
|
7291
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Typography, { sx: {
|
|
7292
|
+
fontSize: "0.95rem",
|
|
7293
|
+
color: "hsl(var(--muted-foreground))",
|
|
7294
|
+
textAlign: "center",
|
|
7295
|
+
mt: -1,
|
|
7296
|
+
maxWidth: 600
|
|
7297
|
+
}, children: subtitle }),
|
|
7298
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material12.Box, { sx: {
|
|
7299
|
+
width: "100%",
|
|
7300
|
+
display: "flex",
|
|
7301
|
+
flexDirection: "column",
|
|
7302
|
+
gap: 1,
|
|
7303
|
+
borderRadius: attachedImages.length > 0 ? 4 : 999,
|
|
7304
|
+
border: "1.5px solid hsl(var(--border))",
|
|
7305
|
+
bgcolor: "hsl(var(--card))",
|
|
7306
|
+
px: 3,
|
|
7307
|
+
py: 1.75,
|
|
7308
|
+
transition: "border-color 0.15s ease, box-shadow 0.15s ease, border-radius 0.15s ease",
|
|
7309
|
+
"&:focus-within": {
|
|
7310
|
+
borderColor: "hsl(var(--primary))",
|
|
7311
|
+
boxShadow: "0 0 0 3px hsla(var(--primary) / 0.12)"
|
|
7312
|
+
}
|
|
7313
|
+
}, children: [
|
|
7314
|
+
attachedImages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Box, { sx: { display: "flex", flexWrap: "wrap", gap: 0.75 }, children: attachedImages.map((img, idx) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material12.Box, { sx: {
|
|
7315
|
+
display: "inline-flex",
|
|
7316
|
+
alignItems: "center",
|
|
7317
|
+
gap: 1,
|
|
7318
|
+
p: 0.5,
|
|
7319
|
+
pr: 1,
|
|
7320
|
+
borderRadius: 1.5,
|
|
7321
|
+
border: "1px solid hsl(var(--border))",
|
|
7322
|
+
bgcolor: "hsl(var(--background))",
|
|
7323
|
+
maxWidth: "100%"
|
|
7324
|
+
}, children: [
|
|
7325
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Box, { component: "img", src: img.dataUrl, alt: img.name, sx: { width: 32, height: 32, borderRadius: 1, objectFit: "cover", flexShrink: 0 } }),
|
|
7326
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--foreground))", maxWidth: 190, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: img.name }),
|
|
7327
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.IconButton, { 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__ */ (0, import_jsx_runtime14.jsx)(import_Close4.default, { sx: { fontSize: 12 } }) })
|
|
7328
|
+
] }, `${img.name}-${idx}`)) }),
|
|
7329
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material12.Box, { sx: { display: "flex", alignItems: "flex-end", gap: 1, width: "100%" }, children: [
|
|
7330
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7331
|
+
import_material12.InputBase,
|
|
7332
|
+
{
|
|
7333
|
+
inputRef,
|
|
7334
|
+
autoFocus: true,
|
|
7335
|
+
multiline: true,
|
|
7336
|
+
minRows: 1,
|
|
7337
|
+
maxRows: 6,
|
|
7338
|
+
fullWidth: true,
|
|
7339
|
+
value: actionInput,
|
|
7340
|
+
onChange: (e) => setActionInput(e.target.value),
|
|
7341
|
+
placeholder,
|
|
7342
|
+
onKeyDown,
|
|
7343
|
+
onPaste: (e) => {
|
|
7344
|
+
const items = e.clipboardData?.items;
|
|
7345
|
+
if (!items) return;
|
|
7346
|
+
const files = [];
|
|
7347
|
+
for (const item of Array.from(items)) {
|
|
7348
|
+
if (item.kind === "file" && item.type.startsWith("image/")) {
|
|
7349
|
+
const file = item.getAsFile();
|
|
7350
|
+
if (file) files.push(file);
|
|
7351
|
+
}
|
|
7352
|
+
}
|
|
7353
|
+
if (files.length > 0) {
|
|
7354
|
+
e.preventDefault();
|
|
7355
|
+
handleImagesSelected(files);
|
|
7356
|
+
}
|
|
7357
|
+
},
|
|
7358
|
+
disabled: agentRequestLoading,
|
|
7359
|
+
sx: {
|
|
7360
|
+
fontSize: "1rem",
|
|
7361
|
+
color: "hsl(var(--foreground))",
|
|
7362
|
+
"& textarea::placeholder": { color: "hsl(var(--muted-foreground))", opacity: 0.7 }
|
|
7363
|
+
}
|
|
7364
|
+
}
|
|
7365
|
+
),
|
|
7366
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7367
|
+
"input",
|
|
7368
|
+
{
|
|
7369
|
+
ref: fileInputRef,
|
|
7370
|
+
type: "file",
|
|
7371
|
+
accept: "image/*",
|
|
7372
|
+
multiple: true,
|
|
7373
|
+
style: { display: "none" },
|
|
7374
|
+
onChange: (e) => {
|
|
7375
|
+
handleImagesSelected(e.target.files);
|
|
7376
|
+
if (e.target) e.target.value = "";
|
|
7377
|
+
}
|
|
7378
|
+
}
|
|
7379
|
+
),
|
|
7380
|
+
!hideAttach && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7381
|
+
import_material12.IconButton,
|
|
7382
|
+
{
|
|
7383
|
+
type: "button",
|
|
7384
|
+
onClick: () => fileInputRef.current?.click(),
|
|
7385
|
+
disabled: agentRequestLoading,
|
|
7386
|
+
title: attachedImages.length > 0 ? `Add image (${attachedImages.length} attached)` : "Attach image",
|
|
7387
|
+
sx: {
|
|
7388
|
+
width: 36,
|
|
7389
|
+
height: 36,
|
|
7390
|
+
color: attachedImages.length > 0 ? "hsl(var(--primary))" : "hsl(var(--muted-foreground))",
|
|
7391
|
+
bgcolor: attachedImages.length > 0 ? "hsla(var(--primary) / 0.1)" : "transparent",
|
|
7392
|
+
"&:hover": { color: "hsl(var(--foreground))", bgcolor: "hsl(var(--muted))" }
|
|
7393
|
+
},
|
|
7394
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_AttachFile.default, { sx: { fontSize: 18 } })
|
|
7395
|
+
}
|
|
7396
|
+
),
|
|
7397
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Tooltip, { title: submitTooltip, placement: "top", arrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7398
|
+
import_material12.IconButton,
|
|
7399
|
+
{
|
|
7400
|
+
type: "submit",
|
|
7401
|
+
disabled: actionInput.trim().length < 3 || agentRequestLoading,
|
|
7402
|
+
sx: {
|
|
7403
|
+
width: 36,
|
|
7404
|
+
height: 36,
|
|
7405
|
+
bgcolor: actionInput.trim().length >= 3 ? "hsl(var(--primary))" : "hsl(var(--muted))",
|
|
7406
|
+
color: actionInput.trim().length >= 3 ? "hsl(var(--primary-foreground))" : "hsl(var(--muted-foreground))",
|
|
7407
|
+
"&:hover": actionInput.trim().length >= 3 ? { filter: "brightness(1.1)", bgcolor: "hsl(var(--primary))" } : {},
|
|
7408
|
+
"&.Mui-disabled": { bgcolor: "hsl(var(--muted))", color: "hsl(var(--muted-foreground))" }
|
|
7409
|
+
},
|
|
7410
|
+
children: agentRequestLoading ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.CircularProgress, { size: 16, sx: { color: "inherit" } }) : submitIcon ?? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_PlayArrowRounded2.default, {})
|
|
7411
|
+
}
|
|
7412
|
+
) }) })
|
|
7413
|
+
] })
|
|
7414
|
+
] }),
|
|
7415
|
+
!hideAppPicker && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Box, { sx: { display: "flex", justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material12.Box, { sx: {
|
|
7416
|
+
display: "inline-flex",
|
|
7417
|
+
flexWrap: "wrap",
|
|
7418
|
+
alignItems: "center",
|
|
7419
|
+
gap: 0.5,
|
|
7420
|
+
p: 0.5,
|
|
7421
|
+
borderRadius: 999,
|
|
7422
|
+
border: "1px solid hsl(var(--border))",
|
|
7423
|
+
bgcolor: "hsl(var(--card))",
|
|
7424
|
+
maxWidth: "100%"
|
|
7425
|
+
}, children: [
|
|
7426
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
7427
|
+
import_material12.Box,
|
|
7428
|
+
{
|
|
7429
|
+
component: "button",
|
|
7430
|
+
type: "button",
|
|
7431
|
+
onClick: () => setAppSearchOpen(true),
|
|
7432
|
+
sx: {
|
|
7433
|
+
all: "unset",
|
|
7434
|
+
cursor: "pointer",
|
|
7435
|
+
display: "inline-flex",
|
|
7436
|
+
alignItems: "center",
|
|
7437
|
+
gap: 0.5,
|
|
7438
|
+
px: 1.5,
|
|
7439
|
+
py: 0.5,
|
|
7440
|
+
borderRadius: 999,
|
|
7441
|
+
fontSize: "0.8rem",
|
|
7442
|
+
fontWeight: 500,
|
|
7443
|
+
color: "hsl(var(--muted-foreground))",
|
|
7444
|
+
bgcolor: "transparent",
|
|
7445
|
+
transition: "color 0.12s ease, background-color 0.12s ease",
|
|
7446
|
+
"&:hover": { color: "hsl(var(--foreground))", bgcolor: "hsl(var(--muted) / 0.5)" }
|
|
7447
|
+
},
|
|
7448
|
+
children: [
|
|
7449
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_Add2.default, { sx: { fontSize: 14 } }),
|
|
7450
|
+
appPickerLabel
|
|
7451
|
+
]
|
|
7452
|
+
}
|
|
7453
|
+
),
|
|
7454
|
+
chosenApps.map((app, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
7455
|
+
import_material12.Box,
|
|
7456
|
+
{
|
|
7457
|
+
sx: {
|
|
7458
|
+
display: "inline-flex",
|
|
7459
|
+
alignItems: "center",
|
|
7460
|
+
gap: 0.5,
|
|
7461
|
+
pl: 0.5,
|
|
7462
|
+
pr: 0.75,
|
|
7463
|
+
py: 0.25,
|
|
7464
|
+
borderRadius: 999,
|
|
7465
|
+
bgcolor: "hsl(var(--muted) / 0.6)",
|
|
7466
|
+
fontSize: "0.8rem",
|
|
7467
|
+
color: "hsl(var(--foreground))"
|
|
7468
|
+
},
|
|
7469
|
+
children: [
|
|
7470
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7471
|
+
import_material12.Avatar,
|
|
7472
|
+
{
|
|
7473
|
+
src: app.icon || void 0,
|
|
7474
|
+
alt: app.name,
|
|
7475
|
+
variant: "rounded",
|
|
7476
|
+
sx: { width: 18, height: 18, bgcolor: "transparent" }
|
|
7477
|
+
}
|
|
7478
|
+
),
|
|
7479
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Typography, { sx: { fontSize: "0.8rem", mx: 0.25, textTransform: "capitalize" }, children: app.name.replace(/_/g, " ") }),
|
|
7480
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7481
|
+
import_material12.IconButton,
|
|
7482
|
+
{
|
|
7483
|
+
size: "small",
|
|
7484
|
+
onClick: () => setChosenApps((prev) => prev.filter((_, idx) => idx !== i)),
|
|
7485
|
+
sx: { p: 0.125, color: "hsl(var(--muted-foreground))", "&:hover": { color: "hsl(var(--destructive))" } },
|
|
7486
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_Close4.default, { sx: { fontSize: 12 } })
|
|
7487
|
+
}
|
|
7488
|
+
)
|
|
7489
|
+
]
|
|
7490
|
+
},
|
|
7491
|
+
`${app.name}-${i}`
|
|
7492
|
+
))
|
|
7493
|
+
] }) }),
|
|
7494
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Box, { sx: {
|
|
7495
|
+
width: "100%",
|
|
7496
|
+
p: 1.5,
|
|
7497
|
+
borderRadius: 1.5,
|
|
7498
|
+
border: "1px solid hsl(var(--destructive) / 0.4)",
|
|
7499
|
+
bgcolor: "hsl(var(--destructive) / 0.08)",
|
|
7500
|
+
color: "hsl(var(--destructive))",
|
|
7501
|
+
fontSize: "0.85rem"
|
|
7502
|
+
}, children: error })
|
|
7098
7503
|
]
|
|
7099
7504
|
}
|
|
7100
|
-
),
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
fontSize: "0.
|
|
7114
|
-
|
|
7115
|
-
|
|
7116
|
-
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
|
|
7122
|
-
|
|
7123
|
-
|
|
7124
|
-
|
|
7125
|
-
|
|
7126
|
-
|
|
7127
|
-
|
|
7128
|
-
|
|
7505
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material12.Box, { children: [
|
|
7506
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material12.Box, { sx: {
|
|
7507
|
+
display: "flex",
|
|
7508
|
+
alignItems: "center",
|
|
7509
|
+
gap: 2,
|
|
7510
|
+
p: 2,
|
|
7511
|
+
borderRadius: 2,
|
|
7512
|
+
border: "1px solid hsl(var(--border))",
|
|
7513
|
+
bgcolor: "hsl(var(--card))",
|
|
7514
|
+
mb: 2
|
|
7515
|
+
}, children: [
|
|
7516
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material12.Box, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
7517
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Typography, { sx: { fontSize: "0.85rem", color: "hsl(var(--foreground))", fontWeight: 600, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: agentData?.original_input || actionInput || "Agent run" }),
|
|
7518
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material12.Typography, { sx: { fontSize: "0.7rem", color: "hsl(var(--muted-foreground))" }, children: [
|
|
7519
|
+
"Status: ",
|
|
7520
|
+
execution?.status || agentData?.status || "\u2014",
|
|
7521
|
+
" \xB7 ",
|
|
7522
|
+
execution?.execution_id?.slice(0, 8) || ""
|
|
7523
|
+
] })
|
|
7524
|
+
] }),
|
|
7525
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.AvatarGroup, { max: 6, sx: { "& .MuiAvatar-root": { width: 28, height: 28, borderColor: "hsl(var(--border))" } }, children: (executionApps.length > 0 ? executionApps : chosenApps).map((app, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Tooltip, { title: (app.name || "").replace(/_/g, " "), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7526
|
+
import_material12.Avatar,
|
|
7527
|
+
{
|
|
7528
|
+
src: app.icon || void 0,
|
|
7529
|
+
alt: app.name,
|
|
7530
|
+
variant: "rounded",
|
|
7531
|
+
onClick: () => navigate(`/apps/${encodeURIComponent((app.name || "").toLowerCase().replace(/\s+/g, "_"))}`),
|
|
7532
|
+
sx: {
|
|
7533
|
+
bgcolor: "hsl(var(--muted))",
|
|
7534
|
+
cursor: "pointer",
|
|
7535
|
+
transition: "transform 0.15s ease, border-color 0.15s ease",
|
|
7536
|
+
"&:hover": { transform: "scale(1.08)", borderColor: "hsl(var(--primary)) !important" }
|
|
7537
|
+
}
|
|
7538
|
+
}
|
|
7539
|
+
) }, i)) })
|
|
7540
|
+
] }),
|
|
7541
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Box, { sx: {
|
|
7542
|
+
p: 1.5,
|
|
7543
|
+
borderRadius: 1.5,
|
|
7544
|
+
mb: 2,
|
|
7545
|
+
border: "1px solid hsl(var(--destructive) / 0.4)",
|
|
7546
|
+
bgcolor: "hsl(var(--destructive) / 0.08)",
|
|
7547
|
+
color: "hsl(var(--destructive))",
|
|
7548
|
+
fontSize: "0.85rem"
|
|
7549
|
+
}, children: error }),
|
|
7550
|
+
viewMode === "simple" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Box, { sx: {
|
|
7551
|
+
borderRadius: 2,
|
|
7552
|
+
border: "1px solid hsl(var(--border))",
|
|
7553
|
+
bgcolor: "hsl(var(--card))",
|
|
7554
|
+
p: 2.5,
|
|
7555
|
+
display: "flex",
|
|
7556
|
+
flexDirection: "column",
|
|
7557
|
+
gap: 1.5
|
|
7558
|
+
}, children: (() => {
|
|
7559
|
+
const status = (execution?.status || agentData?.status || "EXECUTING").toUpperCase();
|
|
7560
|
+
const decisionCount = (agentData?.decisions || []).length;
|
|
7561
|
+
const isRunning = !["FINISHED", "FAILURE", "ABORTED", "CANCELLED", "CANCELED"].includes(status);
|
|
7562
|
+
const rawStartedAt = agentData?.started_at || execution?.started_at || 0;
|
|
7563
|
+
const startedAtSec = rawStartedAt > 1e12 ? Math.floor(rawStartedAt / 1e3) : rawStartedAt;
|
|
7564
|
+
const effectiveStart = startedAtSec || localRunStart || 0;
|
|
7565
|
+
let durationSec = null;
|
|
7566
|
+
if (isRunning && effectiveStart) {
|
|
7567
|
+
durationSec = Math.max(0, nowTick - effectiveStart);
|
|
7568
|
+
} else if (totalDuration && totalDuration > 0) {
|
|
7569
|
+
durationSec = Math.round(totalDuration);
|
|
7570
|
+
}
|
|
7571
|
+
const pendingAsk = (agentData?.decisions || []).slice().reverse().find((d) => {
|
|
7572
|
+
const isAsk = d.category === "ask" || d.action === "ask";
|
|
7573
|
+
const st = (d.run_details?.status || "").toUpperCase();
|
|
7574
|
+
return isAsk && (st === "RUNNING" || st === "WAITING");
|
|
7575
|
+
});
|
|
7576
|
+
const pendingQuestions = [];
|
|
7577
|
+
if (pendingAsk) {
|
|
7578
|
+
for (const f of pendingAsk.fields || []) {
|
|
7579
|
+
if (f.key === "question" && f.value) {
|
|
7580
|
+
pendingQuestions.push({ question: f.value, index: pendingQuestions.length + 1 });
|
|
7581
|
+
}
|
|
7582
|
+
}
|
|
7583
|
+
}
|
|
7584
|
+
const pendingAnswered = pendingQuestions.every((q) => questionAnswers[q.question]?.value);
|
|
7585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
7586
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material12.Box, { sx: { display: "flex", alignItems: "center", gap: 1, flexWrap: "wrap" }, children: [
|
|
7587
|
+
isRunning ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.CircularProgress, { size: 16, sx: { color: "hsl(var(--primary))" } }) : status === "FINISHED" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_CheckCircle3.default, { sx: { fontSize: 18, color: "hsl(142 70% 45%)" } }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_Error.default, { sx: { fontSize: 18, color: "hsl(var(--destructive))" } }),
|
|
7588
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Typography, { sx: { fontSize: "0.9rem", fontWeight: 600, color: "hsl(var(--foreground))" }, children: isRunning ? "Agent is working\u2026" : status === "FINISHED" ? "Run finished" : `Run ${status.toLowerCase()}` }),
|
|
7589
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material12.Typography, { sx: { fontSize: "0.75rem", color: "hsl(var(--muted-foreground))" }, children: [
|
|
7590
|
+
decisionCount,
|
|
7591
|
+
" step",
|
|
7592
|
+
decisionCount === 1 ? "" : "s",
|
|
7593
|
+
durationSec != null ? ` \xB7 ${durationSec}s` : ""
|
|
7594
|
+
] })
|
|
7595
|
+
] }),
|
|
7596
|
+
finishAnswer ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Box, { sx: {
|
|
7597
|
+
p: 2,
|
|
7598
|
+
borderRadius: 1.5,
|
|
7599
|
+
border: "1px solid hsl(var(--border))",
|
|
7600
|
+
bgcolor: "hsl(var(--background))",
|
|
7601
|
+
fontSize: "0.9rem",
|
|
7602
|
+
color: "hsl(var(--foreground))",
|
|
7603
|
+
"& > *:first-of-type": { mt: 0 },
|
|
7604
|
+
"& > *:last-child": { mb: 0 },
|
|
7605
|
+
"& p": { my: 1, lineHeight: 1.55 },
|
|
7606
|
+
"& h1, & h2, & h3, & h4": { mt: 2, mb: 1, fontWeight: 600, lineHeight: 1.3 },
|
|
7607
|
+
"& h1": { fontSize: "1.15rem" },
|
|
7608
|
+
"& h2": { fontSize: "1.05rem" },
|
|
7609
|
+
"& h3, & h4": { fontSize: "0.95rem" },
|
|
7610
|
+
"& ul": { my: 1, pl: 3, listStyleType: "disc", listStylePosition: "outside" },
|
|
7611
|
+
"& ol": { my: 1, pl: 3, listStyleType: "decimal", listStylePosition: "outside" },
|
|
7612
|
+
"& ul ul": { listStyleType: "circle" },
|
|
7613
|
+
"& ul ul ul": { listStyleType: "square" },
|
|
7614
|
+
"& li": { my: 0.25, display: "list-item" },
|
|
7615
|
+
"& li::marker": { color: "hsl(var(--muted-foreground))" },
|
|
7616
|
+
"& a": { color: "hsl(var(--primary))", textDecoration: "underline" },
|
|
7617
|
+
"& code": {
|
|
7618
|
+
px: 0.5,
|
|
7619
|
+
py: 0.125,
|
|
7620
|
+
borderRadius: 0.5,
|
|
7621
|
+
bgcolor: "hsl(var(--muted))",
|
|
7622
|
+
fontFamily: '"JetBrains Mono", ui-monospace, monospace',
|
|
7623
|
+
fontSize: "0.82em"
|
|
7624
|
+
},
|
|
7625
|
+
"& pre": {
|
|
7626
|
+
p: 1.5,
|
|
7627
|
+
my: 1,
|
|
7628
|
+
borderRadius: 1,
|
|
7629
|
+
bgcolor: "hsl(var(--muted))",
|
|
7630
|
+
overflowX: "auto",
|
|
7631
|
+
fontSize: "0.82rem"
|
|
7632
|
+
},
|
|
7633
|
+
"& pre code": { p: 0, bgcolor: "transparent" },
|
|
7634
|
+
"& blockquote": {
|
|
7635
|
+
borderLeft: "3px solid hsl(var(--border))",
|
|
7636
|
+
pl: 1.5,
|
|
7637
|
+
my: 1,
|
|
7638
|
+
color: "hsl(var(--muted-foreground))"
|
|
7639
|
+
},
|
|
7640
|
+
"& table": { borderCollapse: "collapse", my: 1, fontSize: "0.85rem" },
|
|
7641
|
+
"& th, & td": { border: "1px solid hsl(var(--border))", px: 1, py: 0.5 },
|
|
7642
|
+
"& hr": { border: 0, borderTop: "1px solid hsl(var(--border))", my: 1.5 }
|
|
7643
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_markdown4.default, { remarkPlugins: [import_remark_gfm4.default, import_remark_breaks.default], children: normalizeMarkdown(finishAnswer) }) }) : pendingAsk && pendingQuestions.length > 0 ? (() => {
|
|
7644
|
+
const trySimpleSubmit = () => {
|
|
7645
|
+
if (agentRequestLoading) return;
|
|
7646
|
+
if (!pendingAnswered) {
|
|
7647
|
+
setSimpleSubmitAttempted(true);
|
|
7648
|
+
return;
|
|
7649
|
+
}
|
|
7650
|
+
if (pendingAsk.run_details?.id) {
|
|
7651
|
+
submitQuestions(pendingAsk.run_details.id, questionAnswers);
|
|
7652
|
+
}
|
|
7653
|
+
};
|
|
7654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material12.Box, { sx: { display: "flex", flexDirection: "column", gap: 1.5 }, children: [
|
|
7655
|
+
pendingQuestions.map((q, qi) => {
|
|
7656
|
+
const value = questionAnswers[q.question]?.value || "";
|
|
7657
|
+
const isMissing = simpleSubmitAttempted && !value;
|
|
7658
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material12.Box, { children: [
|
|
7659
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Box, { sx: { fontSize: "0.9rem", color: "hsl(var(--foreground))", mb: 1, "& p": { my: 0.5 } }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_markdown4.default, { remarkPlugins: [import_remark_gfm4.default, import_remark_breaks.default], children: normalizeMarkdown(q.question) }) }),
|
|
7660
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7661
|
+
import_material12.TextField,
|
|
7662
|
+
{
|
|
7663
|
+
fullWidth: true,
|
|
7664
|
+
multiline: true,
|
|
7665
|
+
minRows: 2,
|
|
7666
|
+
placeholder: "Your answer here\u2026",
|
|
7667
|
+
value,
|
|
7668
|
+
error: isMissing,
|
|
7669
|
+
helperText: isMissing ? "Please answer this question" : void 0,
|
|
7670
|
+
onChange: (e) => {
|
|
7671
|
+
const v = e.target.value;
|
|
7672
|
+
setQuestionAnswers((prev) => ({
|
|
7673
|
+
...prev,
|
|
7674
|
+
[q.question]: { index: qi, value: v }
|
|
7675
|
+
}));
|
|
7676
|
+
},
|
|
7677
|
+
onKeyDown: (e) => {
|
|
7678
|
+
if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
|
|
7679
|
+
e.preventDefault();
|
|
7680
|
+
trySimpleSubmit();
|
|
7681
|
+
}
|
|
7682
|
+
},
|
|
7683
|
+
size: "small",
|
|
7684
|
+
sx: { "& .MuiOutlinedInput-root": { bgcolor: "hsl(var(--background))" } }
|
|
7685
|
+
}
|
|
7686
|
+
)
|
|
7687
|
+
] }, qi);
|
|
7688
|
+
}),
|
|
7689
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material12.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
7690
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7691
|
+
import_material12.Button,
|
|
7692
|
+
{
|
|
7693
|
+
variant: "contained",
|
|
7694
|
+
size: "small",
|
|
7695
|
+
disabled: agentRequestLoading,
|
|
7696
|
+
onClick: trySimpleSubmit,
|
|
7697
|
+
children: agentRequestLoading ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.CircularProgress, { size: 16 }) : "Submit"
|
|
7698
|
+
}
|
|
7699
|
+
),
|
|
7700
|
+
pendingAsk.run_details?.id && getFormUrl(pendingAsk.run_details.id) && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Tooltip, { title: "Answer in the Form UI", placement: "right", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7701
|
+
import_material12.IconButton,
|
|
7702
|
+
{
|
|
7703
|
+
size: "small",
|
|
7704
|
+
onClick: () => {
|
|
7705
|
+
const url = getFormUrl(pendingAsk.run_details.id);
|
|
7706
|
+
if (url) window.open(url, "_blank", "noopener,noreferrer");
|
|
7707
|
+
},
|
|
7708
|
+
sx: { color: "hsl(var(--muted-foreground))", "&:hover": { color: "hsl(var(--primary))" } },
|
|
7709
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_OpenInNew2.default, { sx: { fontSize: 18 } })
|
|
7710
|
+
}
|
|
7711
|
+
) })
|
|
7712
|
+
] })
|
|
7713
|
+
] });
|
|
7714
|
+
})() : isRunning ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Typography, { sx: { fontSize: "0.85rem", color: "hsl(var(--muted-foreground))" }, children: "Waiting for the agent to produce the first step." }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Typography, { sx: { fontSize: "0.85rem", color: "hsl(var(--muted-foreground))" }, children: "No final answer was returned. Open Detailed to inspect each step." }),
|
|
7715
|
+
!isRunning && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Box, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7716
|
+
import_material12.Button,
|
|
7129
7717
|
{
|
|
7130
7718
|
size: "small",
|
|
7131
|
-
|
|
7132
|
-
|
|
7133
|
-
|
|
7719
|
+
variant: "text",
|
|
7720
|
+
onClick: () => setViewMode("detailed"),
|
|
7721
|
+
sx: { color: "hsl(var(--primary))", textTransform: "none", px: 0 },
|
|
7722
|
+
children: "View detailed timeline \u2192"
|
|
7134
7723
|
}
|
|
7135
|
-
)
|
|
7136
|
-
]
|
|
7724
|
+
) })
|
|
7725
|
+
] });
|
|
7726
|
+
})() }),
|
|
7727
|
+
viewMode === "detailed" && (() => {
|
|
7728
|
+
const detailedStatus = (execution?.status || agentData?.status || "EXECUTING").toUpperCase();
|
|
7729
|
+
const detailedIsRunning = !["FINISHED", "FAILURE", "ABORTED", "CANCELLED", "CANCELED"].includes(detailedStatus);
|
|
7730
|
+
const detailedRunFinished = !detailedIsRunning;
|
|
7731
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Box, { sx: {
|
|
7732
|
+
borderRadius: 2,
|
|
7733
|
+
border: "1px solid hsl(var(--border))",
|
|
7734
|
+
bgcolor: "hsl(var(--card))",
|
|
7735
|
+
overflow: "hidden"
|
|
7736
|
+
}, children: timeline.length === 0 || timeline.length === 1 && agentRequestLoading ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material12.Box, { sx: { p: 4, textAlign: "center", color: "hsl(var(--muted-foreground))", fontSize: "0.85rem" }, children: [
|
|
7737
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.CircularProgress, { size: 20, sx: { mb: 1 } }),
|
|
7738
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Typography, { sx: { fontSize: "0.85rem" }, children: "Waiting for agent response\u2026" })
|
|
7739
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
7740
|
+
timeline.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7741
|
+
TimelineRow,
|
|
7742
|
+
{
|
|
7743
|
+
item,
|
|
7744
|
+
index: i,
|
|
7745
|
+
open: openIndexes.has(i),
|
|
7746
|
+
onToggle: () => toggleOpen(i),
|
|
7747
|
+
appsById,
|
|
7748
|
+
totalDuration,
|
|
7749
|
+
originalStartTime,
|
|
7750
|
+
maxWidth: 210,
|
|
7751
|
+
questionAnswers,
|
|
7752
|
+
setQuestionAnswers,
|
|
7753
|
+
onSubmitQuestions: submitQuestions,
|
|
7754
|
+
onRerunAgent: rerunAgent,
|
|
7755
|
+
onRerunDecision: rerunDecision,
|
|
7756
|
+
agentRequestLoading,
|
|
7757
|
+
getFormUrl,
|
|
7758
|
+
runFinished: detailedRunFinished
|
|
7759
|
+
},
|
|
7760
|
+
i
|
|
7761
|
+
)),
|
|
7762
|
+
detailedRunFinished && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material12.Box, { sx: {
|
|
7763
|
+
borderTop: "1px solid hsl(var(--border))",
|
|
7764
|
+
p: 2.5,
|
|
7765
|
+
display: "flex",
|
|
7766
|
+
flexDirection: "column",
|
|
7767
|
+
gap: 1.5,
|
|
7768
|
+
bgcolor: "hsl(var(--muted) / 0.2)"
|
|
7769
|
+
}, children: [
|
|
7770
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material12.Box, { sx: { display: "flex", alignItems: "center", gap: 1, flexWrap: "wrap" }, children: [
|
|
7771
|
+
detailedStatus === "FINISHED" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_CheckCircle3.default, { sx: { fontSize: 18, color: "hsl(142 70% 45%)" } }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_Error.default, { sx: { fontSize: 18, color: "hsl(var(--destructive))" } }),
|
|
7772
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Typography, { sx: { fontSize: "0.9rem", fontWeight: 600, color: "hsl(var(--foreground))" }, children: detailedStatus === "FINISHED" ? "Run finished" : `Run ${detailedStatus.toLowerCase()}` })
|
|
7773
|
+
] }),
|
|
7774
|
+
finishAnswer && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Box, { sx: {
|
|
7775
|
+
p: 2,
|
|
7776
|
+
borderRadius: 1.5,
|
|
7777
|
+
border: "1px solid hsl(var(--border))",
|
|
7778
|
+
bgcolor: "hsl(var(--background))",
|
|
7779
|
+
fontSize: "0.9rem",
|
|
7780
|
+
color: "hsl(var(--foreground))",
|
|
7781
|
+
"& > *:first-of-type": { mt: 0 },
|
|
7782
|
+
"& > *:last-child": { mb: 0 },
|
|
7783
|
+
"& p": { my: 1, lineHeight: 1.55 },
|
|
7784
|
+
"& a": { color: "hsl(var(--primary))", textDecoration: "underline" },
|
|
7785
|
+
"& code": {
|
|
7786
|
+
px: 0.5,
|
|
7787
|
+
py: 0.125,
|
|
7788
|
+
borderRadius: 0.5,
|
|
7789
|
+
bgcolor: "hsl(var(--muted))",
|
|
7790
|
+
fontFamily: '"JetBrains Mono", ui-monospace, monospace',
|
|
7791
|
+
fontSize: "0.82em"
|
|
7792
|
+
},
|
|
7793
|
+
"& pre": {
|
|
7794
|
+
p: 1.5,
|
|
7795
|
+
my: 1,
|
|
7796
|
+
borderRadius: 1,
|
|
7797
|
+
bgcolor: "hsl(var(--muted))",
|
|
7798
|
+
overflowX: "auto",
|
|
7799
|
+
fontSize: "0.82rem"
|
|
7800
|
+
},
|
|
7801
|
+
"& pre code": { p: 0, bgcolor: "transparent" }
|
|
7802
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_markdown4.default, { remarkPlugins: [import_remark_gfm4.default, import_remark_breaks.default], children: normalizeMarkdown(finishAnswer) }) })
|
|
7803
|
+
] })
|
|
7804
|
+
] }) });
|
|
7805
|
+
})(),
|
|
7806
|
+
finishDecisionId && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Box, { sx: { mt: 3, display: "flex", justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material12.Box, { sx: { width: "100%", maxWidth: 640 }, children: [
|
|
7807
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Typography, { sx: { fontSize: "0.75rem", color: "hsl(var(--muted-foreground))", mb: 0.75, textAlign: "center" }, children: "Continue this agent run with more details" }),
|
|
7808
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
7809
|
+
import_material12.Box,
|
|
7810
|
+
{
|
|
7811
|
+
component: "form",
|
|
7812
|
+
onSubmit: (e) => {
|
|
7813
|
+
e.preventDefault();
|
|
7814
|
+
if (continuationText.trim()) {
|
|
7815
|
+
submitQuestions(finishDecisionId, { continue: continuationText }, true);
|
|
7816
|
+
}
|
|
7817
|
+
},
|
|
7818
|
+
sx: {
|
|
7819
|
+
display: "flex",
|
|
7820
|
+
alignItems: "flex-end",
|
|
7821
|
+
gap: 1,
|
|
7822
|
+
p: 1.25,
|
|
7823
|
+
borderRadius: 999,
|
|
7824
|
+
border: "1.5px solid hsl(var(--border))",
|
|
7825
|
+
bgcolor: "hsl(var(--card))",
|
|
7826
|
+
"&:focus-within": {
|
|
7827
|
+
borderColor: "hsl(var(--primary))",
|
|
7828
|
+
boxShadow: "0 0 0 3px hsla(var(--primary) / 0.12)"
|
|
7829
|
+
}
|
|
7830
|
+
},
|
|
7831
|
+
children: [
|
|
7832
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7833
|
+
import_material12.InputBase,
|
|
7834
|
+
{
|
|
7835
|
+
fullWidth: true,
|
|
7836
|
+
multiline: true,
|
|
7837
|
+
minRows: 1,
|
|
7838
|
+
maxRows: 4,
|
|
7839
|
+
placeholder: continuationPlaceholder,
|
|
7840
|
+
value: continuationText,
|
|
7841
|
+
onChange: (e) => setContinuationText(e.target.value),
|
|
7842
|
+
onKeyDown: (e) => {
|
|
7843
|
+
if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
|
|
7844
|
+
e.preventDefault();
|
|
7845
|
+
if (continuationText.trim() && !agentRequestLoading) {
|
|
7846
|
+
submitQuestions(finishDecisionId, { continue: continuationText }, true);
|
|
7847
|
+
}
|
|
7848
|
+
}
|
|
7849
|
+
},
|
|
7850
|
+
disabled: agentRequestLoading,
|
|
7851
|
+
sx: { fontSize: "0.9rem", color: "hsl(var(--foreground))", px: 2 }
|
|
7852
|
+
}
|
|
7853
|
+
),
|
|
7854
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7855
|
+
import_material12.IconButton,
|
|
7856
|
+
{
|
|
7857
|
+
type: "submit",
|
|
7858
|
+
disabled: !continuationText.trim() || agentRequestLoading,
|
|
7859
|
+
sx: {
|
|
7860
|
+
width: 36,
|
|
7861
|
+
height: 36,
|
|
7862
|
+
bgcolor: continuationText.trim() && !agentRequestLoading ? "hsl(var(--primary))" : "hsl(var(--muted))",
|
|
7863
|
+
color: continuationText.trim() && !agentRequestLoading ? "hsl(var(--primary-foreground))" : "hsl(var(--muted-foreground))",
|
|
7864
|
+
"&:hover": continuationText.trim() && !agentRequestLoading ? { filter: "brightness(1.1)", bgcolor: "hsl(var(--primary))" } : {}
|
|
7865
|
+
},
|
|
7866
|
+
children: agentRequestLoading ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.CircularProgress, { size: 16, sx: { color: "inherit" } }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_Send.default, { sx: { fontSize: 18 } })
|
|
7867
|
+
}
|
|
7868
|
+
)
|
|
7869
|
+
]
|
|
7870
|
+
}
|
|
7871
|
+
)
|
|
7872
|
+
] }) })
|
|
7873
|
+
] }),
|
|
7874
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7875
|
+
AppSearchDrawer,
|
|
7876
|
+
{
|
|
7877
|
+
open: appSearchOpen,
|
|
7878
|
+
onClose: () => setAppSearchOpen(false),
|
|
7879
|
+
title: appPickerTitle,
|
|
7880
|
+
subtitle: appPickerSubtitle,
|
|
7881
|
+
onQuickSelect: (app) => {
|
|
7882
|
+
const known = availableApps.find((a) => a.name?.toLowerCase() === app.name?.toLowerCase());
|
|
7883
|
+
setChosenApps(
|
|
7884
|
+
(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 }]
|
|
7885
|
+
);
|
|
7886
|
+
}
|
|
7887
|
+
}
|
|
7888
|
+
)
|
|
7889
|
+
]
|
|
7890
|
+
}
|
|
7891
|
+
)
|
|
7892
|
+
}
|
|
7893
|
+
);
|
|
7894
|
+
};
|
|
7895
|
+
var AgentUI_default = AgentUI;
|
|
7896
|
+
|
|
7897
|
+
// AgentRunDrawer.tsx
|
|
7898
|
+
var import_react12 = require("react");
|
|
7899
|
+
var import_material13 = require("@mui/material");
|
|
7900
|
+
var import_Close5 = __toESM(require("@mui/icons-material/Close"), 1);
|
|
7901
|
+
var import_lucide_react3 = require("lucide-react");
|
|
7902
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
7903
|
+
var TAB_ORDER = ["run", "permissions", "localLLM"];
|
|
7904
|
+
var AgentRunDrawer = ({
|
|
7905
|
+
open,
|
|
7906
|
+
onClose,
|
|
7907
|
+
initialTab = "run",
|
|
7908
|
+
permissionsSlot,
|
|
7909
|
+
localLLMSlot,
|
|
7910
|
+
localLLMTabBadge,
|
|
7911
|
+
permissionsDisabled = false,
|
|
7912
|
+
permissionsDisabledTooltip = "Coming soon",
|
|
7913
|
+
agentUIProps,
|
|
7914
|
+
width = 520,
|
|
7915
|
+
title = "Agent",
|
|
7916
|
+
subtitle = "Run actions and manage permissions",
|
|
7917
|
+
className,
|
|
7918
|
+
paperSx,
|
|
7919
|
+
headerSx,
|
|
7920
|
+
tabsSx,
|
|
7921
|
+
bodySx
|
|
7922
|
+
}) => {
|
|
7923
|
+
const [activeTab, setActiveTab] = (0, import_react12.useState)(initialTab);
|
|
7924
|
+
const prevOpenRef = (0, import_react12.useRef)(open);
|
|
7925
|
+
(0, import_react12.useEffect)(() => {
|
|
7926
|
+
if (open && !prevOpenRef.current) setActiveTab(initialTab);
|
|
7927
|
+
prevOpenRef.current = open;
|
|
7928
|
+
}, [open, initialTab]);
|
|
7929
|
+
const visibleTabs = TAB_ORDER.filter((t) => {
|
|
7930
|
+
if (t === "run") return true;
|
|
7931
|
+
if (t === "permissions") return !!permissionsSlot;
|
|
7932
|
+
if (t === "localLLM") return !!localLLMSlot;
|
|
7933
|
+
return false;
|
|
7934
|
+
});
|
|
7935
|
+
const showTabs = visibleTabs.length > 1;
|
|
7936
|
+
const safeActiveTab = visibleTabs.includes(activeTab) ? activeTab : "run";
|
|
7937
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
7938
|
+
import_material13.Drawer,
|
|
7939
|
+
{
|
|
7940
|
+
anchor: "right",
|
|
7941
|
+
open,
|
|
7942
|
+
onClose,
|
|
7943
|
+
slotProps: {
|
|
7944
|
+
paper: {
|
|
7945
|
+
className,
|
|
7946
|
+
sx: [
|
|
7947
|
+
{
|
|
7948
|
+
width: { xs: "100%", sm: width },
|
|
7949
|
+
background: "linear-gradient(180deg, hsl(var(--card)) 0%, hsl(var(--background)) 100%)",
|
|
7950
|
+
borderLeft: "1px solid hsl(var(--border))",
|
|
7951
|
+
boxShadow: "-8px 0 32px hsla(0, 0%, 0%, 0.4)",
|
|
7952
|
+
display: "flex",
|
|
7953
|
+
flexDirection: "column"
|
|
7954
|
+
},
|
|
7955
|
+
...Array.isArray(paperSx) ? paperSx : paperSx ? [paperSx] : []
|
|
7956
|
+
]
|
|
7957
|
+
}
|
|
7958
|
+
},
|
|
7959
|
+
children: [
|
|
7960
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
7961
|
+
import_material13.Box,
|
|
7962
|
+
{
|
|
7963
|
+
sx: [
|
|
7964
|
+
{
|
|
7965
|
+
px: 3,
|
|
7966
|
+
py: 2.5,
|
|
7967
|
+
display: "flex",
|
|
7968
|
+
alignItems: "center",
|
|
7969
|
+
gap: 2,
|
|
7970
|
+
borderBottom: "1px solid hsl(var(--border))",
|
|
7971
|
+
flexShrink: 0
|
|
7137
7972
|
},
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
|
|
7141
|
-
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
|
|
7973
|
+
...Array.isArray(headerSx) ? headerSx : headerSx ? [headerSx] : []
|
|
7974
|
+
],
|
|
7975
|
+
children: [
|
|
7976
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
7977
|
+
import_material13.Box,
|
|
7978
|
+
{
|
|
7979
|
+
sx: {
|
|
7980
|
+
width: 40,
|
|
7981
|
+
height: 40,
|
|
7982
|
+
borderRadius: "50%",
|
|
7983
|
+
display: "flex",
|
|
7984
|
+
alignItems: "center",
|
|
7985
|
+
justifyContent: "center",
|
|
7986
|
+
background: "hsla(var(--primary) / 0.12)",
|
|
7987
|
+
color: "hsl(var(--primary))",
|
|
7988
|
+
flexShrink: 0
|
|
7989
|
+
},
|
|
7990
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AgentIcon_default, { size: 22 })
|
|
7991
|
+
}
|
|
7992
|
+
),
|
|
7993
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_material13.Box, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
7994
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material13.Typography, { sx: { fontWeight: 600, fontSize: "1.1rem", color: "hsl(var(--foreground))" }, children: title }),
|
|
7995
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material13.Typography, { sx: { fontSize: "0.8rem", color: "hsl(var(--muted-foreground))" }, children: subtitle })
|
|
7996
|
+
] }),
|
|
7997
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material13.IconButton, { onClick: onClose, size: "small", sx: { color: "hsl(var(--muted-foreground))" }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_Close5.default, { fontSize: "small" }) })
|
|
7998
|
+
]
|
|
7999
|
+
}
|
|
8000
|
+
),
|
|
8001
|
+
showTabs && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material13.Box, { sx: { borderBottom: "1px solid hsl(var(--border))", flexShrink: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
8002
|
+
import_material13.Tabs,
|
|
8003
|
+
{
|
|
8004
|
+
value: safeActiveTab,
|
|
8005
|
+
onChange: (_, v) => setActiveTab(v),
|
|
8006
|
+
sx: [
|
|
8007
|
+
{
|
|
8008
|
+
minHeight: 42,
|
|
8009
|
+
px: 3,
|
|
8010
|
+
"& .MuiTab-root": {
|
|
8011
|
+
minHeight: 42,
|
|
8012
|
+
textTransform: "none",
|
|
8013
|
+
fontSize: "0.85rem",
|
|
8014
|
+
fontWeight: 500,
|
|
8015
|
+
color: "hsl(var(--muted-foreground))",
|
|
8016
|
+
"&.Mui-selected": { color: "hsl(var(--primary))" }
|
|
8017
|
+
},
|
|
8018
|
+
"& .MuiTabs-indicator": { bgcolor: "hsl(var(--primary))" }
|
|
8019
|
+
},
|
|
8020
|
+
...Array.isArray(tabsSx) ? tabsSx : tabsSx ? [tabsSx] : []
|
|
8021
|
+
],
|
|
8022
|
+
children: [
|
|
8023
|
+
visibleTabs.includes("run") && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
8024
|
+
import_material13.Tab,
|
|
8025
|
+
{
|
|
8026
|
+
value: "run",
|
|
8027
|
+
label: "Run",
|
|
8028
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react3.Play, { size: 14 }),
|
|
8029
|
+
iconPosition: "start",
|
|
8030
|
+
sx: { gap: 0.75 }
|
|
8031
|
+
}
|
|
8032
|
+
),
|
|
8033
|
+
visibleTabs.includes("permissions") && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
8034
|
+
import_material13.Tab,
|
|
8035
|
+
{
|
|
8036
|
+
value: "permissions",
|
|
8037
|
+
label: permissionsDisabled ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material13.Tooltip, { title: permissionsDisabledTooltip, arrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material13.Box, { component: "span", sx: { display: "inline-flex", alignItems: "center" }, children: "Permissions" }) }) : "Permissions",
|
|
8038
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react3.ShieldCheck, { size: 14 }),
|
|
8039
|
+
iconPosition: "start",
|
|
8040
|
+
disabled: permissionsDisabled,
|
|
8041
|
+
sx: { gap: 0.75 }
|
|
8042
|
+
}
|
|
8043
|
+
),
|
|
8044
|
+
visibleTabs.includes("localLLM") && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
8045
|
+
import_material13.Tab,
|
|
8046
|
+
{
|
|
8047
|
+
value: "localLLM",
|
|
8048
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_material13.Box, { sx: { display: "flex", alignItems: "center", gap: 0.5 }, children: [
|
|
8049
|
+
"Local LLM",
|
|
8050
|
+
localLLMTabBadge
|
|
8051
|
+
] }),
|
|
8052
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react3.Server, { size: 14 }),
|
|
8053
|
+
iconPosition: "start",
|
|
8054
|
+
sx: { gap: 0.75 }
|
|
8055
|
+
}
|
|
8056
|
+
)
|
|
8057
|
+
]
|
|
8058
|
+
}
|
|
8059
|
+
) }),
|
|
8060
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_material13.Box, { sx: [{ flex: 1, overflowY: "auto" }, ...Array.isArray(bodySx) ? bodySx : bodySx ? [bodySx] : []], children: [
|
|
8061
|
+
safeActiveTab === "run" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material13.Box, { sx: { px: 2, py: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
8062
|
+
AgentUI_default,
|
|
8063
|
+
{
|
|
8064
|
+
compact: true,
|
|
8065
|
+
hideHeroIcon: true,
|
|
8066
|
+
title: "",
|
|
8067
|
+
subtitle: null,
|
|
8068
|
+
...agentUIProps
|
|
8069
|
+
}
|
|
8070
|
+
) }),
|
|
8071
|
+
safeActiveTab === "permissions" && permissionsSlot && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material13.Box, { sx: { px: 3, py: 2.5 }, children: permissionsSlot }),
|
|
8072
|
+
safeActiveTab === "localLLM" && localLLMSlot && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material13.Box, { sx: { px: 3, py: 2.5 }, children: localLLMSlot })
|
|
8073
|
+
] })
|
|
8074
|
+
]
|
|
8075
|
+
}
|
|
8076
|
+
);
|
|
8077
|
+
};
|
|
8078
|
+
var AgentRunDrawer_default = AgentRunDrawer;
|
|
8079
|
+
|
|
8080
|
+
// AgentActivityList.tsx
|
|
8081
|
+
var import_react13 = require("react");
|
|
8082
|
+
var import_material14 = require("@mui/material");
|
|
8083
|
+
var import_Search = __toESM(require("@mui/icons-material/Search"), 1);
|
|
8084
|
+
var import_lucide_react4 = require("lucide-react");
|
|
8085
|
+
|
|
8086
|
+
// agentActivity.ts
|
|
8087
|
+
var resolveUrl = (path, baseUrl) => baseUrl ? `${baseUrl.replace(/\/+$/, "")}${path}` : getApiUrl(path);
|
|
8088
|
+
var resolveHeaders = (apiKey, orgId) => {
|
|
8089
|
+
const h = apiKey ? { Authorization: `Bearer ${apiKey}` } : { ...getAuthHeader() };
|
|
8090
|
+
if (orgId) h["Org-Id"] = orgId;
|
|
8091
|
+
return h;
|
|
8092
|
+
};
|
|
8093
|
+
var searchAgentActivity = async (params = {}) => {
|
|
8094
|
+
const {
|
|
8095
|
+
cursor = "",
|
|
8096
|
+
limit = 50,
|
|
8097
|
+
status = "",
|
|
8098
|
+
startTime = "",
|
|
8099
|
+
endTime = "",
|
|
8100
|
+
suborgRuns = false,
|
|
8101
|
+
apiKey,
|
|
8102
|
+
apiBaseUrl,
|
|
8103
|
+
orgId
|
|
8104
|
+
} = params;
|
|
8105
|
+
const payload = {
|
|
8106
|
+
workflow_id: "AGENT",
|
|
8107
|
+
cursor,
|
|
8108
|
+
limit,
|
|
8109
|
+
status,
|
|
8110
|
+
start_time: startTime,
|
|
8111
|
+
end_time: endTime,
|
|
8112
|
+
suborg_runs: suborgRuns
|
|
8113
|
+
};
|
|
8114
|
+
const response = await fetch(resolveUrl("/api/v1/workflows/search", apiBaseUrl), {
|
|
8115
|
+
method: "POST",
|
|
8116
|
+
credentials: "include",
|
|
8117
|
+
headers: {
|
|
8118
|
+
"Content-Type": "application/json",
|
|
8119
|
+
...resolveHeaders(apiKey, orgId)
|
|
8120
|
+
},
|
|
8121
|
+
body: JSON.stringify(payload)
|
|
8122
|
+
});
|
|
8123
|
+
if (!response.ok) {
|
|
8124
|
+
throw new Error(`Failed to fetch agent activity: ${response.statusText}`);
|
|
8125
|
+
}
|
|
8126
|
+
const data = await response.json();
|
|
8127
|
+
return {
|
|
8128
|
+
success: data.success ?? false,
|
|
8129
|
+
runs: data.runs || [],
|
|
8130
|
+
cursor: data.cursor || ""
|
|
8131
|
+
};
|
|
8132
|
+
};
|
|
8133
|
+
|
|
8134
|
+
// AgentActivityList.tsx
|
|
8135
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
8136
|
+
var STATUS_CONFIG = {
|
|
8137
|
+
FINISHED: { icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react4.CheckCircle, { size: 16 }), color: "hsl(var(--severity-low, 142 71% 45%))", label: "Completed" },
|
|
8138
|
+
SUCCESS: { icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react4.CheckCircle, { size: 16 }), color: "hsl(var(--severity-low, 142 71% 45%))", label: "Completed" },
|
|
8139
|
+
FAILED: { icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react4.XCircle, { size: 16 }), color: "hsl(var(--severity-critical, 0 72% 55%))", label: "Failed" },
|
|
8140
|
+
ABORTED: { icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react4.XCircle, { size: 16 }), color: "hsl(var(--severity-critical, 0 72% 55%))", label: "Aborted" },
|
|
8141
|
+
EXECUTING: { icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react4.Loader2, { size: 16 }), color: "hsl(var(--severity-medium, 38 92% 50%))", label: "Running" },
|
|
8142
|
+
RUNNING: { icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react4.Loader2, { size: 16 }), color: "hsl(var(--severity-medium, 38 92% 50%))", label: "Running" },
|
|
8143
|
+
WAITING: { icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react4.Clock, { size: 16 }), color: "hsl(var(--severity-info, 217 91% 60%))", label: "Waiting" }
|
|
8144
|
+
};
|
|
8145
|
+
var getRunIcon = (run) => {
|
|
8146
|
+
const src = (run.execution_source || "").toLowerCase();
|
|
8147
|
+
const arg = (run.execution_argument || "").toLowerCase();
|
|
8148
|
+
if (src.includes("schedule") || src.includes("cron")) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react4.Clock, { size: 18 });
|
|
8149
|
+
if (src.includes("webhook") || src.includes("http")) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react4.Globe, { size: 18 });
|
|
8150
|
+
if (arg.includes("alert") || arg.includes("detect")) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react4.Activity, { size: 18 });
|
|
8151
|
+
if (arg.includes("report") || arg.includes("email")) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react4.FileText, { size: 18 });
|
|
8152
|
+
if (arg.includes("endpoint") || arg.includes("server")) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react4.Server, { size: 18 });
|
|
8153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react4.Zap, { size: 18 });
|
|
8154
|
+
};
|
|
8155
|
+
var getRunIconColor = (run) => {
|
|
8156
|
+
const status = (run.status || "").toUpperCase();
|
|
8157
|
+
if (status === "FINISHED" || status === "SUCCESS") return "hsl(var(--severity-low, 142 71% 45%))";
|
|
8158
|
+
if (status === "FAILED" || status === "ABORTED") return "hsl(var(--severity-critical, 0 72% 55%))";
|
|
8159
|
+
if (status === "EXECUTING" || status === "RUNNING") return "hsl(var(--severity-medium, 38 92% 50%))";
|
|
8160
|
+
return "hsl(var(--primary, 24 100% 50%))";
|
|
8161
|
+
};
|
|
8162
|
+
var formatDuration = (run) => {
|
|
8163
|
+
if (run.started_at && run.completed_at) {
|
|
8164
|
+
const startSec = Number(run.started_at);
|
|
8165
|
+
const endSec = Number(run.completed_at);
|
|
8166
|
+
if (!isNaN(startSec) && !isNaN(endSec)) {
|
|
8167
|
+
const ms = (endSec - startSec) * 1e3;
|
|
8168
|
+
if (ms < 1e3) return `${Math.round(ms)}ms`;
|
|
8169
|
+
if (ms < 6e4) return `${(ms / 1e3).toFixed(1)}s`;
|
|
8170
|
+
return `${Math.floor(ms / 6e4)}m ${Math.floor(ms % 6e4 / 1e3)}s`;
|
|
8171
|
+
}
|
|
8172
|
+
}
|
|
8173
|
+
if (run.duration) return `${run.duration.toFixed(1)}s`;
|
|
8174
|
+
return "";
|
|
8175
|
+
};
|
|
8176
|
+
var getTimeAgo = (dateStr) => {
|
|
8177
|
+
try {
|
|
8178
|
+
const ts = isNaN(Number(dateStr)) ? new Date(dateStr).getTime() : Number(dateStr) * 1e3;
|
|
8179
|
+
if (isNaN(ts)) return dateStr;
|
|
8180
|
+
const diffSec = Math.max(0, Math.floor((Date.now() - ts) / 1e3));
|
|
8181
|
+
if (diffSec < 60) return `${diffSec}s ago`;
|
|
8182
|
+
if (diffSec < 3600) return `${Math.floor(diffSec / 60)}m ago`;
|
|
8183
|
+
if (diffSec < 86400) return `${Math.floor(diffSec / 3600)}h ago`;
|
|
8184
|
+
return `${Math.floor(diffSec / 86400)}d ago`;
|
|
8185
|
+
} catch {
|
|
8186
|
+
return dateStr;
|
|
8187
|
+
}
|
|
8188
|
+
};
|
|
8189
|
+
var getRunTitle = (run) => {
|
|
8190
|
+
if (run.workflow?.name) return run.workflow.name;
|
|
8191
|
+
if (run.execution_argument) {
|
|
8192
|
+
try {
|
|
8193
|
+
const parsed = JSON.parse(run.execution_argument);
|
|
8194
|
+
if (parsed.title) return parsed.title;
|
|
8195
|
+
if (parsed.action) return parsed.action;
|
|
8196
|
+
if (parsed.name) return parsed.name;
|
|
8197
|
+
} catch {
|
|
8198
|
+
const clean = run.execution_argument.replace(/[{}"]/g, "").trim();
|
|
8199
|
+
if (clean.length > 0 && clean.length < 80) return clean;
|
|
8200
|
+
}
|
|
8201
|
+
}
|
|
8202
|
+
return `Execution ${run.execution_id?.slice(0, 8) || "\u2014"}`;
|
|
8203
|
+
};
|
|
8204
|
+
var getRunSubtitle = (run) => {
|
|
8205
|
+
if (run.result) {
|
|
8206
|
+
try {
|
|
8207
|
+
const p = JSON.parse(run.result);
|
|
8208
|
+
if (p.output && typeof p.output === "string") {
|
|
8209
|
+
return p.output.length > 120 ? p.output.slice(0, 120) + "\u2026" : p.output;
|
|
7151
8210
|
}
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
|
|
7156
|
-
|
|
7157
|
-
|
|
7158
|
-
|
|
7159
|
-
|
|
7160
|
-
|
|
7161
|
-
|
|
7162
|
-
|
|
7163
|
-
|
|
7164
|
-
|
|
7165
|
-
|
|
7166
|
-
|
|
7167
|
-
|
|
7168
|
-
|
|
7169
|
-
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
8211
|
+
if (p.original_input && typeof p.original_input === "string") {
|
|
8212
|
+
return p.original_input.length > 120 ? p.original_input.slice(0, 120) + "\u2026" : p.original_input;
|
|
8213
|
+
}
|
|
8214
|
+
if (p.message && typeof p.message === "string") return p.message;
|
|
8215
|
+
} catch {
|
|
8216
|
+
if (run.result.length < 120) return run.result;
|
|
8217
|
+
}
|
|
8218
|
+
}
|
|
8219
|
+
return run.execution_source || "Agent execution";
|
|
8220
|
+
};
|
|
8221
|
+
var AgentRunRow = ({ run, onClick, sx }) => {
|
|
8222
|
+
const statusKey = (run.status || "").toUpperCase();
|
|
8223
|
+
const cfg = STATUS_CONFIG[statusKey] || STATUS_CONFIG.WAITING;
|
|
8224
|
+
const iconColor = getRunIconColor(run);
|
|
8225
|
+
const duration = formatDuration(run);
|
|
8226
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
8227
|
+
import_material14.Box,
|
|
8228
|
+
{
|
|
8229
|
+
onClick,
|
|
8230
|
+
sx: [
|
|
8231
|
+
{
|
|
8232
|
+
borderRadius: 2,
|
|
8233
|
+
border: "1px solid hsl(var(--border))",
|
|
8234
|
+
bgcolor: "hsl(var(--card))",
|
|
8235
|
+
display: "flex",
|
|
8236
|
+
alignItems: "center",
|
|
8237
|
+
gap: 2,
|
|
8238
|
+
px: 2.5,
|
|
8239
|
+
py: 2,
|
|
8240
|
+
cursor: "pointer",
|
|
8241
|
+
transition: "background 0.15s ease, border-color 0.15s ease",
|
|
8242
|
+
"&:hover": {
|
|
8243
|
+
bgcolor: "hsla(var(--muted) / 0.5)",
|
|
8244
|
+
borderColor: "hsl(var(--muted-foreground) / 0.3)"
|
|
8245
|
+
}
|
|
8246
|
+
},
|
|
8247
|
+
...Array.isArray(sx) ? sx : sx ? [sx] : []
|
|
8248
|
+
],
|
|
8249
|
+
children: [
|
|
8250
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8251
|
+
import_material14.Box,
|
|
7174
8252
|
{
|
|
7175
|
-
src: app.icon || void 0,
|
|
7176
|
-
alt: app.name,
|
|
7177
|
-
variant: "rounded",
|
|
7178
|
-
onClick: () => navigate(`/apps/${encodeURIComponent(app.name.toLowerCase().replace(/\s+/g, "_"))}`),
|
|
7179
8253
|
sx: {
|
|
7180
|
-
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
8254
|
+
width: 40,
|
|
8255
|
+
height: 40,
|
|
8256
|
+
borderRadius: "50%",
|
|
8257
|
+
display: "flex",
|
|
8258
|
+
alignItems: "center",
|
|
8259
|
+
justifyContent: "center",
|
|
8260
|
+
bgcolor: `${iconColor}15`,
|
|
8261
|
+
color: iconColor,
|
|
8262
|
+
flexShrink: 0
|
|
8263
|
+
},
|
|
8264
|
+
children: getRunIcon(run)
|
|
7185
8265
|
}
|
|
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
|
-
|
|
7211
|
-
|
|
7212
|
-
|
|
7213
|
-
|
|
7214
|
-
|
|
7215
|
-
|
|
7216
|
-
durationSec = Math.round(totalDuration);
|
|
7217
|
-
}
|
|
7218
|
-
const pendingAsk = (agentData?.decisions || []).slice().reverse().find((d) => {
|
|
7219
|
-
const isAsk = d.category === "ask" || d.action === "ask";
|
|
7220
|
-
const st = (d.run_details?.status || "").toUpperCase();
|
|
7221
|
-
return isAsk && (st === "RUNNING" || st === "WAITING");
|
|
7222
|
-
});
|
|
7223
|
-
const pendingQuestions = [];
|
|
7224
|
-
if (pendingAsk) {
|
|
7225
|
-
for (const f of pendingAsk.fields || []) {
|
|
7226
|
-
if (f.key === "question" && f.value) {
|
|
7227
|
-
pendingQuestions.push({ question: f.value, index: pendingQuestions.length + 1 });
|
|
8266
|
+
),
|
|
8267
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_material14.Box, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
8268
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_material14.Box, { sx: { display: "flex", alignItems: "center", gap: 1, mb: 0.25 }, children: [
|
|
8269
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8270
|
+
import_material14.Typography,
|
|
8271
|
+
{
|
|
8272
|
+
sx: {
|
|
8273
|
+
fontSize: "0.9rem",
|
|
8274
|
+
fontWeight: 500,
|
|
8275
|
+
color: "hsl(var(--foreground))",
|
|
8276
|
+
overflow: "hidden",
|
|
8277
|
+
textOverflow: "ellipsis",
|
|
8278
|
+
whiteSpace: "nowrap"
|
|
8279
|
+
},
|
|
8280
|
+
children: getRunTitle(run)
|
|
8281
|
+
}
|
|
8282
|
+
),
|
|
8283
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material14.Box, { sx: { display: "flex", alignItems: "center", color: cfg.color, flexShrink: 0 }, children: cfg.icon })
|
|
8284
|
+
] }),
|
|
8285
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8286
|
+
import_material14.Typography,
|
|
8287
|
+
{
|
|
8288
|
+
sx: {
|
|
8289
|
+
fontSize: "0.78rem",
|
|
8290
|
+
color: "hsl(var(--muted-foreground))",
|
|
8291
|
+
overflow: "hidden",
|
|
8292
|
+
textOverflow: "ellipsis",
|
|
8293
|
+
whiteSpace: "nowrap"
|
|
8294
|
+
},
|
|
8295
|
+
children: getRunSubtitle(run)
|
|
7228
8296
|
}
|
|
7229
|
-
|
|
7230
|
-
|
|
7231
|
-
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7235
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Typography, { sx: { fontSize: "0.9rem", fontWeight: 600, color: "hsl(var(--foreground))" }, children: isRunning ? "Agent is working\u2026" : status === "FINISHED" ? "Run finished" : `Run ${status.toLowerCase()}` }),
|
|
7236
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material12.Typography, { sx: { fontSize: "0.75rem", color: "hsl(var(--muted-foreground))" }, children: [
|
|
7237
|
-
decisionCount,
|
|
7238
|
-
" step",
|
|
7239
|
-
decisionCount === 1 ? "" : "s",
|
|
7240
|
-
durationSec != null ? ` \xB7 ${durationSec}s` : ""
|
|
8297
|
+
),
|
|
8298
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_material14.Box, { sx: { display: "flex", alignItems: "center", gap: 1, mt: 0.5 }, children: [
|
|
8299
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material14.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.7 }, children: run.started_at ? getTimeAgo(run.started_at) : "\u2014" }),
|
|
8300
|
+
duration && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
8301
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material14.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.4 }, children: "\xB7" }),
|
|
8302
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material14.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.7 }, children: duration })
|
|
7241
8303
|
] })
|
|
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
|
-
|
|
7290
|
-
|
|
7291
|
-
|
|
7292
|
-
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
|
|
8304
|
+
] })
|
|
8305
|
+
] })
|
|
8306
|
+
]
|
|
8307
|
+
}
|
|
8308
|
+
);
|
|
8309
|
+
};
|
|
8310
|
+
var STATUS_FILTERS = [
|
|
8311
|
+
{ label: "All", value: "" },
|
|
8312
|
+
{ label: "Completed", value: "FINISHED" },
|
|
8313
|
+
{ label: "Running", value: "EXECUTING" },
|
|
8314
|
+
{ label: "Failed", value: "ABORTED" }
|
|
8315
|
+
];
|
|
8316
|
+
var AgentActivityList = ({
|
|
8317
|
+
apiKey,
|
|
8318
|
+
apiBaseUrl,
|
|
8319
|
+
orgId,
|
|
8320
|
+
onRunClick,
|
|
8321
|
+
showSearchBar = true,
|
|
8322
|
+
showStatusChips = true,
|
|
8323
|
+
limit = 50,
|
|
8324
|
+
emptyTitle = "No agent activity found",
|
|
8325
|
+
emptySubtitle = "The agent has not performed any actions yet",
|
|
8326
|
+
className,
|
|
8327
|
+
sx,
|
|
8328
|
+
toolbarSx,
|
|
8329
|
+
rowSx
|
|
8330
|
+
}) => {
|
|
8331
|
+
const [runs, setRuns] = (0, import_react13.useState)([]);
|
|
8332
|
+
const [cursor, setCursor] = (0, import_react13.useState)("");
|
|
8333
|
+
const [hasMore, setHasMore] = (0, import_react13.useState)(false);
|
|
8334
|
+
const [isLoading, setIsLoading] = (0, import_react13.useState)(false);
|
|
8335
|
+
const [error, setError] = (0, import_react13.useState)(null);
|
|
8336
|
+
const [statusFilter, setStatusFilter] = (0, import_react13.useState)("");
|
|
8337
|
+
const [searchQuery, setSearchQuery] = (0, import_react13.useState)("");
|
|
8338
|
+
const [debouncedQuery, setDebouncedQuery] = (0, import_react13.useState)("");
|
|
8339
|
+
const debounceRef = (0, import_react13.useRef)();
|
|
8340
|
+
const updateSearchQuery = (0, import_react13.useCallback)((q) => {
|
|
8341
|
+
setSearchQuery(q);
|
|
8342
|
+
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
8343
|
+
debounceRef.current = setTimeout(() => setDebouncedQuery(q), 350);
|
|
8344
|
+
}, []);
|
|
8345
|
+
(0, import_react13.useEffect)(() => () => {
|
|
8346
|
+
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
8347
|
+
}, []);
|
|
8348
|
+
const fetchRuns = (0, import_react13.useCallback)(
|
|
8349
|
+
async (append = false, cursorParam = "") => {
|
|
8350
|
+
setIsLoading(true);
|
|
8351
|
+
setError(null);
|
|
8352
|
+
try {
|
|
8353
|
+
const result = await searchAgentActivity({
|
|
8354
|
+
limit,
|
|
8355
|
+
status: statusFilter,
|
|
8356
|
+
cursor: cursorParam,
|
|
8357
|
+
apiKey,
|
|
8358
|
+
apiBaseUrl,
|
|
8359
|
+
orgId
|
|
8360
|
+
});
|
|
8361
|
+
if (result.success) {
|
|
8362
|
+
setRuns((prev) => append ? [...prev, ...result.runs] : result.runs);
|
|
8363
|
+
setCursor(result.cursor);
|
|
8364
|
+
setHasMore(!!result.cursor && result.runs.length > 0);
|
|
8365
|
+
} else {
|
|
8366
|
+
setError("Failed to fetch agent activity");
|
|
8367
|
+
}
|
|
8368
|
+
} catch (err) {
|
|
8369
|
+
setError(err instanceof Error ? err.message : "Failed to fetch agent activity");
|
|
8370
|
+
} finally {
|
|
8371
|
+
setIsLoading(false);
|
|
8372
|
+
}
|
|
8373
|
+
},
|
|
8374
|
+
[statusFilter, limit, apiKey, apiBaseUrl, orgId]
|
|
8375
|
+
);
|
|
8376
|
+
(0, import_react13.useEffect)(() => {
|
|
8377
|
+
fetchRuns(false, "");
|
|
8378
|
+
}, [statusFilter, apiKey, apiBaseUrl, orgId]);
|
|
8379
|
+
const loadMore = (0, import_react13.useCallback)(() => {
|
|
8380
|
+
if (cursor && !isLoading) fetchRuns(true, cursor);
|
|
8381
|
+
}, [cursor, isLoading, fetchRuns]);
|
|
8382
|
+
const filteredRuns = debouncedQuery ? runs.filter((r) => {
|
|
8383
|
+
const hay = [
|
|
8384
|
+
getRunTitle(r),
|
|
8385
|
+
getRunSubtitle(r),
|
|
8386
|
+
r.execution_id,
|
|
8387
|
+
r.execution_source,
|
|
8388
|
+
r.status
|
|
8389
|
+
].filter(Boolean).join(" ").toLowerCase();
|
|
8390
|
+
return hay.includes(debouncedQuery.toLowerCase());
|
|
8391
|
+
}) : runs;
|
|
8392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
8393
|
+
import_material14.Box,
|
|
8394
|
+
{
|
|
8395
|
+
className,
|
|
8396
|
+
sx: [{ display: "flex", flexDirection: "column", gap: 2 }, ...Array.isArray(sx) ? sx : sx ? [sx] : []],
|
|
8397
|
+
children: [
|
|
8398
|
+
(showSearchBar || showStatusChips) && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_material14.Box, { sx: [{ display: "flex", alignItems: "center", gap: 1.5, flexWrap: "wrap" }, ...Array.isArray(toolbarSx) ? toolbarSx : toolbarSx ? [toolbarSx] : []], children: [
|
|
8399
|
+
showSearchBar && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8400
|
+
import_material14.TextField,
|
|
8401
|
+
{
|
|
8402
|
+
placeholder: "Search results...",
|
|
8403
|
+
size: "small",
|
|
8404
|
+
value: searchQuery,
|
|
8405
|
+
onChange: (e) => updateSearchQuery(e.target.value),
|
|
8406
|
+
slotProps: {
|
|
8407
|
+
input: {
|
|
8408
|
+
startAdornment: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material14.InputAdornment, { position: "start", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_Search.default, { sx: { fontSize: 18, color: "hsl(var(--muted-foreground))" } }) })
|
|
8409
|
+
}
|
|
8410
|
+
},
|
|
8411
|
+
sx: {
|
|
8412
|
+
flex: 1,
|
|
8413
|
+
maxWidth: 280,
|
|
8414
|
+
minWidth: 160,
|
|
8415
|
+
"& .MuiOutlinedInput-root": {
|
|
8416
|
+
bgcolor: "hsl(var(--card))",
|
|
8417
|
+
borderRadius: 1.5,
|
|
8418
|
+
fontSize: "0.85rem",
|
|
8419
|
+
height: 36,
|
|
8420
|
+
"& fieldset": { borderColor: "hsl(var(--border))" },
|
|
8421
|
+
"&:hover fieldset": { borderColor: "hsl(var(--muted-foreground) / 0.3)" },
|
|
8422
|
+
"&.Mui-focused fieldset": { borderColor: "hsl(var(--primary))" }
|
|
8423
|
+
},
|
|
8424
|
+
"& .MuiInputBase-input": { color: "hsl(var(--foreground))" }
|
|
7296
8425
|
}
|
|
7297
|
-
|
|
7298
|
-
|
|
8426
|
+
}
|
|
8427
|
+
),
|
|
8428
|
+
showStatusChips && STATUS_FILTERS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8429
|
+
import_material14.Chip,
|
|
8430
|
+
{
|
|
8431
|
+
label: f.label,
|
|
8432
|
+
size: "small",
|
|
8433
|
+
variant: statusFilter === f.value ? "filled" : "outlined",
|
|
8434
|
+
onClick: () => setStatusFilter(f.value),
|
|
8435
|
+
sx: {
|
|
8436
|
+
fontSize: "0.75rem",
|
|
8437
|
+
height: 28,
|
|
8438
|
+
borderColor: statusFilter === f.value ? "hsl(var(--primary))" : "hsl(var(--border))",
|
|
8439
|
+
bgcolor: statusFilter === f.value ? "hsla(var(--primary) / 0.15)" : "transparent",
|
|
8440
|
+
color: statusFilter === f.value ? "hsl(var(--primary))" : "hsl(var(--muted-foreground))",
|
|
8441
|
+
"&:hover": { bgcolor: "hsl(var(--muted))" }
|
|
7299
8442
|
}
|
|
7300
|
-
}
|
|
7301
|
-
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
helperText: isMissing ? "Please answer this question" : void 0,
|
|
7317
|
-
onChange: (e) => {
|
|
7318
|
-
const v = e.target.value;
|
|
7319
|
-
setQuestionAnswers((prev) => ({
|
|
7320
|
-
...prev,
|
|
7321
|
-
[q.question]: { index: qi, value: v }
|
|
7322
|
-
}));
|
|
7323
|
-
},
|
|
7324
|
-
onKeyDown: (e) => {
|
|
7325
|
-
if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
|
|
7326
|
-
e.preventDefault();
|
|
7327
|
-
trySimpleSubmit();
|
|
7328
|
-
}
|
|
7329
|
-
},
|
|
7330
|
-
size: "small",
|
|
7331
|
-
sx: { "& .MuiOutlinedInput-root": { bgcolor: "hsl(var(--background))" } }
|
|
7332
|
-
}
|
|
7333
|
-
)
|
|
7334
|
-
] }, qi);
|
|
7335
|
-
}),
|
|
7336
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material12.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
7337
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7338
|
-
import_material12.Button,
|
|
7339
|
-
{
|
|
7340
|
-
variant: "contained",
|
|
7341
|
-
size: "small",
|
|
7342
|
-
disabled: agentRequestLoading,
|
|
7343
|
-
onClick: trySimpleSubmit,
|
|
7344
|
-
children: agentRequestLoading ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.CircularProgress, { size: 16 }) : "Submit"
|
|
7345
|
-
}
|
|
7346
|
-
),
|
|
7347
|
-
pendingAsk.run_details?.id && getFormUrl(pendingAsk.run_details.id) && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Tooltip, { title: "Answer in the Form UI", placement: "right", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7348
|
-
import_material12.IconButton,
|
|
7349
|
-
{
|
|
7350
|
-
size: "small",
|
|
7351
|
-
onClick: () => {
|
|
7352
|
-
const url = getFormUrl(pendingAsk.run_details.id);
|
|
7353
|
-
if (url) window.open(url, "_blank", "noopener,noreferrer");
|
|
7354
|
-
},
|
|
7355
|
-
sx: { color: "hsl(var(--muted-foreground))", "&:hover": { color: "hsl(var(--primary))" } },
|
|
7356
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_OpenInNew2.default, { sx: { fontSize: 18 } })
|
|
7357
|
-
}
|
|
7358
|
-
) })
|
|
7359
|
-
] })
|
|
7360
|
-
] });
|
|
7361
|
-
})() : isRunning ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Typography, { sx: { fontSize: "0.85rem", color: "hsl(var(--muted-foreground))" }, children: "Waiting for the agent to produce the first step." }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Typography, { sx: { fontSize: "0.85rem", color: "hsl(var(--muted-foreground))" }, children: "No final answer was returned. Open Detailed to inspect each step." }),
|
|
7362
|
-
!isRunning && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Box, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7363
|
-
import_material12.Button,
|
|
8443
|
+
},
|
|
8444
|
+
f.value
|
|
8445
|
+
)),
|
|
8446
|
+
isLoading && runs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material14.CircularProgress, { size: 16, sx: { color: "hsl(var(--primary))", ml: 0.5 } })
|
|
8447
|
+
] }),
|
|
8448
|
+
isLoading && runs.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material14.Box, { sx: { display: "flex", justifyContent: "center", py: 8 }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material14.CircularProgress, { size: 28, sx: { color: "hsl(var(--primary))" } }) }) : error ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_material14.Box, { sx: { textAlign: "center", py: 6 }, children: [
|
|
8449
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react4.AlertCircle, { size: 28, style: { color: "hsl(var(--severity-critical, 0 72% 55%))", marginBottom: 8 } }),
|
|
8450
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8451
|
+
import_material14.Typography,
|
|
8452
|
+
{
|
|
8453
|
+
sx: { color: "hsl(var(--severity-critical, 0 72% 55%))", fontSize: "0.9rem", mb: 1 },
|
|
8454
|
+
children: error
|
|
8455
|
+
}
|
|
8456
|
+
),
|
|
8457
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8458
|
+
import_material14.Button,
|
|
7364
8459
|
{
|
|
7365
8460
|
size: "small",
|
|
7366
|
-
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
children: "View detailed timeline \u2192"
|
|
8461
|
+
onClick: () => fetchRuns(false, ""),
|
|
8462
|
+
sx: { color: "hsl(var(--primary))", textTransform: "none" },
|
|
8463
|
+
children: "Try again"
|
|
7370
8464
|
}
|
|
7371
|
-
)
|
|
7372
|
-
] })
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
|
|
7378
|
-
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
|
|
8465
|
+
)
|
|
8466
|
+
] }) : filteredRuns.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_material14.Box, { sx: { display: "flex", flexDirection: "column", alignItems: "center", textAlign: "center", py: 8 }, children: [
|
|
8467
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8468
|
+
import_lucide_react4.Activity,
|
|
8469
|
+
{
|
|
8470
|
+
size: 40,
|
|
8471
|
+
style: { color: "hsl(var(--muted-foreground))", marginBottom: 12 }
|
|
8472
|
+
}
|
|
8473
|
+
),
|
|
8474
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material14.Typography, { sx: { color: "hsl(var(--muted-foreground))", fontSize: "0.9rem" }, children: emptyTitle }),
|
|
8475
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8476
|
+
import_material14.Typography,
|
|
8477
|
+
{
|
|
8478
|
+
sx: { color: "hsl(var(--muted-foreground))", fontSize: "0.8rem", mt: 0.5, opacity: 0.7 },
|
|
8479
|
+
children: emptySubtitle
|
|
8480
|
+
}
|
|
8481
|
+
)
|
|
8482
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_material14.Box, { sx: { display: "flex", flexDirection: "column", gap: 1.5 }, children: [
|
|
8483
|
+
filteredRuns.map((run, idx) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8484
|
+
AgentRunRow,
|
|
7389
8485
|
{
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
onToggle: () => toggleOpen(i),
|
|
7394
|
-
appsById,
|
|
7395
|
-
totalDuration,
|
|
7396
|
-
originalStartTime,
|
|
7397
|
-
maxWidth: 260,
|
|
7398
|
-
questionAnswers,
|
|
7399
|
-
setQuestionAnswers,
|
|
7400
|
-
onSubmitQuestions: submitQuestions,
|
|
7401
|
-
onRerunAgent: rerunAgent,
|
|
7402
|
-
onRerunDecision: rerunDecision,
|
|
7403
|
-
agentRequestLoading,
|
|
7404
|
-
getFormUrl,
|
|
7405
|
-
runFinished: detailedRunFinished
|
|
8486
|
+
run,
|
|
8487
|
+
onClick: () => onRunClick?.(run),
|
|
8488
|
+
sx: rowSx
|
|
7406
8489
|
},
|
|
7407
|
-
|
|
8490
|
+
run.execution_id || idx
|
|
7408
8491
|
)),
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
8492
|
+
hasMore && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material14.Box, { sx: { display: "flex", justifyContent: "center", mt: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
8493
|
+
import_material14.Button,
|
|
8494
|
+
{
|
|
8495
|
+
size: "small",
|
|
8496
|
+
onClick: loadMore,
|
|
8497
|
+
disabled: isLoading,
|
|
8498
|
+
sx: { color: "hsl(var(--primary))", textTransform: "none", fontSize: "0.8rem" },
|
|
8499
|
+
children: [
|
|
8500
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material14.CircularProgress, { size: 14, sx: { mr: 1 } }) : null,
|
|
8501
|
+
"Load more"
|
|
8502
|
+
]
|
|
8503
|
+
}
|
|
8504
|
+
) })
|
|
8505
|
+
] })
|
|
8506
|
+
]
|
|
8507
|
+
}
|
|
8508
|
+
);
|
|
8509
|
+
};
|
|
8510
|
+
var AgentActivityList_default = AgentActivityList;
|
|
8511
|
+
|
|
8512
|
+
// AgentExecutionDrawer.tsx
|
|
8513
|
+
var import_material15 = require("@mui/material");
|
|
8514
|
+
var import_Close6 = __toESM(require("@mui/icons-material/Close"), 1);
|
|
8515
|
+
var import_OpenInNew3 = __toESM(require("@mui/icons-material/OpenInNew"), 1);
|
|
8516
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
8517
|
+
var AgentExecutionDrawer = ({
|
|
8518
|
+
open,
|
|
8519
|
+
onClose,
|
|
8520
|
+
run,
|
|
8521
|
+
width = 720,
|
|
8522
|
+
apiKey,
|
|
8523
|
+
apiBaseUrl,
|
|
8524
|
+
orgId,
|
|
8525
|
+
className,
|
|
8526
|
+
paperSx,
|
|
8527
|
+
headerSx,
|
|
8528
|
+
bodySx
|
|
8529
|
+
}) => {
|
|
8530
|
+
const statusKey = (run?.status || "").toUpperCase();
|
|
8531
|
+
const cfg = STATUS_CONFIG[statusKey] || STATUS_CONFIG.WAITING;
|
|
8532
|
+
const duration = run ? formatDuration(run) : "";
|
|
8533
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
8534
|
+
import_material15.Drawer,
|
|
8535
|
+
{
|
|
8536
|
+
anchor: "right",
|
|
8537
|
+
open,
|
|
8538
|
+
onClose,
|
|
8539
|
+
slotProps: {
|
|
8540
|
+
paper: {
|
|
8541
|
+
className,
|
|
8542
|
+
sx: [
|
|
8543
|
+
{
|
|
8544
|
+
width: { xs: "100%", sm: width },
|
|
8545
|
+
maxWidth: "100vw",
|
|
7425
8546
|
bgcolor: "hsl(var(--background))",
|
|
7426
|
-
fontSize: "0.9rem",
|
|
7427
8547
|
color: "hsl(var(--foreground))",
|
|
7428
|
-
|
|
7429
|
-
"
|
|
7430
|
-
"& p": { my: 1, lineHeight: 1.55 },
|
|
7431
|
-
"& a": { color: "hsl(var(--primary))", textDecoration: "underline" },
|
|
7432
|
-
"& code": {
|
|
7433
|
-
px: 0.5,
|
|
7434
|
-
py: 0.125,
|
|
7435
|
-
borderRadius: 0.5,
|
|
7436
|
-
bgcolor: "hsl(var(--muted))",
|
|
7437
|
-
fontFamily: '"JetBrains Mono", ui-monospace, monospace',
|
|
7438
|
-
fontSize: "0.82em"
|
|
7439
|
-
},
|
|
7440
|
-
"& pre": {
|
|
7441
|
-
p: 1.5,
|
|
7442
|
-
my: 1,
|
|
7443
|
-
borderRadius: 1,
|
|
7444
|
-
bgcolor: "hsl(var(--muted))",
|
|
7445
|
-
overflowX: "auto",
|
|
7446
|
-
fontSize: "0.82rem"
|
|
7447
|
-
},
|
|
7448
|
-
"& pre code": { p: 0, bgcolor: "transparent" }
|
|
7449
|
-
}, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_markdown4.default, { remarkPlugins: [import_remark_gfm4.default, import_remark_breaks.default], children: normalizeMarkdown(finishAnswer) }) })
|
|
7450
|
-
] })
|
|
7451
|
-
] }) });
|
|
7452
|
-
})(),
|
|
7453
|
-
finishDecisionId && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Box, { sx: { mt: 3, display: "flex", justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material12.Box, { sx: { width: "100%", maxWidth: 640 }, children: [
|
|
7454
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Typography, { sx: { fontSize: "0.75rem", color: "hsl(var(--muted-foreground))", mb: 0.75, textAlign: "center" }, children: "Continue this agent run with more details" }),
|
|
7455
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
7456
|
-
import_material12.Box,
|
|
7457
|
-
{
|
|
7458
|
-
component: "form",
|
|
7459
|
-
onSubmit: (e) => {
|
|
7460
|
-
e.preventDefault();
|
|
7461
|
-
if (continuationText.trim()) {
|
|
7462
|
-
submitQuestions(finishDecisionId, { continue: continuationText }, true);
|
|
7463
|
-
}
|
|
7464
|
-
},
|
|
7465
|
-
sx: {
|
|
7466
|
-
display: "flex",
|
|
7467
|
-
alignItems: "flex-end",
|
|
7468
|
-
gap: 1,
|
|
7469
|
-
p: 1.25,
|
|
7470
|
-
borderRadius: 999,
|
|
7471
|
-
border: "1.5px solid hsl(var(--border))",
|
|
7472
|
-
bgcolor: "hsl(var(--card))",
|
|
7473
|
-
"&:focus-within": {
|
|
7474
|
-
borderColor: "hsl(var(--primary))",
|
|
7475
|
-
boxShadow: "0 0 0 3px hsla(var(--primary) / 0.12)"
|
|
7476
|
-
}
|
|
8548
|
+
backgroundImage: "none",
|
|
8549
|
+
borderLeft: "1px solid hsl(var(--border))"
|
|
7477
8550
|
},
|
|
8551
|
+
...Array.isArray(paperSx) ? paperSx : paperSx ? [paperSx] : []
|
|
8552
|
+
]
|
|
8553
|
+
}
|
|
8554
|
+
},
|
|
8555
|
+
children: [
|
|
8556
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
8557
|
+
import_material15.Box,
|
|
8558
|
+
{
|
|
8559
|
+
sx: [
|
|
8560
|
+
{
|
|
8561
|
+
display: "flex",
|
|
8562
|
+
alignItems: "center",
|
|
8563
|
+
gap: 1.5,
|
|
8564
|
+
px: 2.5,
|
|
8565
|
+
py: 1.75,
|
|
8566
|
+
borderBottom: "1px solid hsl(var(--border))",
|
|
8567
|
+
position: "sticky",
|
|
8568
|
+
top: 0,
|
|
8569
|
+
zIndex: 2,
|
|
8570
|
+
bgcolor: "hsl(var(--background))"
|
|
8571
|
+
},
|
|
8572
|
+
...Array.isArray(headerSx) ? headerSx : headerSx ? [headerSx] : []
|
|
8573
|
+
],
|
|
7478
8574
|
children: [
|
|
7479
|
-
/* @__PURE__ */ (0,
|
|
7480
|
-
|
|
8575
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
8576
|
+
import_material15.Box,
|
|
7481
8577
|
{
|
|
7482
|
-
|
|
7483
|
-
|
|
7484
|
-
|
|
7485
|
-
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
if (continuationText.trim() && !agentRequestLoading) {
|
|
7493
|
-
submitQuestions(finishDecisionId, { continue: continuationText }, true);
|
|
7494
|
-
}
|
|
7495
|
-
}
|
|
8578
|
+
sx: {
|
|
8579
|
+
width: 36,
|
|
8580
|
+
height: 36,
|
|
8581
|
+
borderRadius: "50%",
|
|
8582
|
+
display: "flex",
|
|
8583
|
+
alignItems: "center",
|
|
8584
|
+
justifyContent: "center",
|
|
8585
|
+
background: "hsla(var(--primary) / 0.12)",
|
|
8586
|
+
color: "hsl(var(--primary))",
|
|
8587
|
+
flexShrink: 0
|
|
7496
8588
|
},
|
|
7497
|
-
|
|
7498
|
-
sx: { fontSize: "0.9rem", color: "hsl(var(--foreground))", px: 2 }
|
|
8589
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AgentIcon_default, { size: 20 })
|
|
7499
8590
|
}
|
|
7500
8591
|
),
|
|
7501
|
-
/* @__PURE__ */ (0,
|
|
7502
|
-
|
|
8592
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_material15.Box, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
8593
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_material15.Box, { sx: { display: "flex", alignItems: "center", gap: 1, minWidth: 0 }, children: [
|
|
8594
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
8595
|
+
import_material15.Typography,
|
|
8596
|
+
{
|
|
8597
|
+
sx: {
|
|
8598
|
+
fontSize: "0.95rem",
|
|
8599
|
+
fontWeight: 600,
|
|
8600
|
+
color: "hsl(var(--foreground))",
|
|
8601
|
+
overflow: "hidden",
|
|
8602
|
+
textOverflow: "ellipsis",
|
|
8603
|
+
whiteSpace: "nowrap"
|
|
8604
|
+
},
|
|
8605
|
+
children: run ? getRunTitle(run) : "Agent execution"
|
|
8606
|
+
}
|
|
8607
|
+
),
|
|
8608
|
+
run && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material15.Box, { sx: { display: "flex", alignItems: "center", color: cfg.color, flexShrink: 0 }, children: cfg.icon })
|
|
8609
|
+
] }),
|
|
8610
|
+
run && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_material15.Box, { sx: { display: "flex", alignItems: "center", gap: 1, mt: 0.25 }, children: [
|
|
8611
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material15.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))" }, children: cfg.label }),
|
|
8612
|
+
run.started_at && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
8613
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material15.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.4 }, children: "\xB7" }),
|
|
8614
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material15.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))" }, children: getTimeAgo(run.started_at) })
|
|
8615
|
+
] }),
|
|
8616
|
+
duration && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
8617
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material15.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.4 }, children: "\xB7" }),
|
|
8618
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material15.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))" }, children: duration })
|
|
8619
|
+
] })
|
|
8620
|
+
] })
|
|
8621
|
+
] }),
|
|
8622
|
+
run?.execution_id && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material15.Tooltip, { title: "Open in new tab", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
8623
|
+
import_material15.IconButton,
|
|
7503
8624
|
{
|
|
7504
|
-
|
|
7505
|
-
|
|
8625
|
+
component: "a",
|
|
8626
|
+
href: `/agents?execution_id=${encodeURIComponent(run.execution_id)}${run.authorization ? `&authorization=${encodeURIComponent(run.authorization)}` : ""}`,
|
|
8627
|
+
target: "_blank",
|
|
8628
|
+
rel: "noopener noreferrer",
|
|
8629
|
+
size: "small",
|
|
7506
8630
|
sx: {
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
bgcolor: continuationText.trim() && !agentRequestLoading ? "hsl(var(--primary))" : "hsl(var(--muted))",
|
|
7510
|
-
color: continuationText.trim() && !agentRequestLoading ? "hsl(var(--primary-foreground))" : "hsl(var(--muted-foreground))",
|
|
7511
|
-
"&:hover": continuationText.trim() && !agentRequestLoading ? { filter: "brightness(1.1)", bgcolor: "hsl(var(--primary))" } : {}
|
|
8631
|
+
color: "hsl(var(--muted-foreground))",
|
|
8632
|
+
"&:hover": { color: "hsl(var(--foreground))", bgcolor: "hsl(var(--muted))" }
|
|
7512
8633
|
},
|
|
7513
|
-
children:
|
|
8634
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_OpenInNew3.default, { fontSize: "small" })
|
|
7514
8635
|
}
|
|
7515
|
-
)
|
|
8636
|
+
) }),
|
|
8637
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material15.Tooltip, { title: "Close", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
8638
|
+
import_material15.IconButton,
|
|
8639
|
+
{
|
|
8640
|
+
onClick: onClose,
|
|
8641
|
+
size: "small",
|
|
8642
|
+
sx: {
|
|
8643
|
+
color: "hsl(var(--muted-foreground))",
|
|
8644
|
+
"&:hover": { color: "hsl(var(--foreground))", bgcolor: "hsl(var(--muted))" }
|
|
8645
|
+
},
|
|
8646
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_Close6.default, { fontSize: "small" })
|
|
8647
|
+
}
|
|
8648
|
+
) })
|
|
7516
8649
|
]
|
|
7517
8650
|
}
|
|
7518
|
-
)
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
|
|
7529
|
-
|
|
7530
|
-
|
|
7531
|
-
|
|
7532
|
-
|
|
7533
|
-
|
|
7534
|
-
|
|
7535
|
-
|
|
7536
|
-
|
|
8651
|
+
),
|
|
8652
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material15.Box, { sx: [{ flex: 1, overflowY: "auto", pt: 3 }, ...Array.isArray(bodySx) ? bodySx : bodySx ? [bodySx] : []], children: run ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
8653
|
+
AgentUI_default,
|
|
8654
|
+
{
|
|
8655
|
+
initialExecution: {
|
|
8656
|
+
execution_id: run.execution_id,
|
|
8657
|
+
status: run.status,
|
|
8658
|
+
started_at: run.started_at ? Number(run.started_at) : void 0,
|
|
8659
|
+
completed_at: run.completed_at ? Number(run.completed_at) : void 0,
|
|
8660
|
+
results: run.results,
|
|
8661
|
+
workflow: run.workflow,
|
|
8662
|
+
authorization: run.authorization
|
|
8663
|
+
},
|
|
8664
|
+
readUrlParams: false,
|
|
8665
|
+
autoLoadApps: false,
|
|
8666
|
+
hideHeroIcon: true,
|
|
8667
|
+
hideAppPicker: true,
|
|
8668
|
+
hideAttach: true,
|
|
8669
|
+
disableStartTab: true,
|
|
8670
|
+
compact: true,
|
|
8671
|
+
maxWidth: width - 32,
|
|
8672
|
+
apiKey,
|
|
8673
|
+
apiBaseUrl,
|
|
8674
|
+
orgId
|
|
8675
|
+
},
|
|
8676
|
+
run.execution_id
|
|
8677
|
+
) : null })
|
|
8678
|
+
]
|
|
8679
|
+
}
|
|
8680
|
+
);
|
|
7537
8681
|
};
|
|
7538
|
-
var
|
|
8682
|
+
var AgentExecutionDrawer_default = AgentExecutionDrawer;
|
|
7539
8683
|
|
|
7540
8684
|
// useAppLookup.ts
|
|
7541
|
-
var
|
|
8685
|
+
var import_react14 = require("react");
|
|
7542
8686
|
var norm = (s) => s.toLowerCase().replace(/[\s_\-]+/g, "_");
|
|
7543
8687
|
function useAppLookup(appName) {
|
|
7544
|
-
const [loading, setLoading] = (0,
|
|
7545
|
-
const [info, setInfo] = (0,
|
|
7546
|
-
const [algoliaId, setAlgoliaId] = (0,
|
|
8688
|
+
const [loading, setLoading] = (0, import_react14.useState)(false);
|
|
8689
|
+
const [info, setInfo] = (0, import_react14.useState)(null);
|
|
8690
|
+
const [algoliaId, setAlgoliaId] = (0, import_react14.useState)(null);
|
|
7547
8691
|
const {
|
|
7548
8692
|
authStates,
|
|
7549
8693
|
authenticatedApps,
|
|
@@ -7552,7 +8696,7 @@ function useAppLookup(appName) {
|
|
|
7552
8696
|
handleSaveAuth,
|
|
7553
8697
|
refreshAuth
|
|
7554
8698
|
} = useAppAuth();
|
|
7555
|
-
(0,
|
|
8699
|
+
(0, import_react14.useEffect)(() => {
|
|
7556
8700
|
if (!appName) {
|
|
7557
8701
|
setInfo(null);
|
|
7558
8702
|
setAlgoliaId(null);
|
|
@@ -7589,14 +8733,8 @@ function useAppLookup(appName) {
|
|
|
7589
8733
|
let appsList = null;
|
|
7590
8734
|
if (API_CONFIG.apiKey) {
|
|
7591
8735
|
try {
|
|
7592
|
-
const
|
|
7593
|
-
|
|
7594
|
-
headers: { ...getAuthHeader() }
|
|
7595
|
-
});
|
|
7596
|
-
if (res.ok) {
|
|
7597
|
-
const apps = await res.json();
|
|
7598
|
-
if (Array.isArray(apps)) appsList = apps;
|
|
7599
|
-
}
|
|
8736
|
+
const apps = await fetchAppsViaApiConfig();
|
|
8737
|
+
if (Array.isArray(apps)) appsList = apps;
|
|
7600
8738
|
} catch {
|
|
7601
8739
|
}
|
|
7602
8740
|
}
|
|
@@ -7637,13 +8775,13 @@ function useAppLookup(appName) {
|
|
|
7637
8775
|
setLoading(false);
|
|
7638
8776
|
})();
|
|
7639
8777
|
}, [appName]);
|
|
7640
|
-
const matchingEntries = (0,
|
|
8778
|
+
const matchingEntries = (0, import_react14.useMemo)(() => {
|
|
7641
8779
|
if (!appName) return [];
|
|
7642
8780
|
return authenticatedApps.filter(
|
|
7643
8781
|
(auth) => auth.app?.name && norm(auth.app.name) === norm(appName)
|
|
7644
8782
|
);
|
|
7645
8783
|
}, [appName, authenticatedApps]);
|
|
7646
|
-
const image = (0,
|
|
8784
|
+
const image = (0, import_react14.useMemo)(() => {
|
|
7647
8785
|
if (info?.image) return info.image;
|
|
7648
8786
|
for (const entry of matchingEntries) {
|
|
7649
8787
|
const img = entry.app?.large_image || entry.large_image;
|
|
@@ -7651,7 +8789,7 @@ function useAppLookup(appName) {
|
|
|
7651
8789
|
}
|
|
7652
8790
|
return "";
|
|
7653
8791
|
}, [info, matchingEntries]);
|
|
7654
|
-
const algoliaApp = (0,
|
|
8792
|
+
const algoliaApp = (0, import_react14.useMemo)(() => {
|
|
7655
8793
|
if (!appName) return null;
|
|
7656
8794
|
return {
|
|
7657
8795
|
objectID: algoliaId || appName,
|
|
@@ -7684,6 +8822,9 @@ function useAppLookup(appName) {
|
|
|
7684
8822
|
// Annotate the CommonJS export names for ESM import in node:
|
|
7685
8823
|
0 && (module.exports = {
|
|
7686
8824
|
API_CONFIG,
|
|
8825
|
+
AgentActivityList,
|
|
8826
|
+
AgentExecutionDrawer,
|
|
8827
|
+
AgentRunDrawer,
|
|
7687
8828
|
AgentUI,
|
|
7688
8829
|
AppAuthSection,
|
|
7689
8830
|
AppDetailDrawer,
|
|
@@ -7698,6 +8839,7 @@ function useAppLookup(appName) {
|
|
|
7698
8839
|
getApiUrl,
|
|
7699
8840
|
getAuthHeader,
|
|
7700
8841
|
refreshAllIntegrationStatus,
|
|
8842
|
+
searchAgentActivity,
|
|
7701
8843
|
setToastImpl,
|
|
7702
8844
|
toast,
|
|
7703
8845
|
useAppAuth,
|