@shuffleio/shuffle-mcps 0.0.22 → 0.0.24
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/dist/index.d.mts +69 -8
- package/dist/index.d.ts +69 -8
- package/dist/index.js +938 -356
- package/dist/index.mjs +935 -343
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3815,7 +3815,14 @@ function AppAuthSection({
|
|
|
3815
3815
|
onAuthChange,
|
|
3816
3816
|
onTestConnection,
|
|
3817
3817
|
onSaveAuth,
|
|
3818
|
-
onRefreshAuth
|
|
3818
|
+
onRefreshAuth,
|
|
3819
|
+
globalUrl,
|
|
3820
|
+
userdata,
|
|
3821
|
+
isLoaded,
|
|
3822
|
+
isLoggedIn,
|
|
3823
|
+
serverside,
|
|
3824
|
+
theme,
|
|
3825
|
+
colorMode
|
|
3819
3826
|
}) {
|
|
3820
3827
|
return /* @__PURE__ */ jsx7(motion3.div, { initial: { opacity: 0, y: 12 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.3, delay: 0.1 }, children: /* @__PURE__ */ jsxs5(Box4, { sx: { mb: 3 }, children: [
|
|
3821
3828
|
/* @__PURE__ */ jsx7(Typography4, { sx: { color: "hsl(var(--foreground))", fontWeight: 600, fontSize: "0.95rem", mb: 0.5 }, children: "Authentication" }),
|
|
@@ -3831,7 +3838,14 @@ function AppAuthSection({
|
|
|
3831
3838
|
onTestConnection,
|
|
3832
3839
|
onSaveAuth,
|
|
3833
3840
|
apiAuthEntries: matchingEntries,
|
|
3834
|
-
onRefreshAuth
|
|
3841
|
+
onRefreshAuth,
|
|
3842
|
+
globalUrl,
|
|
3843
|
+
userdata,
|
|
3844
|
+
isLoaded,
|
|
3845
|
+
isLoggedIn,
|
|
3846
|
+
serverside,
|
|
3847
|
+
theme,
|
|
3848
|
+
colorMode
|
|
3835
3849
|
}
|
|
3836
3850
|
)
|
|
3837
3851
|
] }) });
|
|
@@ -4008,7 +4022,8 @@ function getPrimaryCategory(appName, categories) {
|
|
|
4008
4022
|
if (COMMUNICATION_PATTERNS_NAMES.some((p) => name.includes(p))) return "Communication";
|
|
4009
4023
|
return null;
|
|
4010
4024
|
}
|
|
4011
|
-
var AppMcpChat = ({ appName, appIcon, appId, categories }) => {
|
|
4025
|
+
var AppMcpChat = ({ appName, appIcon, appId, categories, globalUrl }) => {
|
|
4026
|
+
useSyncHostBaseUrl(globalUrl);
|
|
4012
4027
|
const [input, setInput] = useState6("");
|
|
4013
4028
|
const [runState, setRunState] = useState6("idle");
|
|
4014
4029
|
const [query, setQuery] = useState6("");
|
|
@@ -4452,7 +4467,7 @@ var AppMcpChat_default = AppMcpChat;
|
|
|
4452
4467
|
|
|
4453
4468
|
// views/TryMcpSection.tsx
|
|
4454
4469
|
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
4455
|
-
function TryMcpSection({ appName, appIcon, appId, categories }) {
|
|
4470
|
+
function TryMcpSection({ appName, appIcon, appId, categories, globalUrl, userdata, isLoaded, isLoggedIn, serverside, theme, colorMode }) {
|
|
4456
4471
|
return /* @__PURE__ */ jsx10(motion5.div, { initial: { opacity: 0, y: 12 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.3, delay: 0.15 }, children: /* @__PURE__ */ jsxs7(Box6, { sx: { mt: 5, mb: 3 }, children: [
|
|
4457
4472
|
/* @__PURE__ */ jsx10(Typography6, { sx: { color: "hsl(var(--foreground))", fontWeight: 600, fontSize: "0.95rem", mb: 1.5 }, children: "Try MCP" }),
|
|
4458
4473
|
/* @__PURE__ */ jsx10(
|
|
@@ -4461,7 +4476,14 @@ function TryMcpSection({ appName, appIcon, appId, categories }) {
|
|
|
4461
4476
|
appName,
|
|
4462
4477
|
appIcon,
|
|
4463
4478
|
appId,
|
|
4464
|
-
categories
|
|
4479
|
+
categories,
|
|
4480
|
+
globalUrl,
|
|
4481
|
+
userdata,
|
|
4482
|
+
isLoaded,
|
|
4483
|
+
isLoggedIn,
|
|
4484
|
+
serverside,
|
|
4485
|
+
theme,
|
|
4486
|
+
colorMode
|
|
4465
4487
|
}
|
|
4466
4488
|
)
|
|
4467
4489
|
] }) });
|
|
@@ -5295,8 +5317,17 @@ function AppDetailDrawer({
|
|
|
5295
5317
|
onRefresh,
|
|
5296
5318
|
onAddToCanvas,
|
|
5297
5319
|
isAuthenticated = true,
|
|
5298
|
-
activeOrgId
|
|
5320
|
+
activeOrgId,
|
|
5321
|
+
globalUrl,
|
|
5322
|
+
userdata,
|
|
5323
|
+
isLoaded,
|
|
5324
|
+
isLoggedIn,
|
|
5325
|
+
serverside,
|
|
5326
|
+
theme,
|
|
5327
|
+
colorMode
|
|
5299
5328
|
}) {
|
|
5329
|
+
const themeScope = useShuffleMcpTheme();
|
|
5330
|
+
const scopeClassName = themeScope?.scopeClassName ?? (theme === "dark" ? "shuffle-mcp-scope dark" : theme === "light" ? "shuffle-mcp-scope" : void 0);
|
|
5300
5331
|
const [appInfo, setAppInfo] = useState8(null);
|
|
5301
5332
|
const [appLoading, setAppLoading] = useState8(true);
|
|
5302
5333
|
const [isActivated, setIsActivated] = useState8(null);
|
|
@@ -5528,15 +5559,23 @@ function AppDetailDrawer({
|
|
|
5528
5559
|
anchor,
|
|
5529
5560
|
open,
|
|
5530
5561
|
onClose: handleClose,
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5562
|
+
slotProps: {
|
|
5563
|
+
paper: {
|
|
5564
|
+
className: scopeClassName,
|
|
5565
|
+
sx: {
|
|
5566
|
+
width: { xs: "100%", sm: width },
|
|
5567
|
+
maxWidth: "100vw",
|
|
5568
|
+
display: "flex",
|
|
5569
|
+
flexDirection: "column",
|
|
5570
|
+
background: "linear-gradient(180deg, hsl(var(--card)) 0%, hsl(var(--background)) 100%)",
|
|
5571
|
+
borderLeft: anchor === "right" ? "1px solid hsl(var(--border))" : "none",
|
|
5572
|
+
borderRight: anchor === "left" ? "1px solid hsl(var(--border))" : "none"
|
|
5573
|
+
}
|
|
5538
5574
|
}
|
|
5539
5575
|
},
|
|
5576
|
+
sx: {
|
|
5577
|
+
"& .MuiDrawer-paper": { boxSizing: "border-box" }
|
|
5578
|
+
},
|
|
5540
5579
|
children: [
|
|
5541
5580
|
/* @__PURE__ */ jsxs9(
|
|
5542
5581
|
Box8,
|
|
@@ -5592,7 +5631,14 @@ function AppDetailDrawer({
|
|
|
5592
5631
|
onAdd: onAddToCanvas && appName ? () => {
|
|
5593
5632
|
onAddToCanvas({ name: appName, icon: resolvedImage || "", algoliaId: resolvedAlgoliaId });
|
|
5594
5633
|
onClose();
|
|
5595
|
-
} : void 0
|
|
5634
|
+
} : void 0,
|
|
5635
|
+
globalUrl,
|
|
5636
|
+
userdata,
|
|
5637
|
+
isLoaded,
|
|
5638
|
+
isLoggedIn,
|
|
5639
|
+
serverside,
|
|
5640
|
+
theme,
|
|
5641
|
+
colorMode
|
|
5596
5642
|
}
|
|
5597
5643
|
),
|
|
5598
5644
|
isAuthenticated && incidentStats && incidentStats.ingested > 0 && /* @__PURE__ */ jsx12(motion6.div, { initial: { opacity: 0, y: 12 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.3, delay: 0.08 }, children: /* @__PURE__ */ jsxs9(Box8, { sx: {
|
|
@@ -5634,7 +5680,14 @@ function AppDetailDrawer({
|
|
|
5634
5680
|
onAuthChange: handleAuthChange,
|
|
5635
5681
|
onTestConnection: (appId2, authId) => handleTestConnection(appName || appId2, authId),
|
|
5636
5682
|
onSaveAuth: (appId2, creds) => handleSaveAuth(appId2, creds, appName || void 0),
|
|
5637
|
-
onRefreshAuth: refreshAuth
|
|
5683
|
+
onRefreshAuth: refreshAuth,
|
|
5684
|
+
globalUrl,
|
|
5685
|
+
userdata,
|
|
5686
|
+
isLoaded,
|
|
5687
|
+
isLoggedIn,
|
|
5688
|
+
serverside,
|
|
5689
|
+
theme,
|
|
5690
|
+
colorMode
|
|
5638
5691
|
}
|
|
5639
5692
|
) }),
|
|
5640
5693
|
isAuthenticated && /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
@@ -5644,10 +5697,32 @@ function AppDetailDrawer({
|
|
|
5644
5697
|
appName: appName || "",
|
|
5645
5698
|
appIcon: resolvedImage,
|
|
5646
5699
|
appId: matchingEntries[0]?.app?.id || matchingEntries[0]?.id || appName || "",
|
|
5647
|
-
categories: appInfo?.categories
|
|
5700
|
+
categories: appInfo?.categories,
|
|
5701
|
+
globalUrl,
|
|
5702
|
+
userdata,
|
|
5703
|
+
isLoaded,
|
|
5704
|
+
isLoggedIn,
|
|
5705
|
+
serverside,
|
|
5706
|
+
theme,
|
|
5707
|
+
colorMode
|
|
5648
5708
|
}
|
|
5649
5709
|
),
|
|
5650
|
-
/* @__PURE__ */ jsx12(
|
|
5710
|
+
/* @__PURE__ */ jsx12(
|
|
5711
|
+
SingulActionsPreview_default,
|
|
5712
|
+
{
|
|
5713
|
+
appName: appName || "",
|
|
5714
|
+
appIcon: resolvedImage,
|
|
5715
|
+
categories: appInfo?.categories,
|
|
5716
|
+
activeOrgId,
|
|
5717
|
+
globalUrl,
|
|
5718
|
+
userdata,
|
|
5719
|
+
isLoaded,
|
|
5720
|
+
isLoggedIn,
|
|
5721
|
+
serverside,
|
|
5722
|
+
theme,
|
|
5723
|
+
colorMode
|
|
5724
|
+
}
|
|
5725
|
+
)
|
|
5651
5726
|
] })
|
|
5652
5727
|
] }) })
|
|
5653
5728
|
]
|
|
@@ -5872,6 +5947,7 @@ var ShuffleMCP = React3.forwardRef(({
|
|
|
5872
5947
|
showCheckbox = false,
|
|
5873
5948
|
multiSelect = false,
|
|
5874
5949
|
selectedApps = EMPTY_SELECTED_APPS,
|
|
5950
|
+
disableAutoSelectValidatedApps = false,
|
|
5875
5951
|
preventDefault = false,
|
|
5876
5952
|
inline = false,
|
|
5877
5953
|
initialQuery = "",
|
|
@@ -5982,6 +6058,7 @@ var ShuffleMCP = React3.forwardRef(({
|
|
|
5982
6058
|
fetchPrivateApps();
|
|
5983
6059
|
}, [apiKey, apiBaseUrl, privateAppsPath, disablePrivateApps, orgId]);
|
|
5984
6060
|
useEffect8(() => {
|
|
6061
|
+
if (disableAutoSelectValidatedApps) return;
|
|
5985
6062
|
if (authenticatedApps.length > 0 && results.length > 0) {
|
|
5986
6063
|
const validatedApps = authenticatedApps.filter((auth) => auth.validation?.valid);
|
|
5987
6064
|
const appsToAutoSelect = results.filter(
|
|
@@ -6000,7 +6077,7 @@ var ShuffleMCP = React3.forwardRef(({
|
|
|
6000
6077
|
}
|
|
6001
6078
|
}
|
|
6002
6079
|
}
|
|
6003
|
-
}, [authenticatedApps, results]);
|
|
6080
|
+
}, [authenticatedApps, results, disableAutoSelectValidatedApps]);
|
|
6004
6081
|
useEffect8(() => {
|
|
6005
6082
|
if (externalAuthenticatedApps) {
|
|
6006
6083
|
setAuthenticatedApps(externalAuthenticatedApps);
|
|
@@ -6499,8 +6576,13 @@ function AppSearchDrawer({
|
|
|
6499
6576
|
highlightDelayMs = 5e3,
|
|
6500
6577
|
multiSelect = false,
|
|
6501
6578
|
selectedApps,
|
|
6502
|
-
onSelectionChange
|
|
6579
|
+
onSelectionChange,
|
|
6580
|
+
globalUrl,
|
|
6581
|
+
theme,
|
|
6582
|
+
colorMode
|
|
6503
6583
|
}) {
|
|
6584
|
+
const themeScope = useShuffleMcpTheme();
|
|
6585
|
+
const scopeClassName = themeScope?.scopeClassName ?? (theme === "dark" ? "shuffle-mcp-scope dark" : theme === "light" ? "shuffle-mcp-scope" : void 0);
|
|
6504
6586
|
const [detailAppName, setDetailAppName] = useState10(null);
|
|
6505
6587
|
const [detailAppId, setDetailAppId] = useState10(null);
|
|
6506
6588
|
const [highlightActive, setHighlightActive] = useState10(false);
|
|
@@ -6586,19 +6668,25 @@ function AppSearchDrawer({
|
|
|
6586
6668
|
anchor,
|
|
6587
6669
|
open: open && detailAppName === null,
|
|
6588
6670
|
onClose: handleClose,
|
|
6671
|
+
slotProps: {
|
|
6672
|
+
paper: {
|
|
6673
|
+
className: scopeClassName,
|
|
6674
|
+
sx: {
|
|
6675
|
+
width: { xs: "100%", sm: width },
|
|
6676
|
+
maxWidth: "100vw",
|
|
6677
|
+
height: "100vh",
|
|
6678
|
+
display: "flex",
|
|
6679
|
+
flexDirection: "column",
|
|
6680
|
+
overflow: "hidden",
|
|
6681
|
+
background: "linear-gradient(180deg, hsl(var(--card)) 0%, hsl(var(--background)) 100%)",
|
|
6682
|
+
borderLeft: anchor === "right" ? "1px solid hsl(var(--border))" : "none",
|
|
6683
|
+
borderRight: anchor === "left" ? "1px solid hsl(var(--border))" : "none"
|
|
6684
|
+
}
|
|
6685
|
+
}
|
|
6686
|
+
},
|
|
6589
6687
|
sx: {
|
|
6590
6688
|
zIndex: 9999,
|
|
6591
|
-
"& .MuiDrawer-paper": {
|
|
6592
|
-
width,
|
|
6593
|
-
maxWidth: "100vw",
|
|
6594
|
-
height: "100vh",
|
|
6595
|
-
display: "flex",
|
|
6596
|
-
flexDirection: "column",
|
|
6597
|
-
overflow: "hidden",
|
|
6598
|
-
background: "linear-gradient(180deg, hsl(var(--card)) 0%, hsl(var(--background)) 100%)",
|
|
6599
|
-
borderLeft: anchor === "right" ? "1px solid hsl(var(--border))" : "none",
|
|
6600
|
-
borderRight: anchor === "left" ? "1px solid hsl(var(--border))" : "none"
|
|
6601
|
-
}
|
|
6689
|
+
"& .MuiDrawer-paper": { boxSizing: "border-box" }
|
|
6602
6690
|
},
|
|
6603
6691
|
children: [
|
|
6604
6692
|
/* @__PURE__ */ jsxs12(
|
|
@@ -6694,14 +6782,16 @@ function AppSearchDrawer({
|
|
|
6694
6782
|
overflowY: "auto"
|
|
6695
6783
|
},
|
|
6696
6784
|
"& .singul-results-grid": {
|
|
6697
|
-
|
|
6785
|
+
gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
|
|
6786
|
+
gridAutoRows: "88px",
|
|
6698
6787
|
gap: "12px"
|
|
6699
6788
|
},
|
|
6700
6789
|
"& .singul-results-grid .singul-dropdown-item": {
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6704
|
-
|
|
6790
|
+
minWidth: 0,
|
|
6791
|
+
minHeight: 88,
|
|
6792
|
+
maxHeight: 88,
|
|
6793
|
+
height: 88,
|
|
6794
|
+
padding: "12px 14px",
|
|
6705
6795
|
alignItems: "center",
|
|
6706
6796
|
overflow: "hidden"
|
|
6707
6797
|
},
|
|
@@ -6710,11 +6800,14 @@ function AppSearchDrawer({
|
|
|
6710
6800
|
gap: "12px"
|
|
6711
6801
|
},
|
|
6712
6802
|
"& .singul-results-grid .singul-app-icon": {
|
|
6713
|
-
width:
|
|
6714
|
-
height:
|
|
6803
|
+
width: 36,
|
|
6804
|
+
height: 36,
|
|
6715
6805
|
borderRadius: 8,
|
|
6716
6806
|
padding: 4
|
|
6717
6807
|
},
|
|
6808
|
+
"& .singul-results-grid .singul-app-details": { minWidth: 0 },
|
|
6809
|
+
"& .singul-results-grid .singul-app-name": { maxWidth: "100%" },
|
|
6810
|
+
"& .singul-results-grid .singul-checkbox": { marginLeft: "auto" },
|
|
6718
6811
|
...highlightActive && highlightAppName ? {
|
|
6719
6812
|
[`& .singul-dropdown-item[data-app-name="${highlightAppName}"]`]: {
|
|
6720
6813
|
borderColor: "hsl(var(--primary)) !important",
|
|
@@ -6739,7 +6832,10 @@ function AppSearchDrawer({
|
|
|
6739
6832
|
ShuffleMCP2,
|
|
6740
6833
|
{
|
|
6741
6834
|
apiKey: API_CONFIG.apiKey || void 0,
|
|
6742
|
-
apiBaseUrl: API_CONFIG.baseUrl,
|
|
6835
|
+
apiBaseUrl: globalUrl || API_CONFIG.baseUrl,
|
|
6836
|
+
globalUrl,
|
|
6837
|
+
theme,
|
|
6838
|
+
colorMode,
|
|
6743
6839
|
placeholder: initialQuery ? `Search ${initialQuery} integrations...` : "Search integrations...",
|
|
6744
6840
|
layout: "grid",
|
|
6745
6841
|
gridColumns: 2,
|
|
@@ -6751,8 +6847,17 @@ function AppSearchDrawer({
|
|
|
6751
6847
|
showCheckbox: multiSelect,
|
|
6752
6848
|
multiSelect,
|
|
6753
6849
|
selectedApps: multiSelect ? projectedSelectedApps : void 0,
|
|
6850
|
+
disableAutoSelectValidatedApps: multiSelect,
|
|
6754
6851
|
preventDefault: true,
|
|
6755
6852
|
onAppSelected: handleAppSelected,
|
|
6853
|
+
onSelectionChange: multiSelect ? (next) => {
|
|
6854
|
+
onSelectionChange?.(next.map((app) => ({
|
|
6855
|
+
name: app.name,
|
|
6856
|
+
id: app.objectID || null,
|
|
6857
|
+
icon: app.image_url || "",
|
|
6858
|
+
categories: app.categories || []
|
|
6859
|
+
})));
|
|
6860
|
+
} : void 0,
|
|
6756
6861
|
pinnedApps: pinnedApps?.map((p) => ({
|
|
6757
6862
|
name: p.name,
|
|
6758
6863
|
image_url: p.image_url,
|
|
@@ -6798,6 +6903,9 @@ function AppSearchDrawer({
|
|
|
6798
6903
|
appId: detailAppId,
|
|
6799
6904
|
anchor,
|
|
6800
6905
|
width,
|
|
6906
|
+
globalUrl,
|
|
6907
|
+
theme,
|
|
6908
|
+
colorMode,
|
|
6801
6909
|
onRefresh: onClose,
|
|
6802
6910
|
onAddToCanvas
|
|
6803
6911
|
}
|
|
@@ -8836,6 +8944,8 @@ var AgentUI = ({
|
|
|
8836
8944
|
apiKey,
|
|
8837
8945
|
apiBaseUrl,
|
|
8838
8946
|
orgId,
|
|
8947
|
+
theme,
|
|
8948
|
+
colorMode,
|
|
8839
8949
|
className,
|
|
8840
8950
|
sx,
|
|
8841
8951
|
contentSx
|
|
@@ -11385,6 +11495,9 @@ var AgentUI = ({
|
|
|
11385
11495
|
subtitle: appPickerSubtitle,
|
|
11386
11496
|
multiSelect: true,
|
|
11387
11497
|
selectedApps: chosenApps.map((a) => ({ name: a.name, id: a.id || null, icon: a.icon })),
|
|
11498
|
+
globalUrl: apiBaseUrl,
|
|
11499
|
+
theme,
|
|
11500
|
+
colorMode,
|
|
11388
11501
|
onSelectionChange: (next) => {
|
|
11389
11502
|
setChosenApps(
|
|
11390
11503
|
next.map((app) => {
|
|
@@ -11408,7 +11521,10 @@ var AgentUI = ({
|
|
|
11408
11521
|
onClose: () => setAuthDrawerApp(null),
|
|
11409
11522
|
appName: authDrawerApp?.name || null,
|
|
11410
11523
|
appId: authDrawerApp?.id || null,
|
|
11411
|
-
activeOrgId: orgId || null
|
|
11524
|
+
activeOrgId: orgId || null,
|
|
11525
|
+
globalUrl: apiBaseUrl,
|
|
11526
|
+
theme,
|
|
11527
|
+
colorMode
|
|
11412
11528
|
}
|
|
11413
11529
|
)
|
|
11414
11530
|
]
|
|
@@ -11420,15 +11536,15 @@ var AgentUI = ({
|
|
|
11420
11536
|
var AgentUI_default = AgentUI;
|
|
11421
11537
|
|
|
11422
11538
|
// components/AgentRunDrawer.tsx
|
|
11423
|
-
import { useEffect as
|
|
11539
|
+
import { useEffect as useEffect13, useRef as useRef10, useState as useState14 } from "react";
|
|
11424
11540
|
import {
|
|
11425
|
-
Box as
|
|
11541
|
+
Box as Box17,
|
|
11426
11542
|
Drawer as Drawer3,
|
|
11427
11543
|
IconButton as IconButton9,
|
|
11428
11544
|
Tab,
|
|
11429
11545
|
Tabs,
|
|
11430
|
-
Tooltip as
|
|
11431
|
-
Typography as
|
|
11546
|
+
Tooltip as Tooltip11,
|
|
11547
|
+
Typography as Typography16
|
|
11432
11548
|
} from "@mui/material";
|
|
11433
11549
|
import {
|
|
11434
11550
|
Play,
|
|
@@ -11436,7 +11552,361 @@ import {
|
|
|
11436
11552
|
ShieldCheck,
|
|
11437
11553
|
X as CloseIcon6
|
|
11438
11554
|
} from "lucide-react";
|
|
11555
|
+
|
|
11556
|
+
// components/LocalLLMConfig.tsx
|
|
11557
|
+
import { useEffect as useEffect12, useMemo as useMemo7, useRef as useRef9, useState as useState13 } from "react";
|
|
11558
|
+
import {
|
|
11559
|
+
Autocomplete as Autocomplete3,
|
|
11560
|
+
Box as Box16,
|
|
11561
|
+
Button as Button9,
|
|
11562
|
+
Dialog as Dialog2,
|
|
11563
|
+
DialogActions,
|
|
11564
|
+
DialogContent as DialogContent2,
|
|
11565
|
+
DialogContentText,
|
|
11566
|
+
DialogTitle as DialogTitle2,
|
|
11567
|
+
TextField as TextField6,
|
|
11568
|
+
Typography as Typography15
|
|
11569
|
+
} from "@mui/material";
|
|
11570
|
+
|
|
11571
|
+
// components/UsageBar.tsx
|
|
11572
|
+
import { Box as Box15, Typography as Typography14, Tooltip as Tooltip10 } from "@mui/material";
|
|
11439
11573
|
import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
11574
|
+
var fmt = (n) => n.toLocaleString();
|
|
11575
|
+
var UsageBar = ({
|
|
11576
|
+
label,
|
|
11577
|
+
usage,
|
|
11578
|
+
limit,
|
|
11579
|
+
unit,
|
|
11580
|
+
hint,
|
|
11581
|
+
actionLabel,
|
|
11582
|
+
actionHref
|
|
11583
|
+
}) => {
|
|
11584
|
+
const safeLimit = Math.max(limit, 0);
|
|
11585
|
+
const pct = safeLimit > 0 ? usage / safeLimit * 100 : 0;
|
|
11586
|
+
const isOver = pct >= 100;
|
|
11587
|
+
const isWarn = pct >= 65 && !isOver;
|
|
11588
|
+
const accent = isOver ? "hsl(var(--destructive))" : isWarn ? "hsl(var(--severity-medium))" : "hsl(var(--muted-foreground))";
|
|
11589
|
+
const tooltipText = safeLimit > 0 ? `${pct.toFixed(0)}% used \xB7 ${fmt(usage)} / ${fmt(safeLimit)}${unit ? " " + unit : ""}${hint ? " \xB7 " + hint : ""}` : `${fmt(usage)}${unit ? " " + unit : ""}${hint ? " \xB7 " + hint : ""}`;
|
|
11590
|
+
return /* @__PURE__ */ jsx21(Tooltip10, { title: tooltipText, placement: "top", arrow: true, children: /* @__PURE__ */ jsxs18(Box15, { sx: { display: "flex", flexDirection: "column", gap: 0.5, py: 0.25 }, children: [
|
|
11591
|
+
/* @__PURE__ */ jsxs18(Box15, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 1 }, children: [
|
|
11592
|
+
/* @__PURE__ */ jsx21(
|
|
11593
|
+
Typography14,
|
|
11594
|
+
{
|
|
11595
|
+
sx: {
|
|
11596
|
+
fontSize: "12.8px",
|
|
11597
|
+
fontWeight: 500,
|
|
11598
|
+
color: "hsl(var(--muted-foreground))",
|
|
11599
|
+
lineHeight: 1.2
|
|
11600
|
+
},
|
|
11601
|
+
children: label
|
|
11602
|
+
}
|
|
11603
|
+
),
|
|
11604
|
+
/* @__PURE__ */ jsxs18(Box15, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
11605
|
+
actionLabel && actionHref && (isWarn || isOver) && /* @__PURE__ */ jsx21(
|
|
11606
|
+
Box15,
|
|
11607
|
+
{
|
|
11608
|
+
component: "a",
|
|
11609
|
+
href: actionHref,
|
|
11610
|
+
target: "_blank",
|
|
11611
|
+
rel: "noopener noreferrer",
|
|
11612
|
+
sx: {
|
|
11613
|
+
fontSize: "12.8px",
|
|
11614
|
+
fontWeight: 600,
|
|
11615
|
+
color: accent,
|
|
11616
|
+
textDecoration: "none",
|
|
11617
|
+
"&:hover": { textDecoration: "underline" }
|
|
11618
|
+
},
|
|
11619
|
+
children: actionLabel
|
|
11620
|
+
}
|
|
11621
|
+
),
|
|
11622
|
+
/* @__PURE__ */ jsx21(
|
|
11623
|
+
Typography14,
|
|
11624
|
+
{
|
|
11625
|
+
sx: {
|
|
11626
|
+
fontSize: "12.8px",
|
|
11627
|
+
fontWeight: 500,
|
|
11628
|
+
color: accent,
|
|
11629
|
+
whiteSpace: "nowrap",
|
|
11630
|
+
fontVariantNumeric: "tabular-nums"
|
|
11631
|
+
},
|
|
11632
|
+
children: safeLimit > 0 ? `${fmt(usage)} / ${fmt(safeLimit)}${unit ? " " + unit : ""}` : `${fmt(usage)}${unit ? " " + unit : ""}`
|
|
11633
|
+
}
|
|
11634
|
+
)
|
|
11635
|
+
] })
|
|
11636
|
+
] }),
|
|
11637
|
+
/* @__PURE__ */ jsx21(Box15, { sx: { width: "100%", height: 2, bgcolor: "hsl(var(--muted) / 0.5)", borderRadius: 1, overflow: "hidden" }, children: /* @__PURE__ */ jsx21(
|
|
11638
|
+
Box15,
|
|
11639
|
+
{
|
|
11640
|
+
sx: {
|
|
11641
|
+
width: `${Math.min(Math.max(pct, 0), 100)}%`,
|
|
11642
|
+
height: "100%",
|
|
11643
|
+
bgcolor: isOver ? "hsl(var(--destructive))" : isWarn ? "hsl(var(--severity-medium))" : "hsl(var(--severity-low, 142 71% 45%))",
|
|
11644
|
+
transition: "width 0.3s ease"
|
|
11645
|
+
}
|
|
11646
|
+
}
|
|
11647
|
+
) })
|
|
11648
|
+
] }) });
|
|
11649
|
+
};
|
|
11650
|
+
|
|
11651
|
+
// components/LocalLLMConfig.tsx
|
|
11652
|
+
import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
11653
|
+
import { createElement as createElement2 } from "react";
|
|
11654
|
+
var OPENAI_APP_NAME = "OpenAI";
|
|
11655
|
+
var OPENAI_APP_ID = "5d19dd82517870c68d40cacad9b5ca91";
|
|
11656
|
+
var SHUFFLE_AI_PRESET = "Shuffle AI";
|
|
11657
|
+
var CUSTOM_PRESET = "Custom / self-hosted";
|
|
11658
|
+
var OPENAI_ALGOLIA_APP = {
|
|
11659
|
+
name: OPENAI_APP_NAME,
|
|
11660
|
+
description: "OpenAI-compatible LLM endpoint for agent operations",
|
|
11661
|
+
objectID: OPENAI_APP_ID,
|
|
11662
|
+
creator: "",
|
|
11663
|
+
app_version: "1.0.0",
|
|
11664
|
+
image_url: "",
|
|
11665
|
+
time_edited: 0,
|
|
11666
|
+
generated: false,
|
|
11667
|
+
invalid: false,
|
|
11668
|
+
priority: 0,
|
|
11669
|
+
actions: 0,
|
|
11670
|
+
tags: [],
|
|
11671
|
+
accessible_by: [],
|
|
11672
|
+
categories: [],
|
|
11673
|
+
action_labels: [],
|
|
11674
|
+
triggers: [],
|
|
11675
|
+
verified: true
|
|
11676
|
+
};
|
|
11677
|
+
var ENDPOINT_PRESETS = [
|
|
11678
|
+
{ label: SHUFFLE_AI_PRESET, url: "" },
|
|
11679
|
+
{ label: "OpenAI", url: "https://api.openai.com/v1" },
|
|
11680
|
+
{ label: "Anthropic", url: "https://api.anthropic.com/v1/" },
|
|
11681
|
+
{ label: "Google Gemini", url: "https://generativelanguage.googleapis.com/v1beta/openai/" },
|
|
11682
|
+
{ label: "Mistral", url: "https://api.mistral.ai/v1" },
|
|
11683
|
+
{ label: "Groq", url: "https://api.groq.com/openai/v1" },
|
|
11684
|
+
{ label: "Together AI", url: "https://api.together.xyz/v1" },
|
|
11685
|
+
{ label: "OpenRouter", url: "https://openrouter.ai/api/v1" },
|
|
11686
|
+
{ label: "Ollama (localhost)", url: "http://localhost:11434/v1" },
|
|
11687
|
+
{ label: "LM Studio (localhost)", url: "http://localhost:1234/v1" },
|
|
11688
|
+
{ label: CUSTOM_PRESET, url: "" }
|
|
11689
|
+
];
|
|
11690
|
+
var LocalLLMConfig = ({ compact, globalUrl, userdata, isLoaded, isLoggedIn, serverside, theme, colorMode }) => {
|
|
11691
|
+
useSyncHostBaseUrl(globalUrl);
|
|
11692
|
+
const { authStates, authenticatedApps, handleAuthChange, handleTestConnection, handleSaveAuth, refreshAuth } = useAppAuth();
|
|
11693
|
+
const [expanded, setExpanded] = useState13(true);
|
|
11694
|
+
const [selectedPreset, setSelectedPreset] = useState13("");
|
|
11695
|
+
const [customUrl, setCustomUrl] = useState13("");
|
|
11696
|
+
const [confirmShuffleAIOpen, setConfirmShuffleAIOpen] = useState13(false);
|
|
11697
|
+
const openaiEntries = authenticatedApps.filter(
|
|
11698
|
+
(a) => a.app?.name?.toLowerCase() === "openai" || a.app?.id === OPENAI_APP_ID
|
|
11699
|
+
);
|
|
11700
|
+
const authState = authStates[OPENAI_APP_ID] || {
|
|
11701
|
+
systemId: OPENAI_APP_ID,
|
|
11702
|
+
status: "pending",
|
|
11703
|
+
credentials: {}
|
|
11704
|
+
};
|
|
11705
|
+
const currentUrl = authState.credentials?.url || "";
|
|
11706
|
+
const attemptedDeletionRef = useRef9(/* @__PURE__ */ new Set());
|
|
11707
|
+
useEffect12(() => {
|
|
11708
|
+
if (authState.status === "testing") return;
|
|
11709
|
+
const failedEntries = openaiEntries.filter((e) => e.validation && e.validation.valid === false && e.id);
|
|
11710
|
+
if (failedEntries.length === 0) return;
|
|
11711
|
+
let cancelled = false;
|
|
11712
|
+
(async () => {
|
|
11713
|
+
let deletedAny = false;
|
|
11714
|
+
for (const entry of failedEntries) {
|
|
11715
|
+
const id = entry.id;
|
|
11716
|
+
if (attemptedDeletionRef.current.has(id)) continue;
|
|
11717
|
+
attemptedDeletionRef.current.add(id);
|
|
11718
|
+
try {
|
|
11719
|
+
const resp = await fetch(getApiUrl(`/api/v1/apps/authentication/${id}`), {
|
|
11720
|
+
method: "DELETE",
|
|
11721
|
+
credentials: "include",
|
|
11722
|
+
headers: { ...getAuthHeader() }
|
|
11723
|
+
});
|
|
11724
|
+
if (resp.ok) deletedAny = true;
|
|
11725
|
+
} catch (err) {
|
|
11726
|
+
console.error("[LocalLLMConfig] Failed to auto-delete failed OpenAI auth:", err);
|
|
11727
|
+
}
|
|
11728
|
+
}
|
|
11729
|
+
if (!cancelled && deletedAny) {
|
|
11730
|
+
await refreshAuth();
|
|
11731
|
+
refreshAllIntegrationStatus();
|
|
11732
|
+
}
|
|
11733
|
+
})();
|
|
11734
|
+
return () => {
|
|
11735
|
+
cancelled = true;
|
|
11736
|
+
};
|
|
11737
|
+
}, [openaiEntries, authState.status, refreshAuth]);
|
|
11738
|
+
const hasOpenAIEntries = openaiEntries.length > 0;
|
|
11739
|
+
const effectivePreset = useMemo7(() => {
|
|
11740
|
+
if (selectedPreset) return selectedPreset;
|
|
11741
|
+
if (!currentUrl && !hasOpenAIEntries) return SHUFFLE_AI_PRESET;
|
|
11742
|
+
if (!currentUrl) return "";
|
|
11743
|
+
const match = ENDPOINT_PRESETS.find((p) => p.url && p.url === currentUrl);
|
|
11744
|
+
return match ? match.label : CUSTOM_PRESET;
|
|
11745
|
+
}, [selectedPreset, currentUrl, hasOpenAIEntries]);
|
|
11746
|
+
const applyShuffleAI = async () => {
|
|
11747
|
+
let deletedAny = false;
|
|
11748
|
+
for (const entry of openaiEntries) {
|
|
11749
|
+
if (!entry.id) continue;
|
|
11750
|
+
try {
|
|
11751
|
+
const resp = await fetch(getApiUrl(`/api/v1/apps/authentication/${entry.id}`), {
|
|
11752
|
+
method: "DELETE",
|
|
11753
|
+
credentials: "include",
|
|
11754
|
+
headers: { ...getAuthHeader() }
|
|
11755
|
+
});
|
|
11756
|
+
if (resp.ok) deletedAny = true;
|
|
11757
|
+
} catch (err) {
|
|
11758
|
+
console.error("[LocalLLMConfig] Failed to delete OpenAI auth when switching to Shuffle AI:", err);
|
|
11759
|
+
}
|
|
11760
|
+
}
|
|
11761
|
+
handleAuthChange(OPENAI_APP_ID, {});
|
|
11762
|
+
setSelectedPreset(SHUFFLE_AI_PRESET);
|
|
11763
|
+
setCustomUrl("");
|
|
11764
|
+
if (deletedAny) {
|
|
11765
|
+
await refreshAuth();
|
|
11766
|
+
refreshAllIntegrationStatus();
|
|
11767
|
+
}
|
|
11768
|
+
};
|
|
11769
|
+
const handlePresetChange = (label) => {
|
|
11770
|
+
if (label === SHUFFLE_AI_PRESET) {
|
|
11771
|
+
if (hasOpenAIEntries) {
|
|
11772
|
+
setConfirmShuffleAIOpen(true);
|
|
11773
|
+
return;
|
|
11774
|
+
}
|
|
11775
|
+
void applyShuffleAI();
|
|
11776
|
+
return;
|
|
11777
|
+
}
|
|
11778
|
+
setSelectedPreset(label);
|
|
11779
|
+
const preset = ENDPOINT_PRESETS.find((p) => p.label === label);
|
|
11780
|
+
if (!preset) return;
|
|
11781
|
+
handleAuthChange(OPENAI_APP_ID, { ...authState.credentials, url: preset.label === CUSTOM_PRESET ? customUrl : preset.url });
|
|
11782
|
+
};
|
|
11783
|
+
const handleCustomUrlChange = (value) => {
|
|
11784
|
+
setCustomUrl(value);
|
|
11785
|
+
handleAuthChange(OPENAI_APP_ID, { ...authState.credentials, url: value });
|
|
11786
|
+
};
|
|
11787
|
+
const isShuffleAI = effectivePreset === SHUFFLE_AI_PRESET;
|
|
11788
|
+
const orgId = userdata?.active_org?.id;
|
|
11789
|
+
const [orgData, setOrgData] = useState13(null);
|
|
11790
|
+
useEffect12(() => {
|
|
11791
|
+
if (!orgId) return;
|
|
11792
|
+
let cancelled = false;
|
|
11793
|
+
(async () => {
|
|
11794
|
+
try {
|
|
11795
|
+
const res = await fetch(getApiUrl(`/api/v1/orgs/${orgId}`), {
|
|
11796
|
+
method: "GET",
|
|
11797
|
+
credentials: "include",
|
|
11798
|
+
headers: { ...getAuthHeader(), "Content-Type": "application/json" }
|
|
11799
|
+
});
|
|
11800
|
+
if (!res.ok) return;
|
|
11801
|
+
const data = await res.json();
|
|
11802
|
+
if (!cancelled) setOrgData(data);
|
|
11803
|
+
} catch (err) {
|
|
11804
|
+
console.error("[LocalLLMConfig] Failed to fetch org info:", err);
|
|
11805
|
+
}
|
|
11806
|
+
})();
|
|
11807
|
+
return () => {
|
|
11808
|
+
cancelled = true;
|
|
11809
|
+
};
|
|
11810
|
+
}, [orgId]);
|
|
11811
|
+
const appRunLimit = orgData?.app_execution_limit ?? userdata?.app_execution_limit ?? 0;
|
|
11812
|
+
const appRunUsage = (orgData?.app_execution_usage ?? userdata?.app_execution_usage ?? 0) + (orgData?.app_executions_suborgs ?? userdata?.app_executions_suborgs ?? 0);
|
|
11813
|
+
const agentTokens = orgData?.sync_features?.agent_tokens ?? userdata?.sync_features?.agent_tokens;
|
|
11814
|
+
const agentTokenLimit = Number(agentTokens?.limit) || 0;
|
|
11815
|
+
const agentTokenUsage = Number(agentTokens?.usage) || 0;
|
|
11816
|
+
return /* @__PURE__ */ jsxs19(Box16, { sx: { display: "flex", flexDirection: "column", gap: 2.5 }, children: [
|
|
11817
|
+
/* @__PURE__ */ jsxs19(Box16, { sx: { display: "flex", flexDirection: "column", gap: 1 }, children: [
|
|
11818
|
+
/* @__PURE__ */ jsx22(Typography15, { sx: { fontSize: "0.85rem", fontWeight: 600, color: "hsl(var(--foreground))" }, children: "AI Provider" }),
|
|
11819
|
+
/* @__PURE__ */ jsx22(
|
|
11820
|
+
Autocomplete3,
|
|
11821
|
+
{
|
|
11822
|
+
size: "small",
|
|
11823
|
+
fullWidth: true,
|
|
11824
|
+
disableClearable: true,
|
|
11825
|
+
options: ENDPOINT_PRESETS.map((p) => p.label),
|
|
11826
|
+
value: effectivePreset || null,
|
|
11827
|
+
onChange: (_e, val) => val && handlePresetChange(val),
|
|
11828
|
+
isOptionEqualToValue: (opt, val) => opt === val,
|
|
11829
|
+
renderOption: (props, option) => {
|
|
11830
|
+
const preset = ENDPOINT_PRESETS.find((p) => p.label === option);
|
|
11831
|
+
return /* @__PURE__ */ createElement2("li", { ...props, key: option }, /* @__PURE__ */ jsxs19(Box16, { sx: { display: "flex", alignItems: "center", gap: 1, width: "100%", minWidth: 0 }, children: [
|
|
11832
|
+
/* @__PURE__ */ jsx22(Typography15, { sx: { fontSize: "0.85rem", color: "hsl(var(--popover-foreground))" }, children: option }),
|
|
11833
|
+
preset?.url && /* @__PURE__ */ jsx22(Typography15, { component: "span", sx: { ml: "auto", color: "hsl(var(--muted-foreground))", fontSize: "0.75rem", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: preset.url })
|
|
11834
|
+
] }));
|
|
11835
|
+
},
|
|
11836
|
+
renderInput: (params) => /* @__PURE__ */ jsx22(TextField6, { ...params, placeholder: "Search a provider\u2026" }),
|
|
11837
|
+
slotProps: {
|
|
11838
|
+
paper: { sx: { bgcolor: "hsl(var(--popover))", color: "hsl(var(--popover-foreground))", border: "1px solid hsl(var(--border))" } },
|
|
11839
|
+
popper: { sx: { zIndex: 9999 } }
|
|
11840
|
+
}
|
|
11841
|
+
}
|
|
11842
|
+
)
|
|
11843
|
+
] }),
|
|
11844
|
+
!compact && /* @__PURE__ */ jsx22(Box16, { sx: { px: 2.5, py: 2, borderRadius: 2, border: "1px solid hsl(var(--border))", bgcolor: "hsl(var(--muted) / 0.3)" }, children: /* @__PURE__ */ jsxs19(Typography15, { sx: { fontSize: "0.8rem", color: "hsl(var(--muted-foreground))", lineHeight: 1.5 }, children: [
|
|
11845
|
+
isShuffleAI ? "Using Shuffle AI. No configuration is required. Pick another provider above to use your own endpoint." : "Configure an OpenAI-compatible endpoint for agent operations. Credentials are saved through the app authentication system.",
|
|
11846
|
+
" ",
|
|
11847
|
+
/* @__PURE__ */ jsx22(Box16, { component: "a", href: "https://shuffler.io/docs/AI#using-self-hosted-ai-models", target: "_blank", rel: "noopener noreferrer", sx: { color: "hsl(var(--primary))", textDecoration: "underline" }, children: "Read the docs" }),
|
|
11848
|
+
"."
|
|
11849
|
+
] }) }),
|
|
11850
|
+
isShuffleAI && /* @__PURE__ */ jsxs19(Box16, { sx: { display: "flex", flexDirection: "column", gap: 0.75, mt: 0.5, width: "100%" }, children: [
|
|
11851
|
+
/* @__PURE__ */ jsx22(UsageBar, { label: "App runs", usage: appRunUsage, limit: appRunLimit, unit: "runs", actionLabel: "Upgrade", actionHref: "https://shuffler.io/pricing" }),
|
|
11852
|
+
/* @__PURE__ */ jsx22(UsageBar, { label: "Agent tokens", usage: agentTokenUsage, limit: agentTokenLimit, unit: "tokens", actionLabel: "Upgrade", actionHref: "https://shuffler.io/pricing" })
|
|
11853
|
+
] }),
|
|
11854
|
+
effectivePreset === CUSTOM_PRESET && /* @__PURE__ */ jsx22(
|
|
11855
|
+
TextField6,
|
|
11856
|
+
{
|
|
11857
|
+
size: "small",
|
|
11858
|
+
fullWidth: true,
|
|
11859
|
+
placeholder: "https://your-self-hosted-endpoint.example.com",
|
|
11860
|
+
value: customUrl || currentUrl,
|
|
11861
|
+
onChange: (e) => handleCustomUrlChange(e.target.value),
|
|
11862
|
+
helperText: "Enter the base URL of your OpenAI-compatible endpoint",
|
|
11863
|
+
sx: { "& .MuiFormHelperText-root": { color: "hsl(var(--muted-foreground))" } }
|
|
11864
|
+
}
|
|
11865
|
+
),
|
|
11866
|
+
!isShuffleAI && /* @__PURE__ */ jsx22(
|
|
11867
|
+
AppAuthCard,
|
|
11868
|
+
{
|
|
11869
|
+
app: OPENAI_ALGOLIA_APP,
|
|
11870
|
+
authState,
|
|
11871
|
+
isExpanded: expanded,
|
|
11872
|
+
onToggle: () => setExpanded((prev) => !prev),
|
|
11873
|
+
onAuthChange: handleAuthChange,
|
|
11874
|
+
onTestConnection: (appId, authId) => handleTestConnection(appId, authId),
|
|
11875
|
+
onSaveAuth: (appId, creds) => handleSaveAuth(appId, creds, OPENAI_APP_NAME),
|
|
11876
|
+
apiAuthEntries: openaiEntries,
|
|
11877
|
+
onRefreshAuth: refreshAuth,
|
|
11878
|
+
disableUrlPrefill: true,
|
|
11879
|
+
hideHeader: true,
|
|
11880
|
+
hideStatusChips: true,
|
|
11881
|
+
hideDocsLink: true,
|
|
11882
|
+
hideUrlFields: true,
|
|
11883
|
+
borderless: true,
|
|
11884
|
+
globalUrl,
|
|
11885
|
+
userdata,
|
|
11886
|
+
isLoaded,
|
|
11887
|
+
isLoggedIn,
|
|
11888
|
+
serverside,
|
|
11889
|
+
theme,
|
|
11890
|
+
colorMode
|
|
11891
|
+
}
|
|
11892
|
+
),
|
|
11893
|
+
/* @__PURE__ */ jsxs19(Dialog2, { open: confirmShuffleAIOpen, onClose: () => setConfirmShuffleAIOpen(false), slotProps: { paper: { sx: { bgcolor: "hsl(var(--popover))", color: "hsl(var(--popover-foreground))", border: "1px solid hsl(var(--border))" } } }, children: [
|
|
11894
|
+
/* @__PURE__ */ jsx22(DialogTitle2, { sx: { fontSize: "1rem", fontWeight: 600 }, children: "Switch to Shuffle AI?" }),
|
|
11895
|
+
/* @__PURE__ */ jsx22(DialogContent2, { children: /* @__PURE__ */ jsx22(DialogContentText, { sx: { color: "hsl(var(--muted-foreground))", fontSize: "0.85rem" }, children: "Switching to Shuffle AI will remove your existing OpenAI app authentication. Any other workflow or app using this OpenAI authentication will lose access. Do you want to continue?" }) }),
|
|
11896
|
+
/* @__PURE__ */ jsxs19(DialogActions, { sx: { px: 3, pb: 2 }, children: [
|
|
11897
|
+
/* @__PURE__ */ jsx22(Button9, { onClick: () => setConfirmShuffleAIOpen(false), sx: { color: "hsl(var(--muted-foreground))", textTransform: "none", height: 36 }, children: "Cancel" }),
|
|
11898
|
+
/* @__PURE__ */ jsx22(Button9, { onClick: async () => {
|
|
11899
|
+
setConfirmShuffleAIOpen(false);
|
|
11900
|
+
await applyShuffleAI();
|
|
11901
|
+
}, sx: { bgcolor: "hsl(var(--primary))", color: "hsl(var(--primary-foreground))", textTransform: "none", height: 36, "&:hover": { bgcolor: "hsl(var(--primary) / 0.9)" } }, children: "Remove and use Shuffle AI" })
|
|
11902
|
+
] })
|
|
11903
|
+
] })
|
|
11904
|
+
] });
|
|
11905
|
+
};
|
|
11906
|
+
var LocalLLMConfig_default = LocalLLMConfig;
|
|
11907
|
+
|
|
11908
|
+
// components/AgentRunDrawer.tsx
|
|
11909
|
+
import { jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
11440
11910
|
var TAB_ORDER = ["run", "permissions", "localLLM"];
|
|
11441
11911
|
var AgentRunDrawer = ({
|
|
11442
11912
|
open,
|
|
@@ -11456,31 +11926,63 @@ var AgentRunDrawer = ({
|
|
|
11456
11926
|
headerSx,
|
|
11457
11927
|
tabsSx,
|
|
11458
11928
|
bodySx,
|
|
11459
|
-
globalUrl
|
|
11929
|
+
globalUrl,
|
|
11930
|
+
theme,
|
|
11931
|
+
colorMode,
|
|
11932
|
+
userdata,
|
|
11933
|
+
isLoaded,
|
|
11934
|
+
isLoggedIn,
|
|
11935
|
+
serverside
|
|
11460
11936
|
}) => {
|
|
11461
11937
|
useSyncHostBaseUrl(globalUrl);
|
|
11462
|
-
const
|
|
11463
|
-
const
|
|
11464
|
-
|
|
11938
|
+
const themeScope = useShuffleMcpTheme();
|
|
11939
|
+
const [activeTab, setActiveTab] = useState14(initialTab);
|
|
11940
|
+
const prevOpenRef = useRef10(open);
|
|
11941
|
+
useEffect13(() => {
|
|
11465
11942
|
if (open && !prevOpenRef.current) setActiveTab(initialTab);
|
|
11466
11943
|
prevOpenRef.current = open;
|
|
11467
11944
|
}, [open, initialTab]);
|
|
11468
|
-
|
|
11945
|
+
useEffect13(() => {
|
|
11469
11946
|
if (typeof window === "undefined") return;
|
|
11470
11947
|
window.__shuffleAgentDrawerMounted = (window.__shuffleAgentDrawerMounted || 0) + 1;
|
|
11471
11948
|
return () => {
|
|
11472
11949
|
window.__shuffleAgentDrawerMounted = Math.max(0, (window.__shuffleAgentDrawerMounted || 1) - 1);
|
|
11473
11950
|
};
|
|
11474
11951
|
}, []);
|
|
11952
|
+
useEffect13(() => {
|
|
11953
|
+
if (typeof window === "undefined") return;
|
|
11954
|
+
const onOpen = (event) => {
|
|
11955
|
+
const tab = event.detail?.tab;
|
|
11956
|
+
if (tab === "localLLM") {
|
|
11957
|
+
event.preventDefault();
|
|
11958
|
+
setActiveTab("localLLM");
|
|
11959
|
+
}
|
|
11960
|
+
};
|
|
11961
|
+
window.addEventListener("agent-drawer-open", onOpen);
|
|
11962
|
+
return () => window.removeEventListener("agent-drawer-open", onOpen);
|
|
11963
|
+
}, []);
|
|
11964
|
+
const effectiveLocalLLMSlot = localLLMSlot ?? /* @__PURE__ */ jsx23(
|
|
11965
|
+
LocalLLMConfig_default,
|
|
11966
|
+
{
|
|
11967
|
+
compact: true,
|
|
11968
|
+
globalUrl,
|
|
11969
|
+
userdata,
|
|
11970
|
+
isLoaded,
|
|
11971
|
+
isLoggedIn,
|
|
11972
|
+
serverside,
|
|
11973
|
+
theme,
|
|
11974
|
+
colorMode
|
|
11975
|
+
}
|
|
11976
|
+
);
|
|
11475
11977
|
const visibleTabs = TAB_ORDER.filter((t) => {
|
|
11476
11978
|
if (t === "run") return true;
|
|
11477
11979
|
if (t === "permissions") return !!permissionsSlot;
|
|
11478
|
-
if (t === "localLLM") return !!
|
|
11980
|
+
if (t === "localLLM") return !!effectiveLocalLLMSlot;
|
|
11479
11981
|
return false;
|
|
11480
11982
|
});
|
|
11481
11983
|
const showTabs = visibleTabs.length > 1;
|
|
11482
11984
|
const safeActiveTab = visibleTabs.includes(activeTab) ? activeTab : "run";
|
|
11483
|
-
return /* @__PURE__ */
|
|
11985
|
+
return /* @__PURE__ */ jsxs20(
|
|
11484
11986
|
Drawer3,
|
|
11485
11987
|
{
|
|
11486
11988
|
anchor: "right",
|
|
@@ -11488,7 +11990,7 @@ var AgentRunDrawer = ({
|
|
|
11488
11990
|
onClose,
|
|
11489
11991
|
slotProps: {
|
|
11490
11992
|
paper: {
|
|
11491
|
-
className,
|
|
11993
|
+
className: [themeScope?.scopeClassName, className].filter(Boolean).join(" ") || void 0,
|
|
11492
11994
|
sx: [
|
|
11493
11995
|
{
|
|
11494
11996
|
width: { xs: "100%", sm: width },
|
|
@@ -11503,8 +12005,8 @@ var AgentRunDrawer = ({
|
|
|
11503
12005
|
}
|
|
11504
12006
|
},
|
|
11505
12007
|
children: [
|
|
11506
|
-
/* @__PURE__ */
|
|
11507
|
-
|
|
12008
|
+
/* @__PURE__ */ jsxs20(
|
|
12009
|
+
Box17,
|
|
11508
12010
|
{
|
|
11509
12011
|
sx: [
|
|
11510
12012
|
{
|
|
@@ -11519,8 +12021,8 @@ var AgentRunDrawer = ({
|
|
|
11519
12021
|
...Array.isArray(headerSx) ? headerSx : headerSx ? [headerSx] : []
|
|
11520
12022
|
],
|
|
11521
12023
|
children: [
|
|
11522
|
-
/* @__PURE__ */
|
|
11523
|
-
|
|
12024
|
+
/* @__PURE__ */ jsx23(
|
|
12025
|
+
Box17,
|
|
11524
12026
|
{
|
|
11525
12027
|
sx: {
|
|
11526
12028
|
width: 40,
|
|
@@ -11533,18 +12035,18 @@ var AgentRunDrawer = ({
|
|
|
11533
12035
|
color: "hsl(var(--primary))",
|
|
11534
12036
|
flexShrink: 0
|
|
11535
12037
|
},
|
|
11536
|
-
children: /* @__PURE__ */
|
|
12038
|
+
children: /* @__PURE__ */ jsx23(AgentIcon_default, { size: 22 })
|
|
11537
12039
|
}
|
|
11538
12040
|
),
|
|
11539
|
-
/* @__PURE__ */
|
|
11540
|
-
/* @__PURE__ */
|
|
11541
|
-
/* @__PURE__ */
|
|
12041
|
+
/* @__PURE__ */ jsxs20(Box17, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
12042
|
+
/* @__PURE__ */ jsx23(Typography16, { sx: { fontWeight: 600, fontSize: "1.1rem", color: "hsl(var(--foreground))" }, children: title }),
|
|
12043
|
+
/* @__PURE__ */ jsx23(Typography16, { sx: { fontSize: "0.8rem", color: "hsl(var(--muted-foreground))" }, children: subtitle })
|
|
11542
12044
|
] }),
|
|
11543
|
-
/* @__PURE__ */
|
|
12045
|
+
/* @__PURE__ */ jsx23(IconButton9, { onClick: onClose, size: "small", sx: { color: "hsl(var(--muted-foreground))" }, children: /* @__PURE__ */ jsx23(CloseIcon6, { size: 16 }) })
|
|
11544
12046
|
]
|
|
11545
12047
|
}
|
|
11546
12048
|
),
|
|
11547
|
-
showTabs && /* @__PURE__ */
|
|
12049
|
+
showTabs && /* @__PURE__ */ jsx23(Box17, { sx: { borderBottom: "1px solid hsl(var(--border))", flexShrink: 0 }, children: /* @__PURE__ */ jsxs20(
|
|
11548
12050
|
Tabs,
|
|
11549
12051
|
{
|
|
11550
12052
|
value: safeActiveTab,
|
|
@@ -11566,36 +12068,36 @@ var AgentRunDrawer = ({
|
|
|
11566
12068
|
...Array.isArray(tabsSx) ? tabsSx : tabsSx ? [tabsSx] : []
|
|
11567
12069
|
],
|
|
11568
12070
|
children: [
|
|
11569
|
-
visibleTabs.includes("run") && /* @__PURE__ */
|
|
12071
|
+
visibleTabs.includes("run") && /* @__PURE__ */ jsx23(
|
|
11570
12072
|
Tab,
|
|
11571
12073
|
{
|
|
11572
12074
|
value: "run",
|
|
11573
12075
|
label: "Run",
|
|
11574
|
-
icon: /* @__PURE__ */
|
|
12076
|
+
icon: /* @__PURE__ */ jsx23(Play, { size: 14 }),
|
|
11575
12077
|
iconPosition: "start",
|
|
11576
12078
|
sx: { gap: 0.75 }
|
|
11577
12079
|
}
|
|
11578
12080
|
),
|
|
11579
|
-
visibleTabs.includes("permissions") && /* @__PURE__ */
|
|
12081
|
+
visibleTabs.includes("permissions") && /* @__PURE__ */ jsx23(
|
|
11580
12082
|
Tab,
|
|
11581
12083
|
{
|
|
11582
12084
|
value: "permissions",
|
|
11583
|
-
label: permissionsDisabled ? /* @__PURE__ */
|
|
11584
|
-
icon: /* @__PURE__ */
|
|
12085
|
+
label: permissionsDisabled ? /* @__PURE__ */ jsx23(Tooltip11, { title: permissionsDisabledTooltip, arrow: true, children: /* @__PURE__ */ jsx23(Box17, { component: "span", sx: { display: "inline-flex", alignItems: "center" }, children: "Permissions" }) }) : "Permissions",
|
|
12086
|
+
icon: /* @__PURE__ */ jsx23(ShieldCheck, { size: 14 }),
|
|
11585
12087
|
iconPosition: "start",
|
|
11586
12088
|
disabled: permissionsDisabled,
|
|
11587
12089
|
sx: { gap: 0.75 }
|
|
11588
12090
|
}
|
|
11589
12091
|
),
|
|
11590
|
-
visibleTabs.includes("localLLM") && /* @__PURE__ */
|
|
12092
|
+
visibleTabs.includes("localLLM") && /* @__PURE__ */ jsx23(
|
|
11591
12093
|
Tab,
|
|
11592
12094
|
{
|
|
11593
12095
|
value: "localLLM",
|
|
11594
|
-
label: /* @__PURE__ */
|
|
12096
|
+
label: /* @__PURE__ */ jsxs20(Box17, { sx: { display: "flex", alignItems: "center", gap: 0.5 }, children: [
|
|
11595
12097
|
"Local LLM",
|
|
11596
12098
|
localLLMTabBadge
|
|
11597
12099
|
] }),
|
|
11598
|
-
icon: /* @__PURE__ */
|
|
12100
|
+
icon: /* @__PURE__ */ jsx23(Server, { size: 14 }),
|
|
11599
12101
|
iconPosition: "start",
|
|
11600
12102
|
sx: { gap: 0.75 }
|
|
11601
12103
|
}
|
|
@@ -11603,20 +12105,22 @@ var AgentRunDrawer = ({
|
|
|
11603
12105
|
]
|
|
11604
12106
|
}
|
|
11605
12107
|
) }),
|
|
11606
|
-
/* @__PURE__ */
|
|
11607
|
-
safeActiveTab === "run" && /* @__PURE__ */
|
|
12108
|
+
/* @__PURE__ */ jsxs20(Box17, { sx: [{ flex: 1, overflowY: "auto" }, ...Array.isArray(bodySx) ? bodySx : bodySx ? [bodySx] : []], children: [
|
|
12109
|
+
safeActiveTab === "run" && /* @__PURE__ */ jsx23(Box17, { sx: { px: 2, py: 2 }, children: /* @__PURE__ */ jsx23(
|
|
11608
12110
|
AgentUI_default,
|
|
11609
12111
|
{
|
|
11610
12112
|
compact: true,
|
|
11611
12113
|
hideHeroIcon: true,
|
|
11612
12114
|
title: "",
|
|
11613
12115
|
subtitle: null,
|
|
11614
|
-
|
|
11615
|
-
|
|
12116
|
+
...agentUIProps,
|
|
12117
|
+
apiBaseUrl: agentUIProps?.apiBaseUrl ?? globalUrl,
|
|
12118
|
+
theme: agentUIProps?.theme ?? theme,
|
|
12119
|
+
colorMode: agentUIProps?.colorMode ?? colorMode
|
|
11616
12120
|
}
|
|
11617
12121
|
) }),
|
|
11618
|
-
safeActiveTab === "permissions" && permissionsSlot && /* @__PURE__ */
|
|
11619
|
-
safeActiveTab === "localLLM" &&
|
|
12122
|
+
safeActiveTab === "permissions" && permissionsSlot && /* @__PURE__ */ jsx23(Box17, { sx: { px: 3, py: 2.5 }, children: permissionsSlot }),
|
|
12123
|
+
safeActiveTab === "localLLM" && effectiveLocalLLMSlot && /* @__PURE__ */ jsx23(Box17, { sx: { px: 3, py: 2.5 }, children: effectiveLocalLLMSlot })
|
|
11620
12124
|
] })
|
|
11621
12125
|
]
|
|
11622
12126
|
}
|
|
@@ -11625,22 +12129,22 @@ var AgentRunDrawer = ({
|
|
|
11625
12129
|
var AgentRunDrawer_default = AgentRunDrawer;
|
|
11626
12130
|
|
|
11627
12131
|
// components/AgentActivityList.tsx
|
|
11628
|
-
import { useCallback as useCallback9, useEffect as
|
|
12132
|
+
import { useCallback as useCallback9, useEffect as useEffect14, useRef as useRef11, useState as useState15 } from "react";
|
|
11629
12133
|
import {
|
|
11630
|
-
Box as
|
|
11631
|
-
Button as
|
|
12134
|
+
Box as Box18,
|
|
12135
|
+
Button as Button10,
|
|
11632
12136
|
Chip as Chip8,
|
|
11633
12137
|
CircularProgress as CircularProgress5,
|
|
11634
|
-
Dialog as
|
|
11635
|
-
DialogActions,
|
|
11636
|
-
DialogContent as
|
|
11637
|
-
DialogTitle as
|
|
12138
|
+
Dialog as Dialog3,
|
|
12139
|
+
DialogActions as DialogActions2,
|
|
12140
|
+
DialogContent as DialogContent3,
|
|
12141
|
+
DialogTitle as DialogTitle3,
|
|
11638
12142
|
InputAdornment,
|
|
11639
12143
|
MenuItem as MenuItem3,
|
|
11640
12144
|
Select as Select3,
|
|
11641
|
-
TextField as
|
|
11642
|
-
Tooltip as
|
|
11643
|
-
Typography as
|
|
12145
|
+
TextField as TextField7,
|
|
12146
|
+
Tooltip as Tooltip12,
|
|
12147
|
+
Typography as Typography17
|
|
11644
12148
|
} from "@mui/material";
|
|
11645
12149
|
import {
|
|
11646
12150
|
Activity,
|
|
@@ -11663,6 +12167,21 @@ var resolveHeaders = (apiKey, orgId) => {
|
|
|
11663
12167
|
if (orgId) h["Org-Id"] = orgId;
|
|
11664
12168
|
return h;
|
|
11665
12169
|
};
|
|
12170
|
+
var uuid = () => {
|
|
12171
|
+
if (typeof crypto !== "undefined" && "randomUUID" in crypto) return crypto.randomUUID();
|
|
12172
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
12173
|
+
const r = Math.random() * 16 | 0;
|
|
12174
|
+
const v = c === "x" ? r : r & 3 | 8;
|
|
12175
|
+
return v.toString(16);
|
|
12176
|
+
});
|
|
12177
|
+
};
|
|
12178
|
+
var buildAppNameValue = (apps = []) => apps.filter((a) => !!a?.name).map((a) => a.name).join(",");
|
|
12179
|
+
var buildScheduleName = (input) => {
|
|
12180
|
+
const prompt = (input || "").trim();
|
|
12181
|
+
const words = prompt.replace(/[^a-zA-Z0-9\s-]/g, " ").split(/\s+/).filter(Boolean).slice(0, 6);
|
|
12182
|
+
const title = words.length ? words.map((w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()).join(" ") : "Scheduled Agent Run";
|
|
12183
|
+
return { name: title.slice(0, 80), description: (prompt || "Scheduled Agent Run").slice(0, 240) };
|
|
12184
|
+
};
|
|
11666
12185
|
var searchAgentActivity = async (params = {}) => {
|
|
11667
12186
|
const {
|
|
11668
12187
|
cursor = "",
|
|
@@ -11718,6 +12237,127 @@ var listAgentScheduleWorkflows = async (params = {}) => {
|
|
|
11718
12237
|
const list = Array.isArray(data) ? data : data?.workflows || [];
|
|
11719
12238
|
return list.filter((w) => w && w.workflow_type === "AGENT_SCHEDULE").map((w) => ({ id: w.id || w._id, name: w.name || "Untitled", description: w.description }));
|
|
11720
12239
|
};
|
|
12240
|
+
var scheduleAgentRun = async ({ cron, input, apps = [], onStep, apiKey, apiBaseUrl, orgId }) => {
|
|
12241
|
+
const headers = { "Content-Type": "application/json", ...resolveHeaders(apiKey, orgId) };
|
|
12242
|
+
const step = (id, state, detail) => {
|
|
12243
|
+
try {
|
|
12244
|
+
onStep?.({ id, state, detail });
|
|
12245
|
+
} catch {
|
|
12246
|
+
}
|
|
12247
|
+
};
|
|
12248
|
+
step("name", "active");
|
|
12249
|
+
const { name, description } = buildScheduleName(input);
|
|
12250
|
+
step("name", "done", name);
|
|
12251
|
+
step("workflow", "active");
|
|
12252
|
+
const createRes = await fetch(resolveUrl("/api/v1/workflows", apiBaseUrl), {
|
|
12253
|
+
method: "POST",
|
|
12254
|
+
credentials: "include",
|
|
12255
|
+
headers,
|
|
12256
|
+
body: JSON.stringify({ name, description })
|
|
12257
|
+
});
|
|
12258
|
+
if (!createRes.ok) {
|
|
12259
|
+
step("workflow", "error", `HTTP ${createRes.status}`);
|
|
12260
|
+
throw new Error(`Create workflow failed (${createRes.status})`);
|
|
12261
|
+
}
|
|
12262
|
+
const created = await createRes.json();
|
|
12263
|
+
const workflowId = created.id || created._id || created.workflow_id;
|
|
12264
|
+
if (!workflowId) {
|
|
12265
|
+
step("workflow", "error", "no id returned");
|
|
12266
|
+
throw new Error("Workflow created but no id returned");
|
|
12267
|
+
}
|
|
12268
|
+
const triggerId = uuid();
|
|
12269
|
+
const actionId = uuid();
|
|
12270
|
+
const branchId = uuid();
|
|
12271
|
+
const trigger = {
|
|
12272
|
+
app_name: "Schedule",
|
|
12273
|
+
app_version: "1.0.0",
|
|
12274
|
+
environment: "cloud",
|
|
12275
|
+
id_: triggerId,
|
|
12276
|
+
_id_: triggerId,
|
|
12277
|
+
id: triggerId,
|
|
12278
|
+
finished: true,
|
|
12279
|
+
label: name,
|
|
12280
|
+
type: "TRIGGER",
|
|
12281
|
+
is_valid: true,
|
|
12282
|
+
trigger_type: "SCHEDULE",
|
|
12283
|
+
status: "running",
|
|
12284
|
+
name: "Schedule",
|
|
12285
|
+
parameters: [{ name: "cron", example: "", value: cron }, { name: "execution_argument", example: "", value: "" }],
|
|
12286
|
+
position: { x: 254, y: 617 },
|
|
12287
|
+
flowOrientation: "horizontal"
|
|
12288
|
+
};
|
|
12289
|
+
const action = {
|
|
12290
|
+
name: "Run LLM",
|
|
12291
|
+
label: "AI_Agent_1",
|
|
12292
|
+
app_name: "AI Agent",
|
|
12293
|
+
app_version: "1.0.0",
|
|
12294
|
+
app_id: "shuffle_agent",
|
|
12295
|
+
description: "Run an LLM query against any tool you want",
|
|
12296
|
+
environment: "Cloud",
|
|
12297
|
+
errors: [],
|
|
12298
|
+
id_: actionId,
|
|
12299
|
+
_id_: actionId,
|
|
12300
|
+
id: actionId,
|
|
12301
|
+
is_valid: true,
|
|
12302
|
+
type: "ACTION",
|
|
12303
|
+
isStartNode: true,
|
|
12304
|
+
run_magic_output: false,
|
|
12305
|
+
authentication: [],
|
|
12306
|
+
example: "",
|
|
12307
|
+
category: "",
|
|
12308
|
+
authentication_id: "",
|
|
12309
|
+
template: false,
|
|
12310
|
+
finished: true,
|
|
12311
|
+
flowOrientation: "horizontal",
|
|
12312
|
+
position: { x: 517, y: 370 },
|
|
12313
|
+
selectedAuthentication: {},
|
|
12314
|
+
circleId: uuid(),
|
|
12315
|
+
execution_delay: 0,
|
|
12316
|
+
parameters: [
|
|
12317
|
+
{ name: "app_name", value: buildAppNameValue(apps), required: true, description: "Comma-separated list of app names the agent is allowed to use." },
|
|
12318
|
+
{ name: "input", value: input, required: true, multiline: true, description: "The input data for the LLM query" }
|
|
12319
|
+
]
|
|
12320
|
+
};
|
|
12321
|
+
const updated = { ...created, id: workflowId, name, description, start: actionId, workflow_type: "AGENT_SCHEDULE", actions: [action], triggers: [trigger], branches: [{ source_id: triggerId, destination_id: actionId, id: branchId }] };
|
|
12322
|
+
const putRes = await fetch(resolveUrl(`/api/v1/workflows/${workflowId}`, apiBaseUrl), {
|
|
12323
|
+
method: "PUT",
|
|
12324
|
+
credentials: "include",
|
|
12325
|
+
headers,
|
|
12326
|
+
body: JSON.stringify(updated)
|
|
12327
|
+
});
|
|
12328
|
+
if (!putRes.ok) {
|
|
12329
|
+
step("workflow", "error", `HTTP ${putRes.status}`);
|
|
12330
|
+
throw new Error(`Update workflow failed (${putRes.status})`);
|
|
12331
|
+
}
|
|
12332
|
+
step("workflow", "done", name);
|
|
12333
|
+
step("schedule", "active");
|
|
12334
|
+
const schedRes = await fetch(resolveUrl(`/api/v1/workflows/${workflowId}/schedule`, apiBaseUrl), {
|
|
12335
|
+
method: "POST",
|
|
12336
|
+
credentials: "include",
|
|
12337
|
+
headers,
|
|
12338
|
+
body: JSON.stringify({
|
|
12339
|
+
name: "Schedule",
|
|
12340
|
+
frequency: cron,
|
|
12341
|
+
cron,
|
|
12342
|
+
execution_argument: "",
|
|
12343
|
+
environment: "cloud",
|
|
12344
|
+
id: triggerId,
|
|
12345
|
+
start: actionId,
|
|
12346
|
+
parameters: [{ name: "cron", value: cron }, { name: "execution_argument", value: "" }]
|
|
12347
|
+
})
|
|
12348
|
+
}).catch(async (err) => {
|
|
12349
|
+
await fetch(resolveUrl(`/api/v1/workflows/${workflowId}`, apiBaseUrl), { method: "DELETE", credentials: "include", headers: resolveHeaders(apiKey, orgId) }).catch(() => void 0);
|
|
12350
|
+
throw err;
|
|
12351
|
+
});
|
|
12352
|
+
if (!schedRes.ok) {
|
|
12353
|
+
const errText = await schedRes.text().catch(() => "");
|
|
12354
|
+
await fetch(resolveUrl(`/api/v1/workflows/${workflowId}`, apiBaseUrl), { method: "DELETE", credentials: "include", headers: resolveHeaders(apiKey, orgId) }).catch(() => void 0);
|
|
12355
|
+
step("schedule", "error", `HTTP ${schedRes.status}`);
|
|
12356
|
+
throw new Error(`Scheduler rejected the cron \`${cron}\` (HTTP ${schedRes.status})${errText ? `: ${errText}` : ""}. The workflow has been deleted.`);
|
|
12357
|
+
}
|
|
12358
|
+
step("schedule", "done", cron);
|
|
12359
|
+
return { workflowId, name, cron };
|
|
12360
|
+
};
|
|
11721
12361
|
var findAgentInputParam = (workflow) => {
|
|
11722
12362
|
const actions = workflow?.actions || [];
|
|
11723
12363
|
for (const a of actions) {
|
|
@@ -11807,16 +12447,16 @@ var stopAgentSchedule = async (workflowId, params = {}) => {
|
|
|
11807
12447
|
|
|
11808
12448
|
// components/AgentActivityList.tsx
|
|
11809
12449
|
import { Pencil, StopCircle, AlertTriangle as AlertTriangle2 } from "lucide-react";
|
|
11810
|
-
import { Fragment as Fragment8, jsx as
|
|
12450
|
+
import { Fragment as Fragment8, jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
11811
12451
|
var STATUS_CONFIG = {
|
|
11812
|
-
FINISHED: { icon: /* @__PURE__ */
|
|
11813
|
-
SUCCESS: { icon: /* @__PURE__ */
|
|
11814
|
-
FAILED: { icon: /* @__PURE__ */
|
|
11815
|
-
ABORTED: { icon: /* @__PURE__ */
|
|
11816
|
-
EXECUTING: { icon: /* @__PURE__ */
|
|
11817
|
-
RUNNING: { icon: /* @__PURE__ */
|
|
11818
|
-
WAITING: { icon: /* @__PURE__ */
|
|
11819
|
-
LIMIT_REACHED: { icon: /* @__PURE__ */
|
|
12452
|
+
FINISHED: { icon: /* @__PURE__ */ jsx24(CheckCircle, { size: 16 }), color: "hsl(var(--severity-low, 142 71% 45%))", label: "Completed" },
|
|
12453
|
+
SUCCESS: { icon: /* @__PURE__ */ jsx24(CheckCircle, { size: 16 }), color: "hsl(var(--severity-low, 142 71% 45%))", label: "Completed" },
|
|
12454
|
+
FAILED: { icon: /* @__PURE__ */ jsx24(XCircle, { size: 16 }), color: "hsl(var(--severity-critical, 0 72% 55%))", label: "Failed" },
|
|
12455
|
+
ABORTED: { icon: /* @__PURE__ */ jsx24(XCircle, { size: 16 }), color: "hsl(var(--severity-critical, 0 72% 55%))", label: "Aborted" },
|
|
12456
|
+
EXECUTING: { icon: /* @__PURE__ */ jsx24(Loader2, { size: 16 }), color: "hsl(var(--severity-medium, 38 92% 50%))", label: "Running" },
|
|
12457
|
+
RUNNING: { icon: /* @__PURE__ */ jsx24(Loader2, { size: 16 }), color: "hsl(var(--severity-medium, 38 92% 50%))", label: "Running" },
|
|
12458
|
+
WAITING: { icon: /* @__PURE__ */ jsx24(Clock, { size: 16 }), color: "hsl(var(--severity-info, 217 91% 60%))", label: "Waiting" },
|
|
12459
|
+
LIMIT_REACHED: { icon: /* @__PURE__ */ jsx24(AlertTriangle2, { size: 16 }), color: "hsl(var(--severity-medium, 38 92% 50%))", label: "Limit reached" }
|
|
11820
12460
|
};
|
|
11821
12461
|
var getEffectiveStatus = (run) => {
|
|
11822
12462
|
const raw = (run.status || "").toUpperCase();
|
|
@@ -11832,12 +12472,12 @@ var getEffectiveStatus = (run) => {
|
|
|
11832
12472
|
var getRunIcon = (run) => {
|
|
11833
12473
|
const src = (run.execution_source || "").toLowerCase();
|
|
11834
12474
|
const arg = (run.execution_argument || "").toLowerCase();
|
|
11835
|
-
if (src.includes("schedule") || src.includes("cron")) return /* @__PURE__ */
|
|
11836
|
-
if (src.includes("webhook") || src.includes("http")) return /* @__PURE__ */
|
|
11837
|
-
if (arg.includes("alert") || arg.includes("detect")) return /* @__PURE__ */
|
|
11838
|
-
if (arg.includes("report") || arg.includes("email")) return /* @__PURE__ */
|
|
11839
|
-
if (arg.includes("endpoint") || arg.includes("server")) return /* @__PURE__ */
|
|
11840
|
-
return /* @__PURE__ */
|
|
12475
|
+
if (src.includes("schedule") || src.includes("cron")) return /* @__PURE__ */ jsx24(Clock, { size: 18 });
|
|
12476
|
+
if (src.includes("webhook") || src.includes("http")) return /* @__PURE__ */ jsx24(Globe, { size: 18 });
|
|
12477
|
+
if (arg.includes("alert") || arg.includes("detect")) return /* @__PURE__ */ jsx24(Activity, { size: 18 });
|
|
12478
|
+
if (arg.includes("report") || arg.includes("email")) return /* @__PURE__ */ jsx24(FileText, { size: 18 });
|
|
12479
|
+
if (arg.includes("endpoint") || arg.includes("server")) return /* @__PURE__ */ jsx24(Server2, { size: 18 });
|
|
12480
|
+
return /* @__PURE__ */ jsx24(Zap, { size: 18 });
|
|
11841
12481
|
};
|
|
11842
12482
|
var getRunIconColor = (run) => {
|
|
11843
12483
|
const status = getEffectiveStatus(run);
|
|
@@ -11931,8 +12571,8 @@ var AgentRunRow = ({ run, onClick, sx }) => {
|
|
|
11931
12571
|
const iconColor = getRunIconColor(run);
|
|
11932
12572
|
const duration = formatDuration(run);
|
|
11933
12573
|
const tools = getRunTools(run);
|
|
11934
|
-
return /* @__PURE__ */
|
|
11935
|
-
|
|
12574
|
+
return /* @__PURE__ */ jsxs21(
|
|
12575
|
+
Box18,
|
|
11936
12576
|
{
|
|
11937
12577
|
onClick,
|
|
11938
12578
|
sx: [
|
|
@@ -11955,8 +12595,8 @@ var AgentRunRow = ({ run, onClick, sx }) => {
|
|
|
11955
12595
|
...Array.isArray(sx) ? sx : sx ? [sx] : []
|
|
11956
12596
|
],
|
|
11957
12597
|
children: [
|
|
11958
|
-
/* @__PURE__ */
|
|
11959
|
-
|
|
12598
|
+
/* @__PURE__ */ jsx24(
|
|
12599
|
+
Box18,
|
|
11960
12600
|
{
|
|
11961
12601
|
sx: {
|
|
11962
12602
|
width: 40,
|
|
@@ -11972,10 +12612,10 @@ var AgentRunRow = ({ run, onClick, sx }) => {
|
|
|
11972
12612
|
children: getRunIcon(run)
|
|
11973
12613
|
}
|
|
11974
12614
|
),
|
|
11975
|
-
/* @__PURE__ */
|
|
11976
|
-
/* @__PURE__ */
|
|
11977
|
-
/* @__PURE__ */
|
|
11978
|
-
|
|
12615
|
+
/* @__PURE__ */ jsxs21(Box18, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
12616
|
+
/* @__PURE__ */ jsxs21(Box18, { sx: { display: "flex", alignItems: "center", gap: 1, mb: 0.25 }, children: [
|
|
12617
|
+
/* @__PURE__ */ jsx24(
|
|
12618
|
+
Typography17,
|
|
11979
12619
|
{
|
|
11980
12620
|
sx: {
|
|
11981
12621
|
fontSize: "0.9rem",
|
|
@@ -11988,10 +12628,10 @@ var AgentRunRow = ({ run, onClick, sx }) => {
|
|
|
11988
12628
|
children: getRunTitle(run)
|
|
11989
12629
|
}
|
|
11990
12630
|
),
|
|
11991
|
-
/* @__PURE__ */
|
|
12631
|
+
/* @__PURE__ */ jsx24(Box18, { sx: { display: "flex", alignItems: "center", color: cfg.color, flexShrink: 0 }, children: cfg.icon })
|
|
11992
12632
|
] }),
|
|
11993
|
-
/* @__PURE__ */
|
|
11994
|
-
|
|
12633
|
+
/* @__PURE__ */ jsx24(
|
|
12634
|
+
Typography17,
|
|
11995
12635
|
{
|
|
11996
12636
|
sx: {
|
|
11997
12637
|
fontSize: "0.78rem",
|
|
@@ -12003,16 +12643,16 @@ var AgentRunRow = ({ run, onClick, sx }) => {
|
|
|
12003
12643
|
children: getRunSubtitle(run)
|
|
12004
12644
|
}
|
|
12005
12645
|
),
|
|
12006
|
-
/* @__PURE__ */
|
|
12007
|
-
/* @__PURE__ */
|
|
12008
|
-
duration && /* @__PURE__ */
|
|
12009
|
-
/* @__PURE__ */
|
|
12010
|
-
/* @__PURE__ */
|
|
12646
|
+
/* @__PURE__ */ jsxs21(Box18, { sx: { display: "flex", alignItems: "center", gap: 1, mt: 0.5 }, children: [
|
|
12647
|
+
/* @__PURE__ */ jsx24(Typography17, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.7 }, children: run.started_at ? getTimeAgo(run.started_at) : "\u2014" }),
|
|
12648
|
+
duration && /* @__PURE__ */ jsxs21(Fragment8, { children: [
|
|
12649
|
+
/* @__PURE__ */ jsx24(Typography17, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.4 }, children: "\xB7" }),
|
|
12650
|
+
/* @__PURE__ */ jsx24(Typography17, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.7 }, children: duration })
|
|
12011
12651
|
] })
|
|
12012
12652
|
] })
|
|
12013
12653
|
] }),
|
|
12014
|
-
tools.length > 0 && /* @__PURE__ */
|
|
12015
|
-
|
|
12654
|
+
tools.length > 0 && /* @__PURE__ */ jsx24(
|
|
12655
|
+
Box18,
|
|
12016
12656
|
{
|
|
12017
12657
|
sx: {
|
|
12018
12658
|
display: { xs: "none", sm: "flex" },
|
|
@@ -12023,7 +12663,7 @@ var AgentRunRow = ({ run, onClick, sx }) => {
|
|
|
12023
12663
|
maxWidth: 220,
|
|
12024
12664
|
flexShrink: 0
|
|
12025
12665
|
},
|
|
12026
|
-
children: tools.map((t) => /* @__PURE__ */
|
|
12666
|
+
children: tools.map((t) => /* @__PURE__ */ jsx24(Tooltip12, { title: t, arrow: true, children: /* @__PURE__ */ jsx24(
|
|
12027
12667
|
Chip8,
|
|
12028
12668
|
{
|
|
12029
12669
|
label: t,
|
|
@@ -12072,19 +12712,19 @@ var AgentActivityList = ({
|
|
|
12072
12712
|
toolbarSx,
|
|
12073
12713
|
rowSx
|
|
12074
12714
|
}) => {
|
|
12075
|
-
const [runs, setRuns] =
|
|
12076
|
-
const [cursor, setCursor] =
|
|
12077
|
-
const [hasMore, setHasMore] =
|
|
12078
|
-
const [isLoading, setIsLoading] =
|
|
12079
|
-
const [error, setError] =
|
|
12080
|
-
const [statusFilter, setStatusFilter] =
|
|
12081
|
-
const [searchQuery, setSearchQuery] =
|
|
12082
|
-
const [debouncedQuery, setDebouncedQuery] =
|
|
12083
|
-
const [agentWorkflows, setAgentWorkflows] =
|
|
12084
|
-
const [workflowFilter, setWorkflowFilter] =
|
|
12085
|
-
const [stopOpen, setStopOpen] =
|
|
12086
|
-
const [stopLoading, setStopLoading] =
|
|
12087
|
-
const debounceRef =
|
|
12715
|
+
const [runs, setRuns] = useState15([]);
|
|
12716
|
+
const [cursor, setCursor] = useState15("");
|
|
12717
|
+
const [hasMore, setHasMore] = useState15(false);
|
|
12718
|
+
const [isLoading, setIsLoading] = useState15(false);
|
|
12719
|
+
const [error, setError] = useState15(null);
|
|
12720
|
+
const [statusFilter, setStatusFilter] = useState15("");
|
|
12721
|
+
const [searchQuery, setSearchQuery] = useState15("");
|
|
12722
|
+
const [debouncedQuery, setDebouncedQuery] = useState15("");
|
|
12723
|
+
const [agentWorkflows, setAgentWorkflows] = useState15([]);
|
|
12724
|
+
const [workflowFilter, setWorkflowFilter] = useState15("");
|
|
12725
|
+
const [stopOpen, setStopOpen] = useState15(false);
|
|
12726
|
+
const [stopLoading, setStopLoading] = useState15(false);
|
|
12727
|
+
const debounceRef = useRef11();
|
|
12088
12728
|
const selectedAgentWorkflow = agentWorkflows.find((w) => w.id === workflowFilter) || null;
|
|
12089
12729
|
const openEditPrompt = useCallback9(async () => {
|
|
12090
12730
|
if (!workflowFilter) return;
|
|
@@ -12120,7 +12760,7 @@ var AgentActivityList = ({
|
|
|
12120
12760
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
12121
12761
|
debounceRef.current = setTimeout(() => setDebouncedQuery(q), 350);
|
|
12122
12762
|
}, []);
|
|
12123
|
-
|
|
12763
|
+
useEffect14(() => () => {
|
|
12124
12764
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
12125
12765
|
}, []);
|
|
12126
12766
|
const fetchRuns = useCallback9(
|
|
@@ -12152,10 +12792,10 @@ var AgentActivityList = ({
|
|
|
12152
12792
|
},
|
|
12153
12793
|
[statusFilter, limit, apiKey, apiBaseUrl, orgId, workflowFilter]
|
|
12154
12794
|
);
|
|
12155
|
-
|
|
12795
|
+
useEffect14(() => {
|
|
12156
12796
|
fetchRuns(false, "");
|
|
12157
12797
|
}, [statusFilter, apiKey, apiBaseUrl, orgId, workflowFilter]);
|
|
12158
|
-
|
|
12798
|
+
useEffect14(() => {
|
|
12159
12799
|
let cancelled = false;
|
|
12160
12800
|
listAgentScheduleWorkflows({ apiKey, apiBaseUrl, orgId }).then((items) => {
|
|
12161
12801
|
if (!cancelled) setAgentWorkflows(items);
|
|
@@ -12178,14 +12818,14 @@ var AgentActivityList = ({
|
|
|
12178
12818
|
].filter(Boolean).join(" ").toLowerCase();
|
|
12179
12819
|
return hay.includes(debouncedQuery.toLowerCase());
|
|
12180
12820
|
}) : runs;
|
|
12181
|
-
return /* @__PURE__ */
|
|
12182
|
-
|
|
12821
|
+
return /* @__PURE__ */ jsxs21(
|
|
12822
|
+
Box18,
|
|
12183
12823
|
{
|
|
12184
12824
|
className,
|
|
12185
12825
|
sx: [{ display: "flex", flexDirection: "column", gap: 2 }, ...Array.isArray(sx) ? sx : sx ? [sx] : []],
|
|
12186
12826
|
children: [
|
|
12187
|
-
(showSearchBar || showStatusChips) && /* @__PURE__ */
|
|
12188
|
-
/* @__PURE__ */
|
|
12827
|
+
(showSearchBar || showStatusChips) && /* @__PURE__ */ jsxs21(Box18, { sx: [{ display: "flex", alignItems: "center", justifyContent: "center", gap: 1.5, flexWrap: "wrap" }, ...Array.isArray(toolbarSx) ? toolbarSx : toolbarSx ? [toolbarSx] : []], children: [
|
|
12828
|
+
/* @__PURE__ */ jsxs21(
|
|
12189
12829
|
Select3,
|
|
12190
12830
|
{
|
|
12191
12831
|
size: "small",
|
|
@@ -12222,13 +12862,13 @@ var AgentActivityList = ({
|
|
|
12222
12862
|
}
|
|
12223
12863
|
},
|
|
12224
12864
|
children: [
|
|
12225
|
-
/* @__PURE__ */
|
|
12226
|
-
agentWorkflows.map((w) => /* @__PURE__ */
|
|
12865
|
+
/* @__PURE__ */ jsx24(MenuItem3, { value: "", sx: { fontSize: "0.85rem" }, children: "All Agent runs" }),
|
|
12866
|
+
agentWorkflows.map((w) => /* @__PURE__ */ jsx24(MenuItem3, { value: w.id, sx: { fontSize: "0.85rem" }, children: w.name }, w.id))
|
|
12227
12867
|
]
|
|
12228
12868
|
}
|
|
12229
12869
|
),
|
|
12230
|
-
showSearchBar && /* @__PURE__ */
|
|
12231
|
-
|
|
12870
|
+
showSearchBar && /* @__PURE__ */ jsx24(
|
|
12871
|
+
TextField7,
|
|
12232
12872
|
{
|
|
12233
12873
|
placeholder: "Search results...",
|
|
12234
12874
|
size: "small",
|
|
@@ -12236,7 +12876,7 @@ var AgentActivityList = ({
|
|
|
12236
12876
|
onChange: (e) => updateSearchQuery(e.target.value),
|
|
12237
12877
|
slotProps: {
|
|
12238
12878
|
input: {
|
|
12239
|
-
startAdornment: /* @__PURE__ */
|
|
12879
|
+
startAdornment: /* @__PURE__ */ jsx24(InputAdornment, { position: "start", children: /* @__PURE__ */ jsx24(SearchIcon, { size: 18, color: "hsl(var(--muted-foreground))" }) })
|
|
12240
12880
|
}
|
|
12241
12881
|
},
|
|
12242
12882
|
sx: {
|
|
@@ -12256,7 +12896,7 @@ var AgentActivityList = ({
|
|
|
12256
12896
|
}
|
|
12257
12897
|
}
|
|
12258
12898
|
),
|
|
12259
|
-
showStatusChips && /* @__PURE__ */
|
|
12899
|
+
showStatusChips && /* @__PURE__ */ jsx24(
|
|
12260
12900
|
SegmentedControl,
|
|
12261
12901
|
{
|
|
12262
12902
|
size: "sm",
|
|
@@ -12266,10 +12906,10 @@ var AgentActivityList = ({
|
|
|
12266
12906
|
options: STATUS_FILTERS.map((f) => ({ value: f.value, label: f.label }))
|
|
12267
12907
|
}
|
|
12268
12908
|
),
|
|
12269
|
-
isLoading && runs.length > 0 && /* @__PURE__ */
|
|
12909
|
+
isLoading && runs.length > 0 && /* @__PURE__ */ jsx24(CircularProgress5, { size: 16, sx: { color: "hsl(var(--primary))", ml: 0.5 } })
|
|
12270
12910
|
] }),
|
|
12271
|
-
selectedAgentWorkflow && /* @__PURE__ */
|
|
12272
|
-
|
|
12911
|
+
selectedAgentWorkflow && /* @__PURE__ */ jsxs21(
|
|
12912
|
+
Box18,
|
|
12273
12913
|
{
|
|
12274
12914
|
sx: {
|
|
12275
12915
|
display: "flex",
|
|
@@ -12281,15 +12921,15 @@ var AgentActivityList = ({
|
|
|
12281
12921
|
bgcolor: "hsl(var(--card))"
|
|
12282
12922
|
},
|
|
12283
12923
|
children: [
|
|
12284
|
-
/* @__PURE__ */
|
|
12285
|
-
/* @__PURE__ */
|
|
12286
|
-
selectedAgentWorkflow.description && /* @__PURE__ */
|
|
12924
|
+
/* @__PURE__ */ jsxs21(Box18, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
12925
|
+
/* @__PURE__ */ jsx24(Typography17, { sx: { fontSize: "0.85rem", fontWeight: 600, color: "hsl(var(--foreground))", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: selectedAgentWorkflow.name }),
|
|
12926
|
+
selectedAgentWorkflow.description && /* @__PURE__ */ jsx24(Typography17, { sx: { fontSize: "0.75rem", color: "hsl(var(--muted-foreground))", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: selectedAgentWorkflow.description })
|
|
12287
12927
|
] }),
|
|
12288
|
-
/* @__PURE__ */
|
|
12289
|
-
|
|
12928
|
+
/* @__PURE__ */ jsx24(
|
|
12929
|
+
Button10,
|
|
12290
12930
|
{
|
|
12291
12931
|
size: "small",
|
|
12292
|
-
startIcon: /* @__PURE__ */
|
|
12932
|
+
startIcon: /* @__PURE__ */ jsx24(Pencil, { size: 14 }),
|
|
12293
12933
|
onClick: openEditPrompt,
|
|
12294
12934
|
sx: {
|
|
12295
12935
|
height: 36,
|
|
@@ -12304,11 +12944,11 @@ var AgentActivityList = ({
|
|
|
12304
12944
|
children: "Edit"
|
|
12305
12945
|
}
|
|
12306
12946
|
),
|
|
12307
|
-
/* @__PURE__ */
|
|
12308
|
-
|
|
12947
|
+
/* @__PURE__ */ jsx24(
|
|
12948
|
+
Button10,
|
|
12309
12949
|
{
|
|
12310
12950
|
size: "small",
|
|
12311
|
-
startIcon: /* @__PURE__ */
|
|
12951
|
+
startIcon: /* @__PURE__ */ jsx24(StopCircle, { size: 14 }),
|
|
12312
12952
|
onClick: () => setStopOpen(true),
|
|
12313
12953
|
sx: {
|
|
12314
12954
|
height: 36,
|
|
@@ -12326,17 +12966,17 @@ var AgentActivityList = ({
|
|
|
12326
12966
|
]
|
|
12327
12967
|
}
|
|
12328
12968
|
),
|
|
12329
|
-
isLoading && runs.length === 0 ? /* @__PURE__ */
|
|
12330
|
-
/* @__PURE__ */
|
|
12331
|
-
/* @__PURE__ */
|
|
12332
|
-
|
|
12969
|
+
isLoading && runs.length === 0 ? /* @__PURE__ */ jsx24(Box18, { sx: { display: "flex", justifyContent: "center", py: 8 }, children: /* @__PURE__ */ jsx24(CircularProgress5, { size: 28, sx: { color: "hsl(var(--primary))" } }) }) : error ? /* @__PURE__ */ jsxs21(Box18, { sx: { display: "flex", flexDirection: "column", alignItems: "center", textAlign: "center", py: 6 }, children: [
|
|
12970
|
+
/* @__PURE__ */ jsx24(AlertCircle, { size: 28, style: { color: "hsl(var(--severity-critical, 0 72% 55%))", marginBottom: 8 } }),
|
|
12971
|
+
/* @__PURE__ */ jsx24(
|
|
12972
|
+
Typography17,
|
|
12333
12973
|
{
|
|
12334
12974
|
sx: { color: "hsl(var(--severity-critical, 0 72% 55%))", fontSize: "0.9rem", mb: 1 },
|
|
12335
12975
|
children: error
|
|
12336
12976
|
}
|
|
12337
12977
|
),
|
|
12338
|
-
/* @__PURE__ */
|
|
12339
|
-
|
|
12978
|
+
/* @__PURE__ */ jsx24(
|
|
12979
|
+
Button10,
|
|
12340
12980
|
{
|
|
12341
12981
|
size: "small",
|
|
12342
12982
|
onClick: () => fetchRuns(false, ""),
|
|
@@ -12344,24 +12984,24 @@ var AgentActivityList = ({
|
|
|
12344
12984
|
children: "Try again"
|
|
12345
12985
|
}
|
|
12346
12986
|
)
|
|
12347
|
-
] }) : filteredRuns.length === 0 ? /* @__PURE__ */
|
|
12348
|
-
/* @__PURE__ */
|
|
12987
|
+
] }) : filteredRuns.length === 0 ? /* @__PURE__ */ jsxs21(Box18, { sx: { display: "flex", flexDirection: "column", alignItems: "center", textAlign: "center", py: 8 }, children: [
|
|
12988
|
+
/* @__PURE__ */ jsx24(
|
|
12349
12989
|
Activity,
|
|
12350
12990
|
{
|
|
12351
12991
|
size: 40,
|
|
12352
12992
|
style: { color: "hsl(var(--muted-foreground))", marginBottom: 12 }
|
|
12353
12993
|
}
|
|
12354
12994
|
),
|
|
12355
|
-
/* @__PURE__ */
|
|
12356
|
-
/* @__PURE__ */
|
|
12357
|
-
|
|
12995
|
+
/* @__PURE__ */ jsx24(Typography17, { sx: { color: "hsl(var(--muted-foreground))", fontSize: "0.9rem" }, children: emptyTitle }),
|
|
12996
|
+
/* @__PURE__ */ jsx24(
|
|
12997
|
+
Typography17,
|
|
12358
12998
|
{
|
|
12359
12999
|
sx: { color: "hsl(var(--muted-foreground))", fontSize: "0.8rem", mt: 0.5, opacity: 0.7 },
|
|
12360
13000
|
children: emptySubtitle
|
|
12361
13001
|
}
|
|
12362
13002
|
)
|
|
12363
|
-
] }) : /* @__PURE__ */
|
|
12364
|
-
filteredRuns.map((run, idx) => /* @__PURE__ */
|
|
13003
|
+
] }) : /* @__PURE__ */ jsxs21(Box18, { sx: { display: "flex", flexDirection: "column", gap: 1.5 }, children: [
|
|
13004
|
+
filteredRuns.map((run, idx) => /* @__PURE__ */ jsx24(
|
|
12365
13005
|
AgentRunRow,
|
|
12366
13006
|
{
|
|
12367
13007
|
run,
|
|
@@ -12370,43 +13010,43 @@ var AgentActivityList = ({
|
|
|
12370
13010
|
},
|
|
12371
13011
|
run.execution_id || idx
|
|
12372
13012
|
)),
|
|
12373
|
-
hasMore && /* @__PURE__ */
|
|
12374
|
-
|
|
13013
|
+
hasMore && /* @__PURE__ */ jsx24(Box18, { sx: { display: "flex", justifyContent: "center", mt: 1 }, children: /* @__PURE__ */ jsxs21(
|
|
13014
|
+
Button10,
|
|
12375
13015
|
{
|
|
12376
13016
|
size: "small",
|
|
12377
13017
|
onClick: loadMore,
|
|
12378
13018
|
disabled: isLoading,
|
|
12379
13019
|
sx: { color: "hsl(var(--primary))", textTransform: "none", fontSize: "0.8rem" },
|
|
12380
13020
|
children: [
|
|
12381
|
-
isLoading ? /* @__PURE__ */
|
|
13021
|
+
isLoading ? /* @__PURE__ */ jsx24(CircularProgress5, { size: 14, sx: { mr: 1 } }) : null,
|
|
12382
13022
|
"Load more"
|
|
12383
13023
|
]
|
|
12384
13024
|
}
|
|
12385
13025
|
) })
|
|
12386
13026
|
] }),
|
|
12387
|
-
/* @__PURE__ */
|
|
12388
|
-
|
|
13027
|
+
/* @__PURE__ */ jsxs21(
|
|
13028
|
+
Dialog3,
|
|
12389
13029
|
{
|
|
12390
13030
|
open: stopOpen,
|
|
12391
13031
|
onClose: () => stopLoading ? null : setStopOpen(false),
|
|
12392
13032
|
slotProps: { paper: { sx: { bgcolor: "hsl(var(--card))", color: "hsl(var(--foreground))", border: "1px solid hsl(var(--border))" } } },
|
|
12393
13033
|
children: [
|
|
12394
|
-
/* @__PURE__ */
|
|
12395
|
-
/* @__PURE__ */
|
|
13034
|
+
/* @__PURE__ */ jsx24(DialogTitle3, { sx: { fontSize: "1rem", fontWeight: 600 }, children: "Stop schedule?" }),
|
|
13035
|
+
/* @__PURE__ */ jsx24(DialogContent3, { children: /* @__PURE__ */ jsxs21(Typography17, { sx: { fontSize: "0.85rem", color: "hsl(var(--muted-foreground))" }, children: [
|
|
12396
13036
|
'This will stop "',
|
|
12397
13037
|
selectedAgentWorkflow?.name,
|
|
12398
13038
|
'" and delete the scheduled workflow. Past executions remain visible. This cannot be undone.'
|
|
12399
13039
|
] }) }),
|
|
12400
|
-
/* @__PURE__ */
|
|
12401
|
-
/* @__PURE__ */
|
|
12402
|
-
/* @__PURE__ */
|
|
12403
|
-
|
|
13040
|
+
/* @__PURE__ */ jsxs21(DialogActions2, { sx: { px: 3, pb: 2 }, children: [
|
|
13041
|
+
/* @__PURE__ */ jsx24(Button10, { onClick: () => setStopOpen(false), disabled: stopLoading, sx: { textTransform: "none", color: "hsl(var(--muted-foreground))" }, children: "Cancel" }),
|
|
13042
|
+
/* @__PURE__ */ jsxs21(
|
|
13043
|
+
Button10,
|
|
12404
13044
|
{
|
|
12405
13045
|
onClick: confirmStop,
|
|
12406
13046
|
disabled: stopLoading,
|
|
12407
13047
|
sx: { textTransform: "none", bgcolor: "hsl(var(--severity-critical, 0 72% 55%))", color: "hsl(var(--primary-foreground))", "&:hover": { bgcolor: "hsla(var(--severity-critical, 0 72% 55%) / 0.9)" } },
|
|
12408
13048
|
children: [
|
|
12409
|
-
stopLoading ? /* @__PURE__ */
|
|
13049
|
+
stopLoading ? /* @__PURE__ */ jsx24(CircularProgress5, { size: 16, sx: { color: "hsl(var(--primary-foreground))", mr: 1 } }) : null,
|
|
12410
13050
|
"Stop schedule"
|
|
12411
13051
|
]
|
|
12412
13052
|
}
|
|
@@ -12422,12 +13062,12 @@ var AgentActivityList = ({
|
|
|
12422
13062
|
var AgentActivityList_default = AgentActivityList;
|
|
12423
13063
|
|
|
12424
13064
|
// components/AgentExecutionDrawer.tsx
|
|
12425
|
-
import { Box as
|
|
13065
|
+
import { Box as Box19, Drawer as Drawer4, IconButton as IconButton10, Tooltip as Tooltip13, Typography as Typography18 } from "@mui/material";
|
|
12426
13066
|
import {
|
|
12427
13067
|
X as CloseIcon7,
|
|
12428
13068
|
ExternalLink as OpenInNewIcon3
|
|
12429
13069
|
} from "lucide-react";
|
|
12430
|
-
import { Fragment as Fragment9, jsx as
|
|
13070
|
+
import { Fragment as Fragment9, jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
12431
13071
|
var AgentExecutionDrawer = ({
|
|
12432
13072
|
open,
|
|
12433
13073
|
onClose,
|
|
@@ -12441,12 +13081,15 @@ var AgentExecutionDrawer = ({
|
|
|
12441
13081
|
headerSx,
|
|
12442
13082
|
bodySx,
|
|
12443
13083
|
topBanner,
|
|
12444
|
-
onSchedule
|
|
13084
|
+
onSchedule,
|
|
13085
|
+
theme,
|
|
13086
|
+
colorMode
|
|
12445
13087
|
}) => {
|
|
13088
|
+
const themeScope = useShuffleMcpTheme();
|
|
12446
13089
|
const statusKey = (run?.status || "").toUpperCase();
|
|
12447
13090
|
const cfg = STATUS_CONFIG[statusKey] || STATUS_CONFIG.WAITING;
|
|
12448
13091
|
const duration = run ? formatDuration(run) : "";
|
|
12449
|
-
return /* @__PURE__ */
|
|
13092
|
+
return /* @__PURE__ */ jsxs22(
|
|
12450
13093
|
Drawer4,
|
|
12451
13094
|
{
|
|
12452
13095
|
anchor: "right",
|
|
@@ -12454,7 +13097,7 @@ var AgentExecutionDrawer = ({
|
|
|
12454
13097
|
onClose,
|
|
12455
13098
|
slotProps: {
|
|
12456
13099
|
paper: {
|
|
12457
|
-
className,
|
|
13100
|
+
className: [themeScope?.scopeClassName, className].filter(Boolean).join(" ") || void 0,
|
|
12458
13101
|
sx: [
|
|
12459
13102
|
{
|
|
12460
13103
|
width: { xs: "100%", sm: width },
|
|
@@ -12469,8 +13112,8 @@ var AgentExecutionDrawer = ({
|
|
|
12469
13112
|
}
|
|
12470
13113
|
},
|
|
12471
13114
|
children: [
|
|
12472
|
-
/* @__PURE__ */
|
|
12473
|
-
|
|
13115
|
+
/* @__PURE__ */ jsxs22(
|
|
13116
|
+
Box19,
|
|
12474
13117
|
{
|
|
12475
13118
|
sx: [
|
|
12476
13119
|
{
|
|
@@ -12488,8 +13131,8 @@ var AgentExecutionDrawer = ({
|
|
|
12488
13131
|
...Array.isArray(headerSx) ? headerSx : headerSx ? [headerSx] : []
|
|
12489
13132
|
],
|
|
12490
13133
|
children: [
|
|
12491
|
-
/* @__PURE__ */
|
|
12492
|
-
|
|
13134
|
+
/* @__PURE__ */ jsx25(
|
|
13135
|
+
Box19,
|
|
12493
13136
|
{
|
|
12494
13137
|
sx: {
|
|
12495
13138
|
width: 36,
|
|
@@ -12502,13 +13145,13 @@ var AgentExecutionDrawer = ({
|
|
|
12502
13145
|
color: "hsl(var(--primary))",
|
|
12503
13146
|
flexShrink: 0
|
|
12504
13147
|
},
|
|
12505
|
-
children: /* @__PURE__ */
|
|
13148
|
+
children: /* @__PURE__ */ jsx25(AgentIcon_default, { size: 20 })
|
|
12506
13149
|
}
|
|
12507
13150
|
),
|
|
12508
|
-
/* @__PURE__ */
|
|
12509
|
-
/* @__PURE__ */
|
|
12510
|
-
/* @__PURE__ */
|
|
12511
|
-
|
|
13151
|
+
/* @__PURE__ */ jsxs22(Box19, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
13152
|
+
/* @__PURE__ */ jsxs22(Box19, { sx: { display: "flex", alignItems: "center", gap: 1, minWidth: 0 }, children: [
|
|
13153
|
+
/* @__PURE__ */ jsx25(
|
|
13154
|
+
Typography18,
|
|
12512
13155
|
{
|
|
12513
13156
|
sx: {
|
|
12514
13157
|
fontSize: "0.95rem",
|
|
@@ -12521,21 +13164,21 @@ var AgentExecutionDrawer = ({
|
|
|
12521
13164
|
children: run ? getRunTitle(run) : "Agent execution"
|
|
12522
13165
|
}
|
|
12523
13166
|
),
|
|
12524
|
-
run && /* @__PURE__ */
|
|
13167
|
+
run && /* @__PURE__ */ jsx25(Box19, { sx: { display: "flex", alignItems: "center", color: cfg.color, flexShrink: 0 }, children: cfg.icon })
|
|
12525
13168
|
] }),
|
|
12526
|
-
run && /* @__PURE__ */
|
|
12527
|
-
/* @__PURE__ */
|
|
12528
|
-
run.started_at && /* @__PURE__ */
|
|
12529
|
-
/* @__PURE__ */
|
|
12530
|
-
/* @__PURE__ */
|
|
13169
|
+
run && /* @__PURE__ */ jsxs22(Box19, { sx: { display: "flex", alignItems: "center", gap: 1, mt: 0.25 }, children: [
|
|
13170
|
+
/* @__PURE__ */ jsx25(Typography18, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))" }, children: cfg.label }),
|
|
13171
|
+
run.started_at && /* @__PURE__ */ jsxs22(Fragment9, { children: [
|
|
13172
|
+
/* @__PURE__ */ jsx25(Typography18, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.4 }, children: "\xB7" }),
|
|
13173
|
+
/* @__PURE__ */ jsx25(Typography18, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))" }, children: getTimeAgo(run.started_at) })
|
|
12531
13174
|
] }),
|
|
12532
|
-
duration && /* @__PURE__ */
|
|
12533
|
-
/* @__PURE__ */
|
|
12534
|
-
/* @__PURE__ */
|
|
13175
|
+
duration && /* @__PURE__ */ jsxs22(Fragment9, { children: [
|
|
13176
|
+
/* @__PURE__ */ jsx25(Typography18, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.4 }, children: "\xB7" }),
|
|
13177
|
+
/* @__PURE__ */ jsx25(Typography18, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))" }, children: duration })
|
|
12535
13178
|
] })
|
|
12536
13179
|
] })
|
|
12537
13180
|
] }),
|
|
12538
|
-
run?.execution_id && /* @__PURE__ */
|
|
13181
|
+
run?.execution_id && /* @__PURE__ */ jsx25(Tooltip13, { title: "Open in new tab", children: /* @__PURE__ */ jsx25(
|
|
12539
13182
|
IconButton10,
|
|
12540
13183
|
{
|
|
12541
13184
|
component: "a",
|
|
@@ -12547,10 +13190,10 @@ var AgentExecutionDrawer = ({
|
|
|
12547
13190
|
color: "hsl(var(--muted-foreground))",
|
|
12548
13191
|
"&:hover": { color: "hsl(var(--foreground))", bgcolor: "hsl(var(--muted))" }
|
|
12549
13192
|
},
|
|
12550
|
-
children: /* @__PURE__ */
|
|
13193
|
+
children: /* @__PURE__ */ jsx25(OpenInNewIcon3, { size: 16 })
|
|
12551
13194
|
}
|
|
12552
13195
|
) }),
|
|
12553
|
-
/* @__PURE__ */
|
|
13196
|
+
/* @__PURE__ */ jsx25(Tooltip13, { title: "Close", children: /* @__PURE__ */ jsx25(
|
|
12554
13197
|
IconButton10,
|
|
12555
13198
|
{
|
|
12556
13199
|
onClick: onClose,
|
|
@@ -12559,15 +13202,15 @@ var AgentExecutionDrawer = ({
|
|
|
12559
13202
|
color: "hsl(var(--muted-foreground))",
|
|
12560
13203
|
"&:hover": { color: "hsl(var(--foreground))", bgcolor: "hsl(var(--muted))" }
|
|
12561
13204
|
},
|
|
12562
|
-
children: /* @__PURE__ */
|
|
13205
|
+
children: /* @__PURE__ */ jsx25(CloseIcon7, { size: 16 })
|
|
12563
13206
|
}
|
|
12564
13207
|
) })
|
|
12565
13208
|
]
|
|
12566
13209
|
}
|
|
12567
13210
|
),
|
|
12568
|
-
/* @__PURE__ */
|
|
13211
|
+
/* @__PURE__ */ jsxs22(Box19, { sx: [{ flex: 1, overflowY: "auto", pt: 3 }, ...Array.isArray(bodySx) ? bodySx : bodySx ? [bodySx] : []], children: [
|
|
12569
13212
|
topBanner,
|
|
12570
|
-
run ? /* @__PURE__ */
|
|
13213
|
+
run ? /* @__PURE__ */ jsx25(
|
|
12571
13214
|
AgentUI_default,
|
|
12572
13215
|
{
|
|
12573
13216
|
initialExecution: {
|
|
@@ -12590,7 +13233,9 @@ var AgentExecutionDrawer = ({
|
|
|
12590
13233
|
apiKey,
|
|
12591
13234
|
apiBaseUrl,
|
|
12592
13235
|
orgId,
|
|
12593
|
-
onSchedule
|
|
13236
|
+
onSchedule,
|
|
13237
|
+
theme,
|
|
13238
|
+
colorMode
|
|
12594
13239
|
},
|
|
12595
13240
|
run.execution_id
|
|
12596
13241
|
) : null
|
|
@@ -12602,9 +13247,9 @@ var AgentExecutionDrawer = ({
|
|
|
12602
13247
|
var AgentExecutionDrawer_default = AgentExecutionDrawer;
|
|
12603
13248
|
|
|
12604
13249
|
// views/AgentsView.tsx
|
|
12605
|
-
import { useCallback as useCallback10, useMemo as
|
|
12606
|
-
import { Box as
|
|
12607
|
-
import { jsx as
|
|
13250
|
+
import { useCallback as useCallback10, useMemo as useMemo8, useState as useState16 } from "react";
|
|
13251
|
+
import { Box as Box20, Stack, Typography as Typography19 } from "@mui/material";
|
|
13252
|
+
import { jsx as jsx26, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
12608
13253
|
var AgentsView = ({
|
|
12609
13254
|
onSchedule,
|
|
12610
13255
|
maxWidth = 820,
|
|
@@ -12616,36 +13261,47 @@ var AgentsView = ({
|
|
|
12616
13261
|
isLoaded,
|
|
12617
13262
|
isLoggedIn,
|
|
12618
13263
|
userdata,
|
|
12619
|
-
serverside
|
|
13264
|
+
serverside,
|
|
13265
|
+
theme,
|
|
13266
|
+
colorMode,
|
|
13267
|
+
apiKey,
|
|
13268
|
+
orgId
|
|
12620
13269
|
}) => {
|
|
12621
13270
|
useSyncHostBaseUrl(globalUrl);
|
|
12622
|
-
const [selectedRun, setSelectedRun] =
|
|
12623
|
-
const [agentView, setAgentView] =
|
|
12624
|
-
const [prefill, setPrefill] =
|
|
13271
|
+
const [selectedRun, setSelectedRun] = useState16(null);
|
|
13272
|
+
const [agentView, setAgentView] = useState16("start");
|
|
13273
|
+
const [prefill, setPrefill] = useState16({
|
|
12625
13274
|
input: "",
|
|
12626
13275
|
apps: [],
|
|
12627
13276
|
key: 0
|
|
12628
13277
|
});
|
|
12629
|
-
const [editing, setEditing] =
|
|
12630
|
-
const [builtInDrawer, setBuiltInDrawer] =
|
|
13278
|
+
const [editing, setEditing] = useState16(null);
|
|
13279
|
+
const [builtInDrawer, setBuiltInDrawer] = useState16({
|
|
12631
13280
|
open: false,
|
|
12632
13281
|
tab: "localLLM"
|
|
12633
13282
|
});
|
|
12634
|
-
const
|
|
12635
|
-
() =>
|
|
12636
|
-
|
|
12637
|
-
|
|
12638
|
-
|
|
12639
|
-
|
|
12640
|
-
|
|
12641
|
-
|
|
12642
|
-
|
|
12643
|
-
|
|
12644
|
-
|
|
12645
|
-
|
|
12646
|
-
|
|
12647
|
-
|
|
12648
|
-
|
|
13283
|
+
const effectiveSchedule = useCallback10(
|
|
13284
|
+
async (info) => {
|
|
13285
|
+
if (onSchedule) return onSchedule(info);
|
|
13286
|
+
await scheduleAgentRun({ ...info, apiKey, apiBaseUrl: globalUrl, orgId });
|
|
13287
|
+
},
|
|
13288
|
+
[onSchedule, apiKey, globalUrl, orgId]
|
|
13289
|
+
);
|
|
13290
|
+
const effectiveLocalLLMSlot = useMemo8(
|
|
13291
|
+
() => localLLMSlot ?? /* @__PURE__ */ jsx26(
|
|
13292
|
+
LocalLLMConfig_default,
|
|
13293
|
+
{
|
|
13294
|
+
compact: true,
|
|
13295
|
+
globalUrl,
|
|
13296
|
+
userdata,
|
|
13297
|
+
isLoaded,
|
|
13298
|
+
isLoggedIn,
|
|
13299
|
+
serverside,
|
|
13300
|
+
theme,
|
|
13301
|
+
colorMode
|
|
13302
|
+
}
|
|
13303
|
+
),
|
|
13304
|
+
[localLLMSlot, globalUrl, userdata, isLoaded, isLoggedIn, serverside, theme, colorMode]
|
|
12649
13305
|
);
|
|
12650
13306
|
const handleChooseLLM = useCallback10(() => {
|
|
12651
13307
|
if (onChooseLLM) {
|
|
@@ -12686,10 +13342,10 @@ var AgentsView = ({
|
|
|
12686
13342
|
},
|
|
12687
13343
|
[editing]
|
|
12688
13344
|
);
|
|
12689
|
-
return /* @__PURE__ */
|
|
12690
|
-
/* @__PURE__ */
|
|
12691
|
-
editing && /* @__PURE__ */
|
|
12692
|
-
|
|
13345
|
+
return /* @__PURE__ */ jsxs23(Box20, { sx: { minHeight: "100%", width: "100%", px: { xs: 2, md: 4 }, pt: { xs: 3, md: "5vh" }, pb: 6, boxSizing: "border-box" }, children: [
|
|
13346
|
+
/* @__PURE__ */ jsxs23(Stack, { spacing: 6, sx: { maxWidth, mx: "auto", width: "100%" }, children: [
|
|
13347
|
+
editing && /* @__PURE__ */ jsxs23(
|
|
13348
|
+
Box20,
|
|
12693
13349
|
{
|
|
12694
13350
|
sx: {
|
|
12695
13351
|
display: "flex",
|
|
@@ -12702,12 +13358,12 @@ var AgentsView = ({
|
|
|
12702
13358
|
bgcolor: "hsl(var(--primary) / 0.08)"
|
|
12703
13359
|
},
|
|
12704
13360
|
children: [
|
|
12705
|
-
/* @__PURE__ */
|
|
13361
|
+
/* @__PURE__ */ jsxs23(Typography19, { sx: { fontSize: "0.85rem", color: "hsl(var(--foreground))" }, children: [
|
|
12706
13362
|
"Editing schedule: ",
|
|
12707
|
-
/* @__PURE__ */
|
|
13363
|
+
/* @__PURE__ */ jsx26("strong", { children: editing.name })
|
|
12708
13364
|
] }),
|
|
12709
|
-
/* @__PURE__ */
|
|
12710
|
-
|
|
13365
|
+
/* @__PURE__ */ jsx26(
|
|
13366
|
+
Typography19,
|
|
12711
13367
|
{
|
|
12712
13368
|
component: "button",
|
|
12713
13369
|
onClick: () => {
|
|
@@ -12727,13 +13383,15 @@ var AgentsView = ({
|
|
|
12727
13383
|
]
|
|
12728
13384
|
}
|
|
12729
13385
|
),
|
|
12730
|
-
/* @__PURE__ */
|
|
13386
|
+
/* @__PURE__ */ jsx26(
|
|
12731
13387
|
AgentUI_default,
|
|
12732
13388
|
{
|
|
12733
13389
|
maxWidth,
|
|
12734
13390
|
apiBaseUrl: globalUrl,
|
|
12735
13391
|
onViewChange: setAgentView,
|
|
12736
|
-
onSchedule,
|
|
13392
|
+
onSchedule: effectiveSchedule,
|
|
13393
|
+
apiKey,
|
|
13394
|
+
orgId,
|
|
12737
13395
|
onChooseLLM: handleChooseLLM,
|
|
12738
13396
|
hideChooseLLM,
|
|
12739
13397
|
defaultInput: prefill.input,
|
|
@@ -12742,30 +13400,38 @@ var AgentsView = ({
|
|
|
12742
13400
|
submitLabel: editing ? "Save" : void 0,
|
|
12743
13401
|
submitTooltip: editing ? "\u2318+Enter to save" : void 0,
|
|
12744
13402
|
disableSchedule: Boolean(editing),
|
|
12745
|
-
disableScheduleTooltip: editing ? "Scheduling is disabled while editing an existing schedule" : void 0
|
|
13403
|
+
disableScheduleTooltip: editing ? "Scheduling is disabled while editing an existing schedule" : void 0,
|
|
13404
|
+
theme,
|
|
13405
|
+
colorMode
|
|
12746
13406
|
},
|
|
12747
13407
|
prefill.key
|
|
12748
13408
|
),
|
|
12749
|
-
agentView === "start" && /* @__PURE__ */
|
|
13409
|
+
agentView === "start" && /* @__PURE__ */ jsx26(Box20, { sx: { pt: { xs: 4, md: "8vh" } }, children: /* @__PURE__ */ jsx26(
|
|
12750
13410
|
AgentActivityList_default,
|
|
12751
13411
|
{
|
|
12752
13412
|
apiBaseUrl: globalUrl,
|
|
13413
|
+
apiKey,
|
|
13414
|
+
orgId,
|
|
12753
13415
|
onRunClick: setSelectedRun,
|
|
12754
13416
|
onEditWorkflow: handleEditWorkflow
|
|
12755
13417
|
}
|
|
12756
13418
|
) })
|
|
12757
13419
|
] }),
|
|
12758
|
-
/* @__PURE__ */
|
|
13420
|
+
/* @__PURE__ */ jsx26(
|
|
12759
13421
|
AgentExecutionDrawer_default,
|
|
12760
13422
|
{
|
|
12761
13423
|
open: selectedRun !== null,
|
|
12762
13424
|
onClose: () => setSelectedRun(null),
|
|
12763
13425
|
run: selectedRun,
|
|
12764
13426
|
apiBaseUrl: globalUrl,
|
|
12765
|
-
onSchedule
|
|
13427
|
+
onSchedule: effectiveSchedule,
|
|
13428
|
+
apiKey,
|
|
13429
|
+
orgId,
|
|
13430
|
+
theme,
|
|
13431
|
+
colorMode
|
|
12766
13432
|
}
|
|
12767
13433
|
),
|
|
12768
|
-
/* @__PURE__ */
|
|
13434
|
+
/* @__PURE__ */ jsx26(
|
|
12769
13435
|
AgentRunDrawer_default,
|
|
12770
13436
|
{
|
|
12771
13437
|
open: builtInDrawer.open,
|
|
@@ -12774,7 +13440,9 @@ var AgentsView = ({
|
|
|
12774
13440
|
globalUrl,
|
|
12775
13441
|
localLLMSlot: effectiveLocalLLMSlot,
|
|
12776
13442
|
permissionsSlot,
|
|
12777
|
-
|
|
13443
|
+
theme,
|
|
13444
|
+
colorMode,
|
|
13445
|
+
agentUIProps: { onSchedule: effectiveSchedule, apiBaseUrl: globalUrl, apiKey, orgId, theme, colorMode }
|
|
12778
13446
|
}
|
|
12779
13447
|
)
|
|
12780
13448
|
] });
|
|
@@ -12782,12 +13450,12 @@ var AgentsView = ({
|
|
|
12782
13450
|
var AgentsView_default = AgentsView;
|
|
12783
13451
|
|
|
12784
13452
|
// useAppLookup.ts
|
|
12785
|
-
import { useEffect as
|
|
13453
|
+
import { useEffect as useEffect15, useMemo as useMemo9, useState as useState17 } from "react";
|
|
12786
13454
|
var norm3 = (s) => s.toLowerCase().replace(/[\s_\-]+/g, "_");
|
|
12787
13455
|
function useAppLookup(appName) {
|
|
12788
|
-
const [loading, setLoading] =
|
|
12789
|
-
const [info, setInfo] =
|
|
12790
|
-
const [algoliaId, setAlgoliaId] =
|
|
13456
|
+
const [loading, setLoading] = useState17(false);
|
|
13457
|
+
const [info, setInfo] = useState17(null);
|
|
13458
|
+
const [algoliaId, setAlgoliaId] = useState17(null);
|
|
12791
13459
|
const {
|
|
12792
13460
|
authStates,
|
|
12793
13461
|
authenticatedApps,
|
|
@@ -12796,7 +13464,7 @@ function useAppLookup(appName) {
|
|
|
12796
13464
|
handleSaveAuth,
|
|
12797
13465
|
refreshAuth
|
|
12798
13466
|
} = useAppAuth();
|
|
12799
|
-
|
|
13467
|
+
useEffect15(() => {
|
|
12800
13468
|
if (!appName) {
|
|
12801
13469
|
setInfo(null);
|
|
12802
13470
|
setAlgoliaId(null);
|
|
@@ -12875,13 +13543,13 @@ function useAppLookup(appName) {
|
|
|
12875
13543
|
setLoading(false);
|
|
12876
13544
|
})();
|
|
12877
13545
|
}, [appName]);
|
|
12878
|
-
const matchingEntries =
|
|
13546
|
+
const matchingEntries = useMemo9(() => {
|
|
12879
13547
|
if (!appName) return [];
|
|
12880
13548
|
return authenticatedApps.filter(
|
|
12881
13549
|
(auth) => auth.app?.name && norm3(auth.app.name) === norm3(appName)
|
|
12882
13550
|
);
|
|
12883
13551
|
}, [appName, authenticatedApps]);
|
|
12884
|
-
const image =
|
|
13552
|
+
const image = useMemo9(() => {
|
|
12885
13553
|
if (info?.image) return info.image;
|
|
12886
13554
|
for (const entry of matchingEntries) {
|
|
12887
13555
|
const img = entry.app?.large_image || entry.large_image;
|
|
@@ -12889,7 +13557,7 @@ function useAppLookup(appName) {
|
|
|
12889
13557
|
}
|
|
12890
13558
|
return "";
|
|
12891
13559
|
}, [info, matchingEntries]);
|
|
12892
|
-
const algoliaApp =
|
|
13560
|
+
const algoliaApp = useMemo9(() => {
|
|
12893
13561
|
if (!appName) return null;
|
|
12894
13562
|
return {
|
|
12895
13563
|
objectID: algoliaId || appName,
|
|
@@ -12920,97 +13588,18 @@ function useAppLookup(appName) {
|
|
|
12920
13588
|
};
|
|
12921
13589
|
}
|
|
12922
13590
|
|
|
12923
|
-
// components/UsageBar.tsx
|
|
12924
|
-
import { Box as Box19, Typography as Typography18, Tooltip as Tooltip13 } from "@mui/material";
|
|
12925
|
-
import { jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
12926
|
-
var fmt = (n) => n.toLocaleString();
|
|
12927
|
-
var UsageBar = ({
|
|
12928
|
-
label,
|
|
12929
|
-
usage,
|
|
12930
|
-
limit,
|
|
12931
|
-
unit,
|
|
12932
|
-
hint,
|
|
12933
|
-
actionLabel,
|
|
12934
|
-
actionHref
|
|
12935
|
-
}) => {
|
|
12936
|
-
const safeLimit = Math.max(limit, 0);
|
|
12937
|
-
const pct = safeLimit > 0 ? usage / safeLimit * 100 : 0;
|
|
12938
|
-
const isOver = pct >= 100;
|
|
12939
|
-
const isWarn = pct >= 65 && !isOver;
|
|
12940
|
-
const accent = isOver ? "hsl(var(--destructive))" : isWarn ? "hsl(var(--severity-medium))" : "hsl(var(--muted-foreground))";
|
|
12941
|
-
const tooltipText = safeLimit > 0 ? `${pct.toFixed(0)}% used \xB7 ${fmt(usage)} / ${fmt(safeLimit)}${unit ? " " + unit : ""}${hint ? " \xB7 " + hint : ""}` : `${fmt(usage)}${unit ? " " + unit : ""}${hint ? " \xB7 " + hint : ""}`;
|
|
12942
|
-
return /* @__PURE__ */ jsx25(Tooltip13, { title: tooltipText, placement: "top", arrow: true, children: /* @__PURE__ */ jsxs22(Box19, { sx: { display: "flex", flexDirection: "column", gap: 0.5, py: 0.25 }, children: [
|
|
12943
|
-
/* @__PURE__ */ jsxs22(Box19, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 1 }, children: [
|
|
12944
|
-
/* @__PURE__ */ jsx25(
|
|
12945
|
-
Typography18,
|
|
12946
|
-
{
|
|
12947
|
-
sx: {
|
|
12948
|
-
fontSize: "12.8px",
|
|
12949
|
-
fontWeight: 500,
|
|
12950
|
-
color: "hsl(var(--muted-foreground))",
|
|
12951
|
-
lineHeight: 1.2
|
|
12952
|
-
},
|
|
12953
|
-
children: label
|
|
12954
|
-
}
|
|
12955
|
-
),
|
|
12956
|
-
/* @__PURE__ */ jsxs22(Box19, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
12957
|
-
actionLabel && actionHref && (isWarn || isOver) && /* @__PURE__ */ jsx25(
|
|
12958
|
-
Box19,
|
|
12959
|
-
{
|
|
12960
|
-
component: "a",
|
|
12961
|
-
href: actionHref,
|
|
12962
|
-
target: "_blank",
|
|
12963
|
-
rel: "noopener noreferrer",
|
|
12964
|
-
sx: {
|
|
12965
|
-
fontSize: "12.8px",
|
|
12966
|
-
fontWeight: 600,
|
|
12967
|
-
color: accent,
|
|
12968
|
-
textDecoration: "none",
|
|
12969
|
-
"&:hover": { textDecoration: "underline" }
|
|
12970
|
-
},
|
|
12971
|
-
children: actionLabel
|
|
12972
|
-
}
|
|
12973
|
-
),
|
|
12974
|
-
/* @__PURE__ */ jsx25(
|
|
12975
|
-
Typography18,
|
|
12976
|
-
{
|
|
12977
|
-
sx: {
|
|
12978
|
-
fontSize: "12.8px",
|
|
12979
|
-
fontWeight: 500,
|
|
12980
|
-
color: accent,
|
|
12981
|
-
whiteSpace: "nowrap",
|
|
12982
|
-
fontVariantNumeric: "tabular-nums"
|
|
12983
|
-
},
|
|
12984
|
-
children: safeLimit > 0 ? `${fmt(usage)} / ${fmt(safeLimit)}${unit ? " " + unit : ""}` : `${fmt(usage)}${unit ? " " + unit : ""}`
|
|
12985
|
-
}
|
|
12986
|
-
)
|
|
12987
|
-
] })
|
|
12988
|
-
] }),
|
|
12989
|
-
/* @__PURE__ */ jsx25(Box19, { sx: { width: "100%", height: 2, bgcolor: "hsl(var(--muted) / 0.5)", borderRadius: 1, overflow: "hidden" }, children: /* @__PURE__ */ jsx25(
|
|
12990
|
-
Box19,
|
|
12991
|
-
{
|
|
12992
|
-
sx: {
|
|
12993
|
-
width: `${Math.min(Math.max(pct, 0), 100)}%`,
|
|
12994
|
-
height: "100%",
|
|
12995
|
-
bgcolor: isOver ? "hsl(var(--destructive))" : isWarn ? "hsl(var(--severity-medium))" : "hsl(var(--severity-low, 142 71% 45%))",
|
|
12996
|
-
transition: "width 0.3s ease"
|
|
12997
|
-
}
|
|
12998
|
-
}
|
|
12999
|
-
) })
|
|
13000
|
-
] }) });
|
|
13001
|
-
};
|
|
13002
|
-
|
|
13003
13591
|
// index.ts
|
|
13004
13592
|
var resolveMode = (theme, colorMode) => {
|
|
13005
13593
|
if (theme === "light" || theme === "dark") return theme;
|
|
13006
13594
|
if (theme === "system") return "auto";
|
|
13007
|
-
|
|
13595
|
+
if (colorMode) return colorMode;
|
|
13596
|
+
return "dark";
|
|
13008
13597
|
};
|
|
13009
13598
|
var withMcpTheme = (Inner, displayName) => {
|
|
13010
13599
|
const Wrapped = ({ theme, colorMode, ...rest }) => React5.createElement(
|
|
13011
13600
|
ShuffleMcpThemeProvider,
|
|
13012
13601
|
{ mode: resolveMode(theme, colorMode) },
|
|
13013
|
-
React5.createElement(Inner, { ...rest })
|
|
13602
|
+
React5.createElement(Inner, { ...rest, theme, colorMode })
|
|
13014
13603
|
);
|
|
13015
13604
|
Wrapped.displayName = `ShuffleMCPs(${displayName})`;
|
|
13016
13605
|
return Wrapped;
|
|
@@ -13020,7 +13609,7 @@ var withMcpThemeRef = (Inner, displayName) => {
|
|
|
13020
13609
|
({ theme, colorMode, ...rest }, ref) => React5.createElement(
|
|
13021
13610
|
ShuffleMcpThemeProvider,
|
|
13022
13611
|
{ mode: resolveMode(theme, colorMode) },
|
|
13023
|
-
React5.createElement(Inner, { ...rest, ref })
|
|
13612
|
+
React5.createElement(Inner, { ...rest, theme, colorMode, ref })
|
|
13024
13613
|
)
|
|
13025
13614
|
);
|
|
13026
13615
|
Wrapped.displayName = `ShuffleMCPs(${displayName})`;
|
|
@@ -13042,6 +13631,7 @@ var AgentActivityList2 = withMcpTheme(AgentActivityList_default, "AgentActivityL
|
|
|
13042
13631
|
var AgentExecutionDrawer2 = withMcpTheme(AgentExecutionDrawer_default, "AgentExecutionDrawer");
|
|
13043
13632
|
var AgentsView2 = withMcpTheme(AgentsView_default, "AgentsView");
|
|
13044
13633
|
var AgentRunDiagnosisBanner2 = withMcpTheme(AgentRunDiagnosisBanner_default, "AgentRunDiagnosisBanner");
|
|
13634
|
+
var LocalLLMConfig2 = withMcpTheme(LocalLLMConfig_default, "LocalLLMConfig");
|
|
13045
13635
|
export {
|
|
13046
13636
|
API_CONFIG,
|
|
13047
13637
|
AgentActivityList2 as AgentActivityList,
|
|
@@ -13067,6 +13657,7 @@ export {
|
|
|
13067
13657
|
FORWARD_TICKETS_WORKFLOW_NAME,
|
|
13068
13658
|
INGEST_TICKETS_WORKFLOW_NAME,
|
|
13069
13659
|
IntegrationStatus,
|
|
13660
|
+
LocalLLMConfig2 as LocalLLMConfig,
|
|
13070
13661
|
SIEM_PATTERNS,
|
|
13071
13662
|
ShuffleMCP2 as ShuffleMCP,
|
|
13072
13663
|
ShuffleMcpThemeProvider,
|
|
@@ -13113,6 +13704,7 @@ export {
|
|
|
13113
13704
|
resetRegionUrl,
|
|
13114
13705
|
resolveApp,
|
|
13115
13706
|
resolveApps,
|
|
13707
|
+
scheduleAgentRun,
|
|
13116
13708
|
searchAgentActivity,
|
|
13117
13709
|
seedResolvedApp,
|
|
13118
13710
|
setDatastoreItem,
|