@shuffleio/shuffle-mcps 0.0.23 → 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 +59 -8
- package/dist/index.d.ts +59 -8
- package/dist/index.js +886 -348
- package/dist/index.mjs +881 -333
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -385,6 +385,7 @@ __export(index_exports, {
|
|
|
385
385
|
FORWARD_TICKETS_WORKFLOW_NAME: () => FORWARD_TICKETS_WORKFLOW_NAME,
|
|
386
386
|
INGEST_TICKETS_WORKFLOW_NAME: () => INGEST_TICKETS_WORKFLOW_NAME,
|
|
387
387
|
IntegrationStatus: () => IntegrationStatus,
|
|
388
|
+
LocalLLMConfig: () => LocalLLMConfig2,
|
|
388
389
|
SIEM_PATTERNS: () => SIEM_PATTERNS,
|
|
389
390
|
ShuffleMCP: () => ShuffleMCP2,
|
|
390
391
|
ShuffleMcpThemeProvider: () => ShuffleMcpThemeProvider,
|
|
@@ -431,6 +432,7 @@ __export(index_exports, {
|
|
|
431
432
|
resetRegionUrl: () => resetRegionUrl,
|
|
432
433
|
resolveApp: () => resolveApp,
|
|
433
434
|
resolveApps: () => resolveApps,
|
|
435
|
+
scheduleAgentRun: () => scheduleAgentRun,
|
|
434
436
|
searchAgentActivity: () => searchAgentActivity,
|
|
435
437
|
seedResolvedApp: () => seedResolvedApp,
|
|
436
438
|
setDatastoreItem: () => setDatastoreItem,
|
|
@@ -449,7 +451,7 @@ __export(index_exports, {
|
|
|
449
451
|
});
|
|
450
452
|
module.exports = __toCommonJS(index_exports);
|
|
451
453
|
var import_shuffle_mcp2 = require("./shuffle-mcp-ER33P3W2.css");
|
|
452
|
-
var
|
|
454
|
+
var import_react22 = __toESM(require("react"));
|
|
453
455
|
|
|
454
456
|
// ShuffleMcpThemeProvider.tsx
|
|
455
457
|
var import_react = __toESM(require("react"));
|
|
@@ -4204,7 +4206,14 @@ function AppAuthSection({
|
|
|
4204
4206
|
onAuthChange,
|
|
4205
4207
|
onTestConnection,
|
|
4206
4208
|
onSaveAuth,
|
|
4207
|
-
onRefreshAuth
|
|
4209
|
+
onRefreshAuth,
|
|
4210
|
+
globalUrl,
|
|
4211
|
+
userdata,
|
|
4212
|
+
isLoaded,
|
|
4213
|
+
isLoggedIn,
|
|
4214
|
+
serverside,
|
|
4215
|
+
theme,
|
|
4216
|
+
colorMode
|
|
4208
4217
|
}) {
|
|
4209
4218
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_framer_motion3.motion.div, { initial: { opacity: 0, y: 12 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.3, delay: 0.1 }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_material5.Box, { sx: { mb: 3 }, children: [
|
|
4210
4219
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_material5.Typography, { sx: { color: "hsl(var(--foreground))", fontWeight: 600, fontSize: "0.95rem", mb: 0.5 }, children: "Authentication" }),
|
|
@@ -4220,7 +4229,14 @@ function AppAuthSection({
|
|
|
4220
4229
|
onTestConnection,
|
|
4221
4230
|
onSaveAuth,
|
|
4222
4231
|
apiAuthEntries: matchingEntries,
|
|
4223
|
-
onRefreshAuth
|
|
4232
|
+
onRefreshAuth,
|
|
4233
|
+
globalUrl,
|
|
4234
|
+
userdata,
|
|
4235
|
+
isLoaded,
|
|
4236
|
+
isLoggedIn,
|
|
4237
|
+
serverside,
|
|
4238
|
+
theme,
|
|
4239
|
+
colorMode
|
|
4224
4240
|
}
|
|
4225
4241
|
)
|
|
4226
4242
|
] }) });
|
|
@@ -4386,7 +4402,8 @@ function getPrimaryCategory(appName, categories) {
|
|
|
4386
4402
|
if (COMMUNICATION_PATTERNS_NAMES.some((p) => name.includes(p))) return "Communication";
|
|
4387
4403
|
return null;
|
|
4388
4404
|
}
|
|
4389
|
-
var AppMcpChat = ({ appName, appIcon, appId, categories }) => {
|
|
4405
|
+
var AppMcpChat = ({ appName, appIcon, appId, categories, globalUrl }) => {
|
|
4406
|
+
useSyncHostBaseUrl(globalUrl);
|
|
4390
4407
|
const [input, setInput] = (0, import_react8.useState)("");
|
|
4391
4408
|
const [runState, setRunState] = (0, import_react8.useState)("idle");
|
|
4392
4409
|
const [query, setQuery] = (0, import_react8.useState)("");
|
|
@@ -4830,7 +4847,7 @@ var AppMcpChat_default = AppMcpChat;
|
|
|
4830
4847
|
|
|
4831
4848
|
// views/TryMcpSection.tsx
|
|
4832
4849
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
4833
|
-
function TryMcpSection({ appName, appIcon, appId, categories }) {
|
|
4850
|
+
function TryMcpSection({ appName, appIcon, appId, categories, globalUrl, userdata, isLoaded, isLoggedIn, serverside, theme, colorMode }) {
|
|
4834
4851
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_framer_motion5.motion.div, { initial: { opacity: 0, y: 12 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.3, delay: 0.15 }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_material7.Box, { sx: { mt: 5, mb: 3 }, children: [
|
|
4835
4852
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_material7.Typography, { sx: { color: "hsl(var(--foreground))", fontWeight: 600, fontSize: "0.95rem", mb: 1.5 }, children: "Try MCP" }),
|
|
4836
4853
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
@@ -4839,7 +4856,14 @@ function TryMcpSection({ appName, appIcon, appId, categories }) {
|
|
|
4839
4856
|
appName,
|
|
4840
4857
|
appIcon,
|
|
4841
4858
|
appId,
|
|
4842
|
-
categories
|
|
4859
|
+
categories,
|
|
4860
|
+
globalUrl,
|
|
4861
|
+
userdata,
|
|
4862
|
+
isLoaded,
|
|
4863
|
+
isLoggedIn,
|
|
4864
|
+
serverside,
|
|
4865
|
+
theme,
|
|
4866
|
+
colorMode
|
|
4843
4867
|
}
|
|
4844
4868
|
)
|
|
4845
4869
|
] }) });
|
|
@@ -5657,8 +5681,17 @@ function AppDetailDrawer({
|
|
|
5657
5681
|
onRefresh,
|
|
5658
5682
|
onAddToCanvas,
|
|
5659
5683
|
isAuthenticated = true,
|
|
5660
|
-
activeOrgId
|
|
5684
|
+
activeOrgId,
|
|
5685
|
+
globalUrl,
|
|
5686
|
+
userdata,
|
|
5687
|
+
isLoaded,
|
|
5688
|
+
isLoggedIn,
|
|
5689
|
+
serverside,
|
|
5690
|
+
theme,
|
|
5691
|
+
colorMode
|
|
5661
5692
|
}) {
|
|
5693
|
+
const themeScope = useShuffleMcpTheme();
|
|
5694
|
+
const scopeClassName = themeScope?.scopeClassName ?? (theme === "dark" ? "shuffle-mcp-scope dark" : theme === "light" ? "shuffle-mcp-scope" : void 0);
|
|
5662
5695
|
const [appInfo, setAppInfo] = (0, import_react11.useState)(null);
|
|
5663
5696
|
const [appLoading, setAppLoading] = (0, import_react11.useState)(true);
|
|
5664
5697
|
const [isActivated, setIsActivated] = (0, import_react11.useState)(null);
|
|
@@ -5890,15 +5923,23 @@ function AppDetailDrawer({
|
|
|
5890
5923
|
anchor,
|
|
5891
5924
|
open,
|
|
5892
5925
|
onClose: handleClose,
|
|
5893
|
-
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
5926
|
+
slotProps: {
|
|
5927
|
+
paper: {
|
|
5928
|
+
className: scopeClassName,
|
|
5929
|
+
sx: {
|
|
5930
|
+
width: { xs: "100%", sm: width },
|
|
5931
|
+
maxWidth: "100vw",
|
|
5932
|
+
display: "flex",
|
|
5933
|
+
flexDirection: "column",
|
|
5934
|
+
background: "linear-gradient(180deg, hsl(var(--card)) 0%, hsl(var(--background)) 100%)",
|
|
5935
|
+
borderLeft: anchor === "right" ? "1px solid hsl(var(--border))" : "none",
|
|
5936
|
+
borderRight: anchor === "left" ? "1px solid hsl(var(--border))" : "none"
|
|
5937
|
+
}
|
|
5900
5938
|
}
|
|
5901
5939
|
},
|
|
5940
|
+
sx: {
|
|
5941
|
+
"& .MuiDrawer-paper": { boxSizing: "border-box" }
|
|
5942
|
+
},
|
|
5902
5943
|
children: [
|
|
5903
5944
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
5904
5945
|
import_material9.Box,
|
|
@@ -5954,7 +5995,14 @@ function AppDetailDrawer({
|
|
|
5954
5995
|
onAdd: onAddToCanvas && appName ? () => {
|
|
5955
5996
|
onAddToCanvas({ name: appName, icon: resolvedImage || "", algoliaId: resolvedAlgoliaId });
|
|
5956
5997
|
onClose();
|
|
5957
|
-
} : void 0
|
|
5998
|
+
} : void 0,
|
|
5999
|
+
globalUrl,
|
|
6000
|
+
userdata,
|
|
6001
|
+
isLoaded,
|
|
6002
|
+
isLoggedIn,
|
|
6003
|
+
serverside,
|
|
6004
|
+
theme,
|
|
6005
|
+
colorMode
|
|
5958
6006
|
}
|
|
5959
6007
|
),
|
|
5960
6008
|
isAuthenticated && incidentStats && incidentStats.ingested > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_framer_motion6.motion.div, { initial: { opacity: 0, y: 12 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.3, delay: 0.08 }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_material9.Box, { sx: {
|
|
@@ -5996,7 +6044,14 @@ function AppDetailDrawer({
|
|
|
5996
6044
|
onAuthChange: handleAuthChange,
|
|
5997
6045
|
onTestConnection: (appId2, authId) => handleTestConnection(appName || appId2, authId),
|
|
5998
6046
|
onSaveAuth: (appId2, creds) => handleSaveAuth(appId2, creds, appName || void 0),
|
|
5999
|
-
onRefreshAuth: refreshAuth
|
|
6047
|
+
onRefreshAuth: refreshAuth,
|
|
6048
|
+
globalUrl,
|
|
6049
|
+
userdata,
|
|
6050
|
+
isLoaded,
|
|
6051
|
+
isLoggedIn,
|
|
6052
|
+
serverside,
|
|
6053
|
+
theme,
|
|
6054
|
+
colorMode
|
|
6000
6055
|
}
|
|
6001
6056
|
) }),
|
|
6002
6057
|
isAuthenticated && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
@@ -6006,10 +6061,32 @@ function AppDetailDrawer({
|
|
|
6006
6061
|
appName: appName || "",
|
|
6007
6062
|
appIcon: resolvedImage,
|
|
6008
6063
|
appId: matchingEntries[0]?.app?.id || matchingEntries[0]?.id || appName || "",
|
|
6009
|
-
categories: appInfo?.categories
|
|
6064
|
+
categories: appInfo?.categories,
|
|
6065
|
+
globalUrl,
|
|
6066
|
+
userdata,
|
|
6067
|
+
isLoaded,
|
|
6068
|
+
isLoggedIn,
|
|
6069
|
+
serverside,
|
|
6070
|
+
theme,
|
|
6071
|
+
colorMode
|
|
6010
6072
|
}
|
|
6011
6073
|
),
|
|
6012
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
6074
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
6075
|
+
SingulActionsPreview_default,
|
|
6076
|
+
{
|
|
6077
|
+
appName: appName || "",
|
|
6078
|
+
appIcon: resolvedImage,
|
|
6079
|
+
categories: appInfo?.categories,
|
|
6080
|
+
activeOrgId,
|
|
6081
|
+
globalUrl,
|
|
6082
|
+
userdata,
|
|
6083
|
+
isLoaded,
|
|
6084
|
+
isLoggedIn,
|
|
6085
|
+
serverside,
|
|
6086
|
+
theme,
|
|
6087
|
+
colorMode
|
|
6088
|
+
}
|
|
6089
|
+
)
|
|
6013
6090
|
] })
|
|
6014
6091
|
] }) })
|
|
6015
6092
|
]
|
|
@@ -6869,6 +6946,7 @@ function AppSearchDrawer({
|
|
|
6869
6946
|
colorMode
|
|
6870
6947
|
}) {
|
|
6871
6948
|
const themeScope = useShuffleMcpTheme();
|
|
6949
|
+
const scopeClassName = themeScope?.scopeClassName ?? (theme === "dark" ? "shuffle-mcp-scope dark" : theme === "light" ? "shuffle-mcp-scope" : void 0);
|
|
6872
6950
|
const [detailAppName, setDetailAppName] = (0, import_react13.useState)(null);
|
|
6873
6951
|
const [detailAppId, setDetailAppId] = (0, import_react13.useState)(null);
|
|
6874
6952
|
const [highlightActive, setHighlightActive] = (0, import_react13.useState)(false);
|
|
@@ -6954,20 +7032,25 @@ function AppSearchDrawer({
|
|
|
6954
7032
|
anchor,
|
|
6955
7033
|
open: open && detailAppName === null,
|
|
6956
7034
|
onClose: handleClose,
|
|
6957
|
-
slotProps: {
|
|
7035
|
+
slotProps: {
|
|
7036
|
+
paper: {
|
|
7037
|
+
className: scopeClassName,
|
|
7038
|
+
sx: {
|
|
7039
|
+
width: { xs: "100%", sm: width },
|
|
7040
|
+
maxWidth: "100vw",
|
|
7041
|
+
height: "100vh",
|
|
7042
|
+
display: "flex",
|
|
7043
|
+
flexDirection: "column",
|
|
7044
|
+
overflow: "hidden",
|
|
7045
|
+
background: "linear-gradient(180deg, hsl(var(--card)) 0%, hsl(var(--background)) 100%)",
|
|
7046
|
+
borderLeft: anchor === "right" ? "1px solid hsl(var(--border))" : "none",
|
|
7047
|
+
borderRight: anchor === "left" ? "1px solid hsl(var(--border))" : "none"
|
|
7048
|
+
}
|
|
7049
|
+
}
|
|
7050
|
+
},
|
|
6958
7051
|
sx: {
|
|
6959
7052
|
zIndex: 9999,
|
|
6960
|
-
"& .MuiDrawer-paper": {
|
|
6961
|
-
width,
|
|
6962
|
-
maxWidth: "100vw",
|
|
6963
|
-
height: "100vh",
|
|
6964
|
-
display: "flex",
|
|
6965
|
-
flexDirection: "column",
|
|
6966
|
-
overflow: "hidden",
|
|
6967
|
-
background: "linear-gradient(180deg, hsl(var(--card)) 0%, hsl(var(--background)) 100%)",
|
|
6968
|
-
borderLeft: anchor === "right" ? "1px solid hsl(var(--border))" : "none",
|
|
6969
|
-
borderRight: anchor === "left" ? "1px solid hsl(var(--border))" : "none"
|
|
6970
|
-
}
|
|
7053
|
+
"& .MuiDrawer-paper": { boxSizing: "border-box" }
|
|
6971
7054
|
},
|
|
6972
7055
|
children: [
|
|
6973
7056
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
@@ -7063,14 +7146,16 @@ function AppSearchDrawer({
|
|
|
7063
7146
|
overflowY: "auto"
|
|
7064
7147
|
},
|
|
7065
7148
|
"& .singul-results-grid": {
|
|
7066
|
-
|
|
7149
|
+
gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
|
|
7150
|
+
gridAutoRows: "88px",
|
|
7067
7151
|
gap: "12px"
|
|
7068
7152
|
},
|
|
7069
7153
|
"& .singul-results-grid .singul-dropdown-item": {
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
|
|
7073
|
-
|
|
7154
|
+
minWidth: 0,
|
|
7155
|
+
minHeight: 88,
|
|
7156
|
+
maxHeight: 88,
|
|
7157
|
+
height: 88,
|
|
7158
|
+
padding: "12px 14px",
|
|
7074
7159
|
alignItems: "center",
|
|
7075
7160
|
overflow: "hidden"
|
|
7076
7161
|
},
|
|
@@ -7079,11 +7164,14 @@ function AppSearchDrawer({
|
|
|
7079
7164
|
gap: "12px"
|
|
7080
7165
|
},
|
|
7081
7166
|
"& .singul-results-grid .singul-app-icon": {
|
|
7082
|
-
width:
|
|
7083
|
-
height:
|
|
7167
|
+
width: 36,
|
|
7168
|
+
height: 36,
|
|
7084
7169
|
borderRadius: 8,
|
|
7085
7170
|
padding: 4
|
|
7086
7171
|
},
|
|
7172
|
+
"& .singul-results-grid .singul-app-details": { minWidth: 0 },
|
|
7173
|
+
"& .singul-results-grid .singul-app-name": { maxWidth: "100%" },
|
|
7174
|
+
"& .singul-results-grid .singul-checkbox": { marginLeft: "auto" },
|
|
7087
7175
|
...highlightActive && highlightAppName ? {
|
|
7088
7176
|
[`& .singul-dropdown-item[data-app-name="${highlightAppName}"]`]: {
|
|
7089
7177
|
borderColor: "hsl(var(--primary)) !important",
|
|
@@ -11780,10 +11868,354 @@ var AgentUI = ({
|
|
|
11780
11868
|
var AgentUI_default = AgentUI;
|
|
11781
11869
|
|
|
11782
11870
|
// components/AgentRunDrawer.tsx
|
|
11871
|
+
var import_react18 = require("react");
|
|
11872
|
+
var import_material19 = require("@mui/material");
|
|
11873
|
+
var import_lucide_react12 = require("lucide-react");
|
|
11874
|
+
|
|
11875
|
+
// components/LocalLLMConfig.tsx
|
|
11783
11876
|
var import_react16 = require("react");
|
|
11877
|
+
var import_material18 = require("@mui/material");
|
|
11878
|
+
init_api();
|
|
11879
|
+
|
|
11880
|
+
// components/UsageBar.tsx
|
|
11784
11881
|
var import_material17 = require("@mui/material");
|
|
11785
|
-
var import_lucide_react12 = require("lucide-react");
|
|
11786
11882
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
11883
|
+
var fmt = (n) => n.toLocaleString();
|
|
11884
|
+
var UsageBar = ({
|
|
11885
|
+
label,
|
|
11886
|
+
usage,
|
|
11887
|
+
limit,
|
|
11888
|
+
unit,
|
|
11889
|
+
hint,
|
|
11890
|
+
actionLabel,
|
|
11891
|
+
actionHref
|
|
11892
|
+
}) => {
|
|
11893
|
+
const safeLimit = Math.max(limit, 0);
|
|
11894
|
+
const pct = safeLimit > 0 ? usage / safeLimit * 100 : 0;
|
|
11895
|
+
const isOver = pct >= 100;
|
|
11896
|
+
const isWarn = pct >= 65 && !isOver;
|
|
11897
|
+
const accent = isOver ? "hsl(var(--destructive))" : isWarn ? "hsl(var(--severity-medium))" : "hsl(var(--muted-foreground))";
|
|
11898
|
+
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 : ""}`;
|
|
11899
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Tooltip, { title: tooltipText, placement: "top", arrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material17.Box, { sx: { display: "flex", flexDirection: "column", gap: 0.5, py: 0.25 }, children: [
|
|
11900
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material17.Box, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 1 }, children: [
|
|
11901
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
11902
|
+
import_material17.Typography,
|
|
11903
|
+
{
|
|
11904
|
+
sx: {
|
|
11905
|
+
fontSize: "12.8px",
|
|
11906
|
+
fontWeight: 500,
|
|
11907
|
+
color: "hsl(var(--muted-foreground))",
|
|
11908
|
+
lineHeight: 1.2
|
|
11909
|
+
},
|
|
11910
|
+
children: label
|
|
11911
|
+
}
|
|
11912
|
+
),
|
|
11913
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material17.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
11914
|
+
actionLabel && actionHref && (isWarn || isOver) && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
11915
|
+
import_material17.Box,
|
|
11916
|
+
{
|
|
11917
|
+
component: "a",
|
|
11918
|
+
href: actionHref,
|
|
11919
|
+
target: "_blank",
|
|
11920
|
+
rel: "noopener noreferrer",
|
|
11921
|
+
sx: {
|
|
11922
|
+
fontSize: "12.8px",
|
|
11923
|
+
fontWeight: 600,
|
|
11924
|
+
color: accent,
|
|
11925
|
+
textDecoration: "none",
|
|
11926
|
+
"&:hover": { textDecoration: "underline" }
|
|
11927
|
+
},
|
|
11928
|
+
children: actionLabel
|
|
11929
|
+
}
|
|
11930
|
+
),
|
|
11931
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
11932
|
+
import_material17.Typography,
|
|
11933
|
+
{
|
|
11934
|
+
sx: {
|
|
11935
|
+
fontSize: "12.8px",
|
|
11936
|
+
fontWeight: 500,
|
|
11937
|
+
color: accent,
|
|
11938
|
+
whiteSpace: "nowrap",
|
|
11939
|
+
fontVariantNumeric: "tabular-nums"
|
|
11940
|
+
},
|
|
11941
|
+
children: safeLimit > 0 ? `${fmt(usage)} / ${fmt(safeLimit)}${unit ? " " + unit : ""}` : `${fmt(usage)}${unit ? " " + unit : ""}`
|
|
11942
|
+
}
|
|
11943
|
+
)
|
|
11944
|
+
] })
|
|
11945
|
+
] }),
|
|
11946
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Box, { sx: { width: "100%", height: 2, bgcolor: "hsl(var(--muted) / 0.5)", borderRadius: 1, overflow: "hidden" }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
11947
|
+
import_material17.Box,
|
|
11948
|
+
{
|
|
11949
|
+
sx: {
|
|
11950
|
+
width: `${Math.min(Math.max(pct, 0), 100)}%`,
|
|
11951
|
+
height: "100%",
|
|
11952
|
+
bgcolor: isOver ? "hsl(var(--destructive))" : isWarn ? "hsl(var(--severity-medium))" : "hsl(var(--severity-low, 142 71% 45%))",
|
|
11953
|
+
transition: "width 0.3s ease"
|
|
11954
|
+
}
|
|
11955
|
+
}
|
|
11956
|
+
) })
|
|
11957
|
+
] }) });
|
|
11958
|
+
};
|
|
11959
|
+
|
|
11960
|
+
// components/LocalLLMConfig.tsx
|
|
11961
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
11962
|
+
var import_react17 = require("react");
|
|
11963
|
+
var OPENAI_APP_NAME = "OpenAI";
|
|
11964
|
+
var OPENAI_APP_ID = "5d19dd82517870c68d40cacad9b5ca91";
|
|
11965
|
+
var SHUFFLE_AI_PRESET = "Shuffle AI";
|
|
11966
|
+
var CUSTOM_PRESET = "Custom / self-hosted";
|
|
11967
|
+
var OPENAI_ALGOLIA_APP = {
|
|
11968
|
+
name: OPENAI_APP_NAME,
|
|
11969
|
+
description: "OpenAI-compatible LLM endpoint for agent operations",
|
|
11970
|
+
objectID: OPENAI_APP_ID,
|
|
11971
|
+
creator: "",
|
|
11972
|
+
app_version: "1.0.0",
|
|
11973
|
+
image_url: "",
|
|
11974
|
+
time_edited: 0,
|
|
11975
|
+
generated: false,
|
|
11976
|
+
invalid: false,
|
|
11977
|
+
priority: 0,
|
|
11978
|
+
actions: 0,
|
|
11979
|
+
tags: [],
|
|
11980
|
+
accessible_by: [],
|
|
11981
|
+
categories: [],
|
|
11982
|
+
action_labels: [],
|
|
11983
|
+
triggers: [],
|
|
11984
|
+
verified: true
|
|
11985
|
+
};
|
|
11986
|
+
var ENDPOINT_PRESETS = [
|
|
11987
|
+
{ label: SHUFFLE_AI_PRESET, url: "" },
|
|
11988
|
+
{ label: "OpenAI", url: "https://api.openai.com/v1" },
|
|
11989
|
+
{ label: "Anthropic", url: "https://api.anthropic.com/v1/" },
|
|
11990
|
+
{ label: "Google Gemini", url: "https://generativelanguage.googleapis.com/v1beta/openai/" },
|
|
11991
|
+
{ label: "Mistral", url: "https://api.mistral.ai/v1" },
|
|
11992
|
+
{ label: "Groq", url: "https://api.groq.com/openai/v1" },
|
|
11993
|
+
{ label: "Together AI", url: "https://api.together.xyz/v1" },
|
|
11994
|
+
{ label: "OpenRouter", url: "https://openrouter.ai/api/v1" },
|
|
11995
|
+
{ label: "Ollama (localhost)", url: "http://localhost:11434/v1" },
|
|
11996
|
+
{ label: "LM Studio (localhost)", url: "http://localhost:1234/v1" },
|
|
11997
|
+
{ label: CUSTOM_PRESET, url: "" }
|
|
11998
|
+
];
|
|
11999
|
+
var LocalLLMConfig = ({ compact, globalUrl, userdata, isLoaded, isLoggedIn, serverside, theme, colorMode }) => {
|
|
12000
|
+
useSyncHostBaseUrl(globalUrl);
|
|
12001
|
+
const { authStates, authenticatedApps, handleAuthChange, handleTestConnection, handleSaveAuth, refreshAuth } = useAppAuth();
|
|
12002
|
+
const [expanded, setExpanded] = (0, import_react16.useState)(true);
|
|
12003
|
+
const [selectedPreset, setSelectedPreset] = (0, import_react16.useState)("");
|
|
12004
|
+
const [customUrl, setCustomUrl] = (0, import_react16.useState)("");
|
|
12005
|
+
const [confirmShuffleAIOpen, setConfirmShuffleAIOpen] = (0, import_react16.useState)(false);
|
|
12006
|
+
const openaiEntries = authenticatedApps.filter(
|
|
12007
|
+
(a) => a.app?.name?.toLowerCase() === "openai" || a.app?.id === OPENAI_APP_ID
|
|
12008
|
+
);
|
|
12009
|
+
const authState = authStates[OPENAI_APP_ID] || {
|
|
12010
|
+
systemId: OPENAI_APP_ID,
|
|
12011
|
+
status: "pending",
|
|
12012
|
+
credentials: {}
|
|
12013
|
+
};
|
|
12014
|
+
const currentUrl = authState.credentials?.url || "";
|
|
12015
|
+
const attemptedDeletionRef = (0, import_react16.useRef)(/* @__PURE__ */ new Set());
|
|
12016
|
+
(0, import_react16.useEffect)(() => {
|
|
12017
|
+
if (authState.status === "testing") return;
|
|
12018
|
+
const failedEntries = openaiEntries.filter((e) => e.validation && e.validation.valid === false && e.id);
|
|
12019
|
+
if (failedEntries.length === 0) return;
|
|
12020
|
+
let cancelled = false;
|
|
12021
|
+
(async () => {
|
|
12022
|
+
let deletedAny = false;
|
|
12023
|
+
for (const entry of failedEntries) {
|
|
12024
|
+
const id = entry.id;
|
|
12025
|
+
if (attemptedDeletionRef.current.has(id)) continue;
|
|
12026
|
+
attemptedDeletionRef.current.add(id);
|
|
12027
|
+
try {
|
|
12028
|
+
const resp = await fetch(getApiUrl(`/api/v1/apps/authentication/${id}`), {
|
|
12029
|
+
method: "DELETE",
|
|
12030
|
+
credentials: "include",
|
|
12031
|
+
headers: { ...getAuthHeader() }
|
|
12032
|
+
});
|
|
12033
|
+
if (resp.ok) deletedAny = true;
|
|
12034
|
+
} catch (err) {
|
|
12035
|
+
console.error("[LocalLLMConfig] Failed to auto-delete failed OpenAI auth:", err);
|
|
12036
|
+
}
|
|
12037
|
+
}
|
|
12038
|
+
if (!cancelled && deletedAny) {
|
|
12039
|
+
await refreshAuth();
|
|
12040
|
+
refreshAllIntegrationStatus();
|
|
12041
|
+
}
|
|
12042
|
+
})();
|
|
12043
|
+
return () => {
|
|
12044
|
+
cancelled = true;
|
|
12045
|
+
};
|
|
12046
|
+
}, [openaiEntries, authState.status, refreshAuth]);
|
|
12047
|
+
const hasOpenAIEntries = openaiEntries.length > 0;
|
|
12048
|
+
const effectivePreset = (0, import_react16.useMemo)(() => {
|
|
12049
|
+
if (selectedPreset) return selectedPreset;
|
|
12050
|
+
if (!currentUrl && !hasOpenAIEntries) return SHUFFLE_AI_PRESET;
|
|
12051
|
+
if (!currentUrl) return "";
|
|
12052
|
+
const match = ENDPOINT_PRESETS.find((p) => p.url && p.url === currentUrl);
|
|
12053
|
+
return match ? match.label : CUSTOM_PRESET;
|
|
12054
|
+
}, [selectedPreset, currentUrl, hasOpenAIEntries]);
|
|
12055
|
+
const applyShuffleAI = async () => {
|
|
12056
|
+
let deletedAny = false;
|
|
12057
|
+
for (const entry of openaiEntries) {
|
|
12058
|
+
if (!entry.id) continue;
|
|
12059
|
+
try {
|
|
12060
|
+
const resp = await fetch(getApiUrl(`/api/v1/apps/authentication/${entry.id}`), {
|
|
12061
|
+
method: "DELETE",
|
|
12062
|
+
credentials: "include",
|
|
12063
|
+
headers: { ...getAuthHeader() }
|
|
12064
|
+
});
|
|
12065
|
+
if (resp.ok) deletedAny = true;
|
|
12066
|
+
} catch (err) {
|
|
12067
|
+
console.error("[LocalLLMConfig] Failed to delete OpenAI auth when switching to Shuffle AI:", err);
|
|
12068
|
+
}
|
|
12069
|
+
}
|
|
12070
|
+
handleAuthChange(OPENAI_APP_ID, {});
|
|
12071
|
+
setSelectedPreset(SHUFFLE_AI_PRESET);
|
|
12072
|
+
setCustomUrl("");
|
|
12073
|
+
if (deletedAny) {
|
|
12074
|
+
await refreshAuth();
|
|
12075
|
+
refreshAllIntegrationStatus();
|
|
12076
|
+
}
|
|
12077
|
+
};
|
|
12078
|
+
const handlePresetChange = (label) => {
|
|
12079
|
+
if (label === SHUFFLE_AI_PRESET) {
|
|
12080
|
+
if (hasOpenAIEntries) {
|
|
12081
|
+
setConfirmShuffleAIOpen(true);
|
|
12082
|
+
return;
|
|
12083
|
+
}
|
|
12084
|
+
void applyShuffleAI();
|
|
12085
|
+
return;
|
|
12086
|
+
}
|
|
12087
|
+
setSelectedPreset(label);
|
|
12088
|
+
const preset = ENDPOINT_PRESETS.find((p) => p.label === label);
|
|
12089
|
+
if (!preset) return;
|
|
12090
|
+
handleAuthChange(OPENAI_APP_ID, { ...authState.credentials, url: preset.label === CUSTOM_PRESET ? customUrl : preset.url });
|
|
12091
|
+
};
|
|
12092
|
+
const handleCustomUrlChange = (value) => {
|
|
12093
|
+
setCustomUrl(value);
|
|
12094
|
+
handleAuthChange(OPENAI_APP_ID, { ...authState.credentials, url: value });
|
|
12095
|
+
};
|
|
12096
|
+
const isShuffleAI = effectivePreset === SHUFFLE_AI_PRESET;
|
|
12097
|
+
const orgId = userdata?.active_org?.id;
|
|
12098
|
+
const [orgData, setOrgData] = (0, import_react16.useState)(null);
|
|
12099
|
+
(0, import_react16.useEffect)(() => {
|
|
12100
|
+
if (!orgId) return;
|
|
12101
|
+
let cancelled = false;
|
|
12102
|
+
(async () => {
|
|
12103
|
+
try {
|
|
12104
|
+
const res = await fetch(getApiUrl(`/api/v1/orgs/${orgId}`), {
|
|
12105
|
+
method: "GET",
|
|
12106
|
+
credentials: "include",
|
|
12107
|
+
headers: { ...getAuthHeader(), "Content-Type": "application/json" }
|
|
12108
|
+
});
|
|
12109
|
+
if (!res.ok) return;
|
|
12110
|
+
const data = await res.json();
|
|
12111
|
+
if (!cancelled) setOrgData(data);
|
|
12112
|
+
} catch (err) {
|
|
12113
|
+
console.error("[LocalLLMConfig] Failed to fetch org info:", err);
|
|
12114
|
+
}
|
|
12115
|
+
})();
|
|
12116
|
+
return () => {
|
|
12117
|
+
cancelled = true;
|
|
12118
|
+
};
|
|
12119
|
+
}, [orgId]);
|
|
12120
|
+
const appRunLimit = orgData?.app_execution_limit ?? userdata?.app_execution_limit ?? 0;
|
|
12121
|
+
const appRunUsage = (orgData?.app_execution_usage ?? userdata?.app_execution_usage ?? 0) + (orgData?.app_executions_suborgs ?? userdata?.app_executions_suborgs ?? 0);
|
|
12122
|
+
const agentTokens = orgData?.sync_features?.agent_tokens ?? userdata?.sync_features?.agent_tokens;
|
|
12123
|
+
const agentTokenLimit = Number(agentTokens?.limit) || 0;
|
|
12124
|
+
const agentTokenUsage = Number(agentTokens?.usage) || 0;
|
|
12125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Box, { sx: { display: "flex", flexDirection: "column", gap: 2.5 }, children: [
|
|
12126
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Box, { sx: { display: "flex", flexDirection: "column", gap: 1 }, children: [
|
|
12127
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Typography, { sx: { fontSize: "0.85rem", fontWeight: 600, color: "hsl(var(--foreground))" }, children: "AI Provider" }),
|
|
12128
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
12129
|
+
import_material18.Autocomplete,
|
|
12130
|
+
{
|
|
12131
|
+
size: "small",
|
|
12132
|
+
fullWidth: true,
|
|
12133
|
+
disableClearable: true,
|
|
12134
|
+
options: ENDPOINT_PRESETS.map((p) => p.label),
|
|
12135
|
+
value: effectivePreset || null,
|
|
12136
|
+
onChange: (_e, val) => val && handlePresetChange(val),
|
|
12137
|
+
isOptionEqualToValue: (opt, val) => opt === val,
|
|
12138
|
+
renderOption: (props, option) => {
|
|
12139
|
+
const preset = ENDPOINT_PRESETS.find((p) => p.label === option);
|
|
12140
|
+
return /* @__PURE__ */ (0, import_react17.createElement)("li", { ...props, key: option }, /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Box, { sx: { display: "flex", alignItems: "center", gap: 1, width: "100%", minWidth: 0 }, children: [
|
|
12141
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Typography, { sx: { fontSize: "0.85rem", color: "hsl(var(--popover-foreground))" }, children: option }),
|
|
12142
|
+
preset?.url && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Typography, { component: "span", sx: { ml: "auto", color: "hsl(var(--muted-foreground))", fontSize: "0.75rem", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: preset.url })
|
|
12143
|
+
] }));
|
|
12144
|
+
},
|
|
12145
|
+
renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.TextField, { ...params, placeholder: "Search a provider\u2026" }),
|
|
12146
|
+
slotProps: {
|
|
12147
|
+
paper: { sx: { bgcolor: "hsl(var(--popover))", color: "hsl(var(--popover-foreground))", border: "1px solid hsl(var(--border))" } },
|
|
12148
|
+
popper: { sx: { zIndex: 9999 } }
|
|
12149
|
+
}
|
|
12150
|
+
}
|
|
12151
|
+
)
|
|
12152
|
+
] }),
|
|
12153
|
+
!compact && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Box, { sx: { px: 2.5, py: 2, borderRadius: 2, border: "1px solid hsl(var(--border))", bgcolor: "hsl(var(--muted) / 0.3)" }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Typography, { sx: { fontSize: "0.8rem", color: "hsl(var(--muted-foreground))", lineHeight: 1.5 }, children: [
|
|
12154
|
+
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.",
|
|
12155
|
+
" ",
|
|
12156
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Box, { 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" }),
|
|
12157
|
+
"."
|
|
12158
|
+
] }) }),
|
|
12159
|
+
isShuffleAI && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Box, { sx: { display: "flex", flexDirection: "column", gap: 0.75, mt: 0.5, width: "100%" }, children: [
|
|
12160
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(UsageBar, { label: "App runs", usage: appRunUsage, limit: appRunLimit, unit: "runs", actionLabel: "Upgrade", actionHref: "https://shuffler.io/pricing" }),
|
|
12161
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(UsageBar, { label: "Agent tokens", usage: agentTokenUsage, limit: agentTokenLimit, unit: "tokens", actionLabel: "Upgrade", actionHref: "https://shuffler.io/pricing" })
|
|
12162
|
+
] }),
|
|
12163
|
+
effectivePreset === CUSTOM_PRESET && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
12164
|
+
import_material18.TextField,
|
|
12165
|
+
{
|
|
12166
|
+
size: "small",
|
|
12167
|
+
fullWidth: true,
|
|
12168
|
+
placeholder: "https://your-self-hosted-endpoint.example.com",
|
|
12169
|
+
value: customUrl || currentUrl,
|
|
12170
|
+
onChange: (e) => handleCustomUrlChange(e.target.value),
|
|
12171
|
+
helperText: "Enter the base URL of your OpenAI-compatible endpoint",
|
|
12172
|
+
sx: { "& .MuiFormHelperText-root": { color: "hsl(var(--muted-foreground))" } }
|
|
12173
|
+
}
|
|
12174
|
+
),
|
|
12175
|
+
!isShuffleAI && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
12176
|
+
AppAuthCard,
|
|
12177
|
+
{
|
|
12178
|
+
app: OPENAI_ALGOLIA_APP,
|
|
12179
|
+
authState,
|
|
12180
|
+
isExpanded: expanded,
|
|
12181
|
+
onToggle: () => setExpanded((prev) => !prev),
|
|
12182
|
+
onAuthChange: handleAuthChange,
|
|
12183
|
+
onTestConnection: (appId, authId) => handleTestConnection(appId, authId),
|
|
12184
|
+
onSaveAuth: (appId, creds) => handleSaveAuth(appId, creds, OPENAI_APP_NAME),
|
|
12185
|
+
apiAuthEntries: openaiEntries,
|
|
12186
|
+
onRefreshAuth: refreshAuth,
|
|
12187
|
+
disableUrlPrefill: true,
|
|
12188
|
+
hideHeader: true,
|
|
12189
|
+
hideStatusChips: true,
|
|
12190
|
+
hideDocsLink: true,
|
|
12191
|
+
hideUrlFields: true,
|
|
12192
|
+
borderless: true,
|
|
12193
|
+
globalUrl,
|
|
12194
|
+
userdata,
|
|
12195
|
+
isLoaded,
|
|
12196
|
+
isLoggedIn,
|
|
12197
|
+
serverside,
|
|
12198
|
+
theme,
|
|
12199
|
+
colorMode
|
|
12200
|
+
}
|
|
12201
|
+
),
|
|
12202
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Dialog, { open: confirmShuffleAIOpen, onClose: () => setConfirmShuffleAIOpen(false), slotProps: { paper: { sx: { bgcolor: "hsl(var(--popover))", color: "hsl(var(--popover-foreground))", border: "1px solid hsl(var(--border))" } } }, children: [
|
|
12203
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.DialogTitle, { sx: { fontSize: "1rem", fontWeight: 600 }, children: "Switch to Shuffle AI?" }),
|
|
12204
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.DialogContent, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.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?" }) }),
|
|
12205
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.DialogActions, { sx: { px: 3, pb: 2 }, children: [
|
|
12206
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Button, { onClick: () => setConfirmShuffleAIOpen(false), sx: { color: "hsl(var(--muted-foreground))", textTransform: "none", height: 36 }, children: "Cancel" }),
|
|
12207
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Button, { onClick: async () => {
|
|
12208
|
+
setConfirmShuffleAIOpen(false);
|
|
12209
|
+
await applyShuffleAI();
|
|
12210
|
+
}, 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" })
|
|
12211
|
+
] })
|
|
12212
|
+
] })
|
|
12213
|
+
] });
|
|
12214
|
+
};
|
|
12215
|
+
var LocalLLMConfig_default = LocalLLMConfig;
|
|
12216
|
+
|
|
12217
|
+
// components/AgentRunDrawer.tsx
|
|
12218
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
11787
12219
|
var TAB_ORDER = ["run", "permissions", "localLLM"];
|
|
11788
12220
|
var AgentRunDrawer = ({
|
|
11789
12221
|
open,
|
|
@@ -11803,33 +12235,64 @@ var AgentRunDrawer = ({
|
|
|
11803
12235
|
headerSx,
|
|
11804
12236
|
tabsSx,
|
|
11805
12237
|
bodySx,
|
|
11806
|
-
globalUrl
|
|
12238
|
+
globalUrl,
|
|
12239
|
+
theme,
|
|
12240
|
+
colorMode,
|
|
12241
|
+
userdata,
|
|
12242
|
+
isLoaded,
|
|
12243
|
+
isLoggedIn,
|
|
12244
|
+
serverside
|
|
11807
12245
|
}) => {
|
|
11808
12246
|
useSyncHostBaseUrl(globalUrl);
|
|
11809
12247
|
const themeScope = useShuffleMcpTheme();
|
|
11810
|
-
const [activeTab, setActiveTab] = (0,
|
|
11811
|
-
const prevOpenRef = (0,
|
|
11812
|
-
(0,
|
|
12248
|
+
const [activeTab, setActiveTab] = (0, import_react18.useState)(initialTab);
|
|
12249
|
+
const prevOpenRef = (0, import_react18.useRef)(open);
|
|
12250
|
+
(0, import_react18.useEffect)(() => {
|
|
11813
12251
|
if (open && !prevOpenRef.current) setActiveTab(initialTab);
|
|
11814
12252
|
prevOpenRef.current = open;
|
|
11815
12253
|
}, [open, initialTab]);
|
|
11816
|
-
(0,
|
|
12254
|
+
(0, import_react18.useEffect)(() => {
|
|
11817
12255
|
if (typeof window === "undefined") return;
|
|
11818
12256
|
window.__shuffleAgentDrawerMounted = (window.__shuffleAgentDrawerMounted || 0) + 1;
|
|
11819
12257
|
return () => {
|
|
11820
12258
|
window.__shuffleAgentDrawerMounted = Math.max(0, (window.__shuffleAgentDrawerMounted || 1) - 1);
|
|
11821
12259
|
};
|
|
11822
12260
|
}, []);
|
|
12261
|
+
(0, import_react18.useEffect)(() => {
|
|
12262
|
+
if (typeof window === "undefined") return;
|
|
12263
|
+
const onOpen = (event) => {
|
|
12264
|
+
const tab = event.detail?.tab;
|
|
12265
|
+
if (tab === "localLLM") {
|
|
12266
|
+
event.preventDefault();
|
|
12267
|
+
setActiveTab("localLLM");
|
|
12268
|
+
}
|
|
12269
|
+
};
|
|
12270
|
+
window.addEventListener("agent-drawer-open", onOpen);
|
|
12271
|
+
return () => window.removeEventListener("agent-drawer-open", onOpen);
|
|
12272
|
+
}, []);
|
|
12273
|
+
const effectiveLocalLLMSlot = localLLMSlot ?? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
12274
|
+
LocalLLMConfig_default,
|
|
12275
|
+
{
|
|
12276
|
+
compact: true,
|
|
12277
|
+
globalUrl,
|
|
12278
|
+
userdata,
|
|
12279
|
+
isLoaded,
|
|
12280
|
+
isLoggedIn,
|
|
12281
|
+
serverside,
|
|
12282
|
+
theme,
|
|
12283
|
+
colorMode
|
|
12284
|
+
}
|
|
12285
|
+
);
|
|
11823
12286
|
const visibleTabs = TAB_ORDER.filter((t) => {
|
|
11824
12287
|
if (t === "run") return true;
|
|
11825
12288
|
if (t === "permissions") return !!permissionsSlot;
|
|
11826
|
-
if (t === "localLLM") return !!
|
|
12289
|
+
if (t === "localLLM") return !!effectiveLocalLLMSlot;
|
|
11827
12290
|
return false;
|
|
11828
12291
|
});
|
|
11829
12292
|
const showTabs = visibleTabs.length > 1;
|
|
11830
12293
|
const safeActiveTab = visibleTabs.includes(activeTab) ? activeTab : "run";
|
|
11831
|
-
return /* @__PURE__ */ (0,
|
|
11832
|
-
|
|
12294
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
12295
|
+
import_material19.Drawer,
|
|
11833
12296
|
{
|
|
11834
12297
|
anchor: "right",
|
|
11835
12298
|
open,
|
|
@@ -11851,8 +12314,8 @@ var AgentRunDrawer = ({
|
|
|
11851
12314
|
}
|
|
11852
12315
|
},
|
|
11853
12316
|
children: [
|
|
11854
|
-
/* @__PURE__ */ (0,
|
|
11855
|
-
|
|
12317
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
12318
|
+
import_material19.Box,
|
|
11856
12319
|
{
|
|
11857
12320
|
sx: [
|
|
11858
12321
|
{
|
|
@@ -11867,8 +12330,8 @@ var AgentRunDrawer = ({
|
|
|
11867
12330
|
...Array.isArray(headerSx) ? headerSx : headerSx ? [headerSx] : []
|
|
11868
12331
|
],
|
|
11869
12332
|
children: [
|
|
11870
|
-
/* @__PURE__ */ (0,
|
|
11871
|
-
|
|
12333
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
12334
|
+
import_material19.Box,
|
|
11872
12335
|
{
|
|
11873
12336
|
sx: {
|
|
11874
12337
|
width: 40,
|
|
@@ -11881,19 +12344,19 @@ var AgentRunDrawer = ({
|
|
|
11881
12344
|
color: "hsl(var(--primary))",
|
|
11882
12345
|
flexShrink: 0
|
|
11883
12346
|
},
|
|
11884
|
-
children: /* @__PURE__ */ (0,
|
|
12347
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AgentIcon_default, { size: 22 })
|
|
11885
12348
|
}
|
|
11886
12349
|
),
|
|
11887
|
-
/* @__PURE__ */ (0,
|
|
11888
|
-
/* @__PURE__ */ (0,
|
|
11889
|
-
/* @__PURE__ */ (0,
|
|
12350
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material19.Box, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
12351
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Typography, { sx: { fontWeight: 600, fontSize: "1.1rem", color: "hsl(var(--foreground))" }, children: title }),
|
|
12352
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Typography, { sx: { fontSize: "0.8rem", color: "hsl(var(--muted-foreground))" }, children: subtitle })
|
|
11890
12353
|
] }),
|
|
11891
|
-
/* @__PURE__ */ (0,
|
|
12354
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.IconButton, { onClick: onClose, size: "small", sx: { color: "hsl(var(--muted-foreground))" }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react12.X, { size: 16 }) })
|
|
11892
12355
|
]
|
|
11893
12356
|
}
|
|
11894
12357
|
),
|
|
11895
|
-
showTabs && /* @__PURE__ */ (0,
|
|
11896
|
-
|
|
12358
|
+
showTabs && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Box, { sx: { borderBottom: "1px solid hsl(var(--border))", flexShrink: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
12359
|
+
import_material19.Tabs,
|
|
11897
12360
|
{
|
|
11898
12361
|
value: safeActiveTab,
|
|
11899
12362
|
onChange: (_, v) => setActiveTab(v),
|
|
@@ -11914,36 +12377,36 @@ var AgentRunDrawer = ({
|
|
|
11914
12377
|
...Array.isArray(tabsSx) ? tabsSx : tabsSx ? [tabsSx] : []
|
|
11915
12378
|
],
|
|
11916
12379
|
children: [
|
|
11917
|
-
visibleTabs.includes("run") && /* @__PURE__ */ (0,
|
|
11918
|
-
|
|
12380
|
+
visibleTabs.includes("run") && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
12381
|
+
import_material19.Tab,
|
|
11919
12382
|
{
|
|
11920
12383
|
value: "run",
|
|
11921
12384
|
label: "Run",
|
|
11922
|
-
icon: /* @__PURE__ */ (0,
|
|
12385
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react12.Play, { size: 14 }),
|
|
11923
12386
|
iconPosition: "start",
|
|
11924
12387
|
sx: { gap: 0.75 }
|
|
11925
12388
|
}
|
|
11926
12389
|
),
|
|
11927
|
-
visibleTabs.includes("permissions") && /* @__PURE__ */ (0,
|
|
11928
|
-
|
|
12390
|
+
visibleTabs.includes("permissions") && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
12391
|
+
import_material19.Tab,
|
|
11929
12392
|
{
|
|
11930
12393
|
value: "permissions",
|
|
11931
|
-
label: permissionsDisabled ? /* @__PURE__ */ (0,
|
|
11932
|
-
icon: /* @__PURE__ */ (0,
|
|
12394
|
+
label: permissionsDisabled ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Tooltip, { title: permissionsDisabledTooltip, arrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Box, { component: "span", sx: { display: "inline-flex", alignItems: "center" }, children: "Permissions" }) }) : "Permissions",
|
|
12395
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react12.ShieldCheck, { size: 14 }),
|
|
11933
12396
|
iconPosition: "start",
|
|
11934
12397
|
disabled: permissionsDisabled,
|
|
11935
12398
|
sx: { gap: 0.75 }
|
|
11936
12399
|
}
|
|
11937
12400
|
),
|
|
11938
|
-
visibleTabs.includes("localLLM") && /* @__PURE__ */ (0,
|
|
11939
|
-
|
|
12401
|
+
visibleTabs.includes("localLLM") && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
12402
|
+
import_material19.Tab,
|
|
11940
12403
|
{
|
|
11941
12404
|
value: "localLLM",
|
|
11942
|
-
label: /* @__PURE__ */ (0,
|
|
12405
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material19.Box, { sx: { display: "flex", alignItems: "center", gap: 0.5 }, children: [
|
|
11943
12406
|
"Local LLM",
|
|
11944
12407
|
localLLMTabBadge
|
|
11945
12408
|
] }),
|
|
11946
|
-
icon: /* @__PURE__ */ (0,
|
|
12409
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react12.Server, { size: 14 }),
|
|
11947
12410
|
iconPosition: "start",
|
|
11948
12411
|
sx: { gap: 0.75 }
|
|
11949
12412
|
}
|
|
@@ -11951,20 +12414,22 @@ var AgentRunDrawer = ({
|
|
|
11951
12414
|
]
|
|
11952
12415
|
}
|
|
11953
12416
|
) }),
|
|
11954
|
-
/* @__PURE__ */ (0,
|
|
11955
|
-
safeActiveTab === "run" && /* @__PURE__ */ (0,
|
|
12417
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material19.Box, { sx: [{ flex: 1, overflowY: "auto" }, ...Array.isArray(bodySx) ? bodySx : bodySx ? [bodySx] : []], children: [
|
|
12418
|
+
safeActiveTab === "run" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Box, { sx: { px: 2, py: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
11956
12419
|
AgentUI_default,
|
|
11957
12420
|
{
|
|
11958
12421
|
compact: true,
|
|
11959
12422
|
hideHeroIcon: true,
|
|
11960
12423
|
title: "",
|
|
11961
12424
|
subtitle: null,
|
|
11962
|
-
|
|
11963
|
-
|
|
12425
|
+
...agentUIProps,
|
|
12426
|
+
apiBaseUrl: agentUIProps?.apiBaseUrl ?? globalUrl,
|
|
12427
|
+
theme: agentUIProps?.theme ?? theme,
|
|
12428
|
+
colorMode: agentUIProps?.colorMode ?? colorMode
|
|
11964
12429
|
}
|
|
11965
12430
|
) }),
|
|
11966
|
-
safeActiveTab === "permissions" && permissionsSlot && /* @__PURE__ */ (0,
|
|
11967
|
-
safeActiveTab === "localLLM" &&
|
|
12431
|
+
safeActiveTab === "permissions" && permissionsSlot && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Box, { sx: { px: 3, py: 2.5 }, children: permissionsSlot }),
|
|
12432
|
+
safeActiveTab === "localLLM" && effectiveLocalLLMSlot && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Box, { sx: { px: 3, py: 2.5 }, children: effectiveLocalLLMSlot })
|
|
11968
12433
|
] })
|
|
11969
12434
|
]
|
|
11970
12435
|
}
|
|
@@ -11973,8 +12438,8 @@ var AgentRunDrawer = ({
|
|
|
11973
12438
|
var AgentRunDrawer_default = AgentRunDrawer;
|
|
11974
12439
|
|
|
11975
12440
|
// components/AgentActivityList.tsx
|
|
11976
|
-
var
|
|
11977
|
-
var
|
|
12441
|
+
var import_react19 = require("react");
|
|
12442
|
+
var import_material20 = require("@mui/material");
|
|
11978
12443
|
var import_lucide_react13 = require("lucide-react");
|
|
11979
12444
|
|
|
11980
12445
|
// agentActivity.ts
|
|
@@ -11985,6 +12450,21 @@ var resolveHeaders = (apiKey, orgId) => {
|
|
|
11985
12450
|
if (orgId) h["Org-Id"] = orgId;
|
|
11986
12451
|
return h;
|
|
11987
12452
|
};
|
|
12453
|
+
var uuid = () => {
|
|
12454
|
+
if (typeof crypto !== "undefined" && "randomUUID" in crypto) return crypto.randomUUID();
|
|
12455
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
12456
|
+
const r = Math.random() * 16 | 0;
|
|
12457
|
+
const v = c === "x" ? r : r & 3 | 8;
|
|
12458
|
+
return v.toString(16);
|
|
12459
|
+
});
|
|
12460
|
+
};
|
|
12461
|
+
var buildAppNameValue = (apps = []) => apps.filter((a) => !!a?.name).map((a) => a.name).join(",");
|
|
12462
|
+
var buildScheduleName = (input) => {
|
|
12463
|
+
const prompt = (input || "").trim();
|
|
12464
|
+
const words = prompt.replace(/[^a-zA-Z0-9\s-]/g, " ").split(/\s+/).filter(Boolean).slice(0, 6);
|
|
12465
|
+
const title = words.length ? words.map((w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()).join(" ") : "Scheduled Agent Run";
|
|
12466
|
+
return { name: title.slice(0, 80), description: (prompt || "Scheduled Agent Run").slice(0, 240) };
|
|
12467
|
+
};
|
|
11988
12468
|
var searchAgentActivity = async (params = {}) => {
|
|
11989
12469
|
const {
|
|
11990
12470
|
cursor = "",
|
|
@@ -12040,6 +12520,127 @@ var listAgentScheduleWorkflows = async (params = {}) => {
|
|
|
12040
12520
|
const list = Array.isArray(data) ? data : data?.workflows || [];
|
|
12041
12521
|
return list.filter((w) => w && w.workflow_type === "AGENT_SCHEDULE").map((w) => ({ id: w.id || w._id, name: w.name || "Untitled", description: w.description }));
|
|
12042
12522
|
};
|
|
12523
|
+
var scheduleAgentRun = async ({ cron, input, apps = [], onStep, apiKey, apiBaseUrl, orgId }) => {
|
|
12524
|
+
const headers = { "Content-Type": "application/json", ...resolveHeaders(apiKey, orgId) };
|
|
12525
|
+
const step = (id, state2, detail) => {
|
|
12526
|
+
try {
|
|
12527
|
+
onStep?.({ id, state: state2, detail });
|
|
12528
|
+
} catch {
|
|
12529
|
+
}
|
|
12530
|
+
};
|
|
12531
|
+
step("name", "active");
|
|
12532
|
+
const { name, description } = buildScheduleName(input);
|
|
12533
|
+
step("name", "done", name);
|
|
12534
|
+
step("workflow", "active");
|
|
12535
|
+
const createRes = await fetch(resolveUrl("/api/v1/workflows", apiBaseUrl), {
|
|
12536
|
+
method: "POST",
|
|
12537
|
+
credentials: "include",
|
|
12538
|
+
headers,
|
|
12539
|
+
body: JSON.stringify({ name, description })
|
|
12540
|
+
});
|
|
12541
|
+
if (!createRes.ok) {
|
|
12542
|
+
step("workflow", "error", `HTTP ${createRes.status}`);
|
|
12543
|
+
throw new Error(`Create workflow failed (${createRes.status})`);
|
|
12544
|
+
}
|
|
12545
|
+
const created = await createRes.json();
|
|
12546
|
+
const workflowId = created.id || created._id || created.workflow_id;
|
|
12547
|
+
if (!workflowId) {
|
|
12548
|
+
step("workflow", "error", "no id returned");
|
|
12549
|
+
throw new Error("Workflow created but no id returned");
|
|
12550
|
+
}
|
|
12551
|
+
const triggerId = uuid();
|
|
12552
|
+
const actionId = uuid();
|
|
12553
|
+
const branchId = uuid();
|
|
12554
|
+
const trigger = {
|
|
12555
|
+
app_name: "Schedule",
|
|
12556
|
+
app_version: "1.0.0",
|
|
12557
|
+
environment: "cloud",
|
|
12558
|
+
id_: triggerId,
|
|
12559
|
+
_id_: triggerId,
|
|
12560
|
+
id: triggerId,
|
|
12561
|
+
finished: true,
|
|
12562
|
+
label: name,
|
|
12563
|
+
type: "TRIGGER",
|
|
12564
|
+
is_valid: true,
|
|
12565
|
+
trigger_type: "SCHEDULE",
|
|
12566
|
+
status: "running",
|
|
12567
|
+
name: "Schedule",
|
|
12568
|
+
parameters: [{ name: "cron", example: "", value: cron }, { name: "execution_argument", example: "", value: "" }],
|
|
12569
|
+
position: { x: 254, y: 617 },
|
|
12570
|
+
flowOrientation: "horizontal"
|
|
12571
|
+
};
|
|
12572
|
+
const action = {
|
|
12573
|
+
name: "Run LLM",
|
|
12574
|
+
label: "AI_Agent_1",
|
|
12575
|
+
app_name: "AI Agent",
|
|
12576
|
+
app_version: "1.0.0",
|
|
12577
|
+
app_id: "shuffle_agent",
|
|
12578
|
+
description: "Run an LLM query against any tool you want",
|
|
12579
|
+
environment: "Cloud",
|
|
12580
|
+
errors: [],
|
|
12581
|
+
id_: actionId,
|
|
12582
|
+
_id_: actionId,
|
|
12583
|
+
id: actionId,
|
|
12584
|
+
is_valid: true,
|
|
12585
|
+
type: "ACTION",
|
|
12586
|
+
isStartNode: true,
|
|
12587
|
+
run_magic_output: false,
|
|
12588
|
+
authentication: [],
|
|
12589
|
+
example: "",
|
|
12590
|
+
category: "",
|
|
12591
|
+
authentication_id: "",
|
|
12592
|
+
template: false,
|
|
12593
|
+
finished: true,
|
|
12594
|
+
flowOrientation: "horizontal",
|
|
12595
|
+
position: { x: 517, y: 370 },
|
|
12596
|
+
selectedAuthentication: {},
|
|
12597
|
+
circleId: uuid(),
|
|
12598
|
+
execution_delay: 0,
|
|
12599
|
+
parameters: [
|
|
12600
|
+
{ name: "app_name", value: buildAppNameValue(apps), required: true, description: "Comma-separated list of app names the agent is allowed to use." },
|
|
12601
|
+
{ name: "input", value: input, required: true, multiline: true, description: "The input data for the LLM query" }
|
|
12602
|
+
]
|
|
12603
|
+
};
|
|
12604
|
+
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 }] };
|
|
12605
|
+
const putRes = await fetch(resolveUrl(`/api/v1/workflows/${workflowId}`, apiBaseUrl), {
|
|
12606
|
+
method: "PUT",
|
|
12607
|
+
credentials: "include",
|
|
12608
|
+
headers,
|
|
12609
|
+
body: JSON.stringify(updated)
|
|
12610
|
+
});
|
|
12611
|
+
if (!putRes.ok) {
|
|
12612
|
+
step("workflow", "error", `HTTP ${putRes.status}`);
|
|
12613
|
+
throw new Error(`Update workflow failed (${putRes.status})`);
|
|
12614
|
+
}
|
|
12615
|
+
step("workflow", "done", name);
|
|
12616
|
+
step("schedule", "active");
|
|
12617
|
+
const schedRes = await fetch(resolveUrl(`/api/v1/workflows/${workflowId}/schedule`, apiBaseUrl), {
|
|
12618
|
+
method: "POST",
|
|
12619
|
+
credentials: "include",
|
|
12620
|
+
headers,
|
|
12621
|
+
body: JSON.stringify({
|
|
12622
|
+
name: "Schedule",
|
|
12623
|
+
frequency: cron,
|
|
12624
|
+
cron,
|
|
12625
|
+
execution_argument: "",
|
|
12626
|
+
environment: "cloud",
|
|
12627
|
+
id: triggerId,
|
|
12628
|
+
start: actionId,
|
|
12629
|
+
parameters: [{ name: "cron", value: cron }, { name: "execution_argument", value: "" }]
|
|
12630
|
+
})
|
|
12631
|
+
}).catch(async (err) => {
|
|
12632
|
+
await fetch(resolveUrl(`/api/v1/workflows/${workflowId}`, apiBaseUrl), { method: "DELETE", credentials: "include", headers: resolveHeaders(apiKey, orgId) }).catch(() => void 0);
|
|
12633
|
+
throw err;
|
|
12634
|
+
});
|
|
12635
|
+
if (!schedRes.ok) {
|
|
12636
|
+
const errText = await schedRes.text().catch(() => "");
|
|
12637
|
+
await fetch(resolveUrl(`/api/v1/workflows/${workflowId}`, apiBaseUrl), { method: "DELETE", credentials: "include", headers: resolveHeaders(apiKey, orgId) }).catch(() => void 0);
|
|
12638
|
+
step("schedule", "error", `HTTP ${schedRes.status}`);
|
|
12639
|
+
throw new Error(`Scheduler rejected the cron \`${cron}\` (HTTP ${schedRes.status})${errText ? `: ${errText}` : ""}. The workflow has been deleted.`);
|
|
12640
|
+
}
|
|
12641
|
+
step("schedule", "done", cron);
|
|
12642
|
+
return { workflowId, name, cron };
|
|
12643
|
+
};
|
|
12043
12644
|
var findAgentInputParam = (workflow) => {
|
|
12044
12645
|
const actions = workflow?.actions || [];
|
|
12045
12646
|
for (const a of actions) {
|
|
@@ -12129,16 +12730,16 @@ var stopAgentSchedule = async (workflowId, params = {}) => {
|
|
|
12129
12730
|
|
|
12130
12731
|
// components/AgentActivityList.tsx
|
|
12131
12732
|
var import_lucide_react14 = require("lucide-react");
|
|
12132
|
-
var
|
|
12733
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
12133
12734
|
var STATUS_CONFIG = {
|
|
12134
|
-
FINISHED: { icon: /* @__PURE__ */ (0,
|
|
12135
|
-
SUCCESS: { icon: /* @__PURE__ */ (0,
|
|
12136
|
-
FAILED: { icon: /* @__PURE__ */ (0,
|
|
12137
|
-
ABORTED: { icon: /* @__PURE__ */ (0,
|
|
12138
|
-
EXECUTING: { icon: /* @__PURE__ */ (0,
|
|
12139
|
-
RUNNING: { icon: /* @__PURE__ */ (0,
|
|
12140
|
-
WAITING: { icon: /* @__PURE__ */ (0,
|
|
12141
|
-
LIMIT_REACHED: { icon: /* @__PURE__ */ (0,
|
|
12735
|
+
FINISHED: { icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.CheckCircle, { size: 16 }), color: "hsl(var(--severity-low, 142 71% 45%))", label: "Completed" },
|
|
12736
|
+
SUCCESS: { icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.CheckCircle, { size: 16 }), color: "hsl(var(--severity-low, 142 71% 45%))", label: "Completed" },
|
|
12737
|
+
FAILED: { icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.XCircle, { size: 16 }), color: "hsl(var(--severity-critical, 0 72% 55%))", label: "Failed" },
|
|
12738
|
+
ABORTED: { icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.XCircle, { size: 16 }), color: "hsl(var(--severity-critical, 0 72% 55%))", label: "Aborted" },
|
|
12739
|
+
EXECUTING: { icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.Loader2, { size: 16 }), color: "hsl(var(--severity-medium, 38 92% 50%))", label: "Running" },
|
|
12740
|
+
RUNNING: { icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.Loader2, { size: 16 }), color: "hsl(var(--severity-medium, 38 92% 50%))", label: "Running" },
|
|
12741
|
+
WAITING: { icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.Clock, { size: 16 }), color: "hsl(var(--severity-info, 217 91% 60%))", label: "Waiting" },
|
|
12742
|
+
LIMIT_REACHED: { icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react14.AlertTriangle, { size: 16 }), color: "hsl(var(--severity-medium, 38 92% 50%))", label: "Limit reached" }
|
|
12142
12743
|
};
|
|
12143
12744
|
var getEffectiveStatus = (run) => {
|
|
12144
12745
|
const raw = (run.status || "").toUpperCase();
|
|
@@ -12154,12 +12755,12 @@ var getEffectiveStatus = (run) => {
|
|
|
12154
12755
|
var getRunIcon = (run) => {
|
|
12155
12756
|
const src = (run.execution_source || "").toLowerCase();
|
|
12156
12757
|
const arg = (run.execution_argument || "").toLowerCase();
|
|
12157
|
-
if (src.includes("schedule") || src.includes("cron")) return /* @__PURE__ */ (0,
|
|
12158
|
-
if (src.includes("webhook") || src.includes("http")) return /* @__PURE__ */ (0,
|
|
12159
|
-
if (arg.includes("alert") || arg.includes("detect")) return /* @__PURE__ */ (0,
|
|
12160
|
-
if (arg.includes("report") || arg.includes("email")) return /* @__PURE__ */ (0,
|
|
12161
|
-
if (arg.includes("endpoint") || arg.includes("server")) return /* @__PURE__ */ (0,
|
|
12162
|
-
return /* @__PURE__ */ (0,
|
|
12758
|
+
if (src.includes("schedule") || src.includes("cron")) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.Clock, { size: 18 });
|
|
12759
|
+
if (src.includes("webhook") || src.includes("http")) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.Globe, { size: 18 });
|
|
12760
|
+
if (arg.includes("alert") || arg.includes("detect")) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.Activity, { size: 18 });
|
|
12761
|
+
if (arg.includes("report") || arg.includes("email")) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.FileText, { size: 18 });
|
|
12762
|
+
if (arg.includes("endpoint") || arg.includes("server")) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.Server, { size: 18 });
|
|
12763
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.Zap, { size: 18 });
|
|
12163
12764
|
};
|
|
12164
12765
|
var getRunIconColor = (run) => {
|
|
12165
12766
|
const status = getEffectiveStatus(run);
|
|
@@ -12253,8 +12854,8 @@ var AgentRunRow = ({ run, onClick, sx }) => {
|
|
|
12253
12854
|
const iconColor = getRunIconColor(run);
|
|
12254
12855
|
const duration = formatDuration(run);
|
|
12255
12856
|
const tools = getRunTools(run);
|
|
12256
|
-
return /* @__PURE__ */ (0,
|
|
12257
|
-
|
|
12857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
12858
|
+
import_material20.Box,
|
|
12258
12859
|
{
|
|
12259
12860
|
onClick,
|
|
12260
12861
|
sx: [
|
|
@@ -12277,8 +12878,8 @@ var AgentRunRow = ({ run, onClick, sx }) => {
|
|
|
12277
12878
|
...Array.isArray(sx) ? sx : sx ? [sx] : []
|
|
12278
12879
|
],
|
|
12279
12880
|
children: [
|
|
12280
|
-
/* @__PURE__ */ (0,
|
|
12281
|
-
|
|
12881
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12882
|
+
import_material20.Box,
|
|
12282
12883
|
{
|
|
12283
12884
|
sx: {
|
|
12284
12885
|
width: 40,
|
|
@@ -12294,10 +12895,10 @@ var AgentRunRow = ({ run, onClick, sx }) => {
|
|
|
12294
12895
|
children: getRunIcon(run)
|
|
12295
12896
|
}
|
|
12296
12897
|
),
|
|
12297
|
-
/* @__PURE__ */ (0,
|
|
12298
|
-
/* @__PURE__ */ (0,
|
|
12299
|
-
/* @__PURE__ */ (0,
|
|
12300
|
-
|
|
12898
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.Box, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
12899
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.Box, { sx: { display: "flex", alignItems: "center", gap: 1, mb: 0.25 }, children: [
|
|
12900
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12901
|
+
import_material20.Typography,
|
|
12301
12902
|
{
|
|
12302
12903
|
sx: {
|
|
12303
12904
|
fontSize: "0.9rem",
|
|
@@ -12310,10 +12911,10 @@ var AgentRunRow = ({ run, onClick, sx }) => {
|
|
|
12310
12911
|
children: getRunTitle(run)
|
|
12311
12912
|
}
|
|
12312
12913
|
),
|
|
12313
|
-
/* @__PURE__ */ (0,
|
|
12914
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Box, { sx: { display: "flex", alignItems: "center", color: cfg.color, flexShrink: 0 }, children: cfg.icon })
|
|
12314
12915
|
] }),
|
|
12315
|
-
/* @__PURE__ */ (0,
|
|
12316
|
-
|
|
12916
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12917
|
+
import_material20.Typography,
|
|
12317
12918
|
{
|
|
12318
12919
|
sx: {
|
|
12319
12920
|
fontSize: "0.78rem",
|
|
@@ -12325,16 +12926,16 @@ var AgentRunRow = ({ run, onClick, sx }) => {
|
|
|
12325
12926
|
children: getRunSubtitle(run)
|
|
12326
12927
|
}
|
|
12327
12928
|
),
|
|
12328
|
-
/* @__PURE__ */ (0,
|
|
12329
|
-
/* @__PURE__ */ (0,
|
|
12330
|
-
duration && /* @__PURE__ */ (0,
|
|
12331
|
-
/* @__PURE__ */ (0,
|
|
12332
|
-
/* @__PURE__ */ (0,
|
|
12929
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.Box, { sx: { display: "flex", alignItems: "center", gap: 1, mt: 0.5 }, children: [
|
|
12930
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.7 }, children: run.started_at ? getTimeAgo(run.started_at) : "\u2014" }),
|
|
12931
|
+
duration && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
12932
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.4 }, children: "\xB7" }),
|
|
12933
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.7 }, children: duration })
|
|
12333
12934
|
] })
|
|
12334
12935
|
] })
|
|
12335
12936
|
] }),
|
|
12336
|
-
tools.length > 0 && /* @__PURE__ */ (0,
|
|
12337
|
-
|
|
12937
|
+
tools.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12938
|
+
import_material20.Box,
|
|
12338
12939
|
{
|
|
12339
12940
|
sx: {
|
|
12340
12941
|
display: { xs: "none", sm: "flex" },
|
|
@@ -12345,8 +12946,8 @@ var AgentRunRow = ({ run, onClick, sx }) => {
|
|
|
12345
12946
|
maxWidth: 220,
|
|
12346
12947
|
flexShrink: 0
|
|
12347
12948
|
},
|
|
12348
|
-
children: tools.map((t) => /* @__PURE__ */ (0,
|
|
12349
|
-
|
|
12949
|
+
children: tools.map((t) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Tooltip, { title: t, arrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12950
|
+
import_material20.Chip,
|
|
12350
12951
|
{
|
|
12351
12952
|
label: t,
|
|
12352
12953
|
size: "small",
|
|
@@ -12394,21 +12995,21 @@ var AgentActivityList = ({
|
|
|
12394
12995
|
toolbarSx,
|
|
12395
12996
|
rowSx
|
|
12396
12997
|
}) => {
|
|
12397
|
-
const [runs, setRuns] = (0,
|
|
12398
|
-
const [cursor, setCursor] = (0,
|
|
12399
|
-
const [hasMore, setHasMore] = (0,
|
|
12400
|
-
const [isLoading, setIsLoading] = (0,
|
|
12401
|
-
const [error, setError] = (0,
|
|
12402
|
-
const [statusFilter, setStatusFilter] = (0,
|
|
12403
|
-
const [searchQuery, setSearchQuery] = (0,
|
|
12404
|
-
const [debouncedQuery, setDebouncedQuery] = (0,
|
|
12405
|
-
const [agentWorkflows, setAgentWorkflows] = (0,
|
|
12406
|
-
const [workflowFilter, setWorkflowFilter] = (0,
|
|
12407
|
-
const [stopOpen, setStopOpen] = (0,
|
|
12408
|
-
const [stopLoading, setStopLoading] = (0,
|
|
12409
|
-
const debounceRef = (0,
|
|
12998
|
+
const [runs, setRuns] = (0, import_react19.useState)([]);
|
|
12999
|
+
const [cursor, setCursor] = (0, import_react19.useState)("");
|
|
13000
|
+
const [hasMore, setHasMore] = (0, import_react19.useState)(false);
|
|
13001
|
+
const [isLoading, setIsLoading] = (0, import_react19.useState)(false);
|
|
13002
|
+
const [error, setError] = (0, import_react19.useState)(null);
|
|
13003
|
+
const [statusFilter, setStatusFilter] = (0, import_react19.useState)("");
|
|
13004
|
+
const [searchQuery, setSearchQuery] = (0, import_react19.useState)("");
|
|
13005
|
+
const [debouncedQuery, setDebouncedQuery] = (0, import_react19.useState)("");
|
|
13006
|
+
const [agentWorkflows, setAgentWorkflows] = (0, import_react19.useState)([]);
|
|
13007
|
+
const [workflowFilter, setWorkflowFilter] = (0, import_react19.useState)("");
|
|
13008
|
+
const [stopOpen, setStopOpen] = (0, import_react19.useState)(false);
|
|
13009
|
+
const [stopLoading, setStopLoading] = (0, import_react19.useState)(false);
|
|
13010
|
+
const debounceRef = (0, import_react19.useRef)();
|
|
12410
13011
|
const selectedAgentWorkflow = agentWorkflows.find((w) => w.id === workflowFilter) || null;
|
|
12411
|
-
const openEditPrompt = (0,
|
|
13012
|
+
const openEditPrompt = (0, import_react19.useCallback)(async () => {
|
|
12412
13013
|
if (!workflowFilter) return;
|
|
12413
13014
|
try {
|
|
12414
13015
|
const { prompt, apps } = await getAgentScheduleConfig(workflowFilter, { apiKey, apiBaseUrl, orgId });
|
|
@@ -12422,7 +13023,7 @@ var AgentActivityList = ({
|
|
|
12422
13023
|
setError(e instanceof Error ? e.message : "Failed to load workflow");
|
|
12423
13024
|
}
|
|
12424
13025
|
}, [workflowFilter, selectedAgentWorkflow, apiKey, apiBaseUrl, orgId, onEditWorkflow]);
|
|
12425
|
-
const confirmStop = (0,
|
|
13026
|
+
const confirmStop = (0, import_react19.useCallback)(async () => {
|
|
12426
13027
|
if (!workflowFilter) return;
|
|
12427
13028
|
setStopLoading(true);
|
|
12428
13029
|
try {
|
|
@@ -12437,15 +13038,15 @@ var AgentActivityList = ({
|
|
|
12437
13038
|
setStopLoading(false);
|
|
12438
13039
|
}
|
|
12439
13040
|
}, [workflowFilter, apiKey, apiBaseUrl, orgId]);
|
|
12440
|
-
const updateSearchQuery = (0,
|
|
13041
|
+
const updateSearchQuery = (0, import_react19.useCallback)((q) => {
|
|
12441
13042
|
setSearchQuery(q);
|
|
12442
13043
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
12443
13044
|
debounceRef.current = setTimeout(() => setDebouncedQuery(q), 350);
|
|
12444
13045
|
}, []);
|
|
12445
|
-
(0,
|
|
13046
|
+
(0, import_react19.useEffect)(() => () => {
|
|
12446
13047
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
12447
13048
|
}, []);
|
|
12448
|
-
const fetchRuns = (0,
|
|
13049
|
+
const fetchRuns = (0, import_react19.useCallback)(
|
|
12449
13050
|
async (append = false, cursorParam = "") => {
|
|
12450
13051
|
setIsLoading(true);
|
|
12451
13052
|
setError(null);
|
|
@@ -12474,10 +13075,10 @@ var AgentActivityList = ({
|
|
|
12474
13075
|
},
|
|
12475
13076
|
[statusFilter, limit, apiKey, apiBaseUrl, orgId, workflowFilter]
|
|
12476
13077
|
);
|
|
12477
|
-
(0,
|
|
13078
|
+
(0, import_react19.useEffect)(() => {
|
|
12478
13079
|
fetchRuns(false, "");
|
|
12479
13080
|
}, [statusFilter, apiKey, apiBaseUrl, orgId, workflowFilter]);
|
|
12480
|
-
(0,
|
|
13081
|
+
(0, import_react19.useEffect)(() => {
|
|
12481
13082
|
let cancelled = false;
|
|
12482
13083
|
listAgentScheduleWorkflows({ apiKey, apiBaseUrl, orgId }).then((items) => {
|
|
12483
13084
|
if (!cancelled) setAgentWorkflows(items);
|
|
@@ -12487,7 +13088,7 @@ var AgentActivityList = ({
|
|
|
12487
13088
|
cancelled = true;
|
|
12488
13089
|
};
|
|
12489
13090
|
}, [apiKey, apiBaseUrl, orgId]);
|
|
12490
|
-
const loadMore = (0,
|
|
13091
|
+
const loadMore = (0, import_react19.useCallback)(() => {
|
|
12491
13092
|
if (cursor && !isLoading) fetchRuns(true, cursor);
|
|
12492
13093
|
}, [cursor, isLoading, fetchRuns]);
|
|
12493
13094
|
const filteredRuns = debouncedQuery ? runs.filter((r) => {
|
|
@@ -12500,15 +13101,15 @@ var AgentActivityList = ({
|
|
|
12500
13101
|
].filter(Boolean).join(" ").toLowerCase();
|
|
12501
13102
|
return hay.includes(debouncedQuery.toLowerCase());
|
|
12502
13103
|
}) : runs;
|
|
12503
|
-
return /* @__PURE__ */ (0,
|
|
12504
|
-
|
|
13104
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
13105
|
+
import_material20.Box,
|
|
12505
13106
|
{
|
|
12506
13107
|
className,
|
|
12507
13108
|
sx: [{ display: "flex", flexDirection: "column", gap: 2 }, ...Array.isArray(sx) ? sx : sx ? [sx] : []],
|
|
12508
13109
|
children: [
|
|
12509
|
-
(showSearchBar || showStatusChips) && /* @__PURE__ */ (0,
|
|
12510
|
-
/* @__PURE__ */ (0,
|
|
12511
|
-
|
|
13110
|
+
(showSearchBar || showStatusChips) && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.Box, { sx: [{ display: "flex", alignItems: "center", justifyContent: "center", gap: 1.5, flexWrap: "wrap" }, ...Array.isArray(toolbarSx) ? toolbarSx : toolbarSx ? [toolbarSx] : []], children: [
|
|
13111
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
13112
|
+
import_material20.Select,
|
|
12512
13113
|
{
|
|
12513
13114
|
size: "small",
|
|
12514
13115
|
value: workflowFilter,
|
|
@@ -12544,13 +13145,13 @@ var AgentActivityList = ({
|
|
|
12544
13145
|
}
|
|
12545
13146
|
},
|
|
12546
13147
|
children: [
|
|
12547
|
-
/* @__PURE__ */ (0,
|
|
12548
|
-
agentWorkflows.map((w) => /* @__PURE__ */ (0,
|
|
13148
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.MenuItem, { value: "", sx: { fontSize: "0.85rem" }, children: "All Agent runs" }),
|
|
13149
|
+
agentWorkflows.map((w) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.MenuItem, { value: w.id, sx: { fontSize: "0.85rem" }, children: w.name }, w.id))
|
|
12549
13150
|
]
|
|
12550
13151
|
}
|
|
12551
13152
|
),
|
|
12552
|
-
showSearchBar && /* @__PURE__ */ (0,
|
|
12553
|
-
|
|
13153
|
+
showSearchBar && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
13154
|
+
import_material20.TextField,
|
|
12554
13155
|
{
|
|
12555
13156
|
placeholder: "Search results...",
|
|
12556
13157
|
size: "small",
|
|
@@ -12558,7 +13159,7 @@ var AgentActivityList = ({
|
|
|
12558
13159
|
onChange: (e) => updateSearchQuery(e.target.value),
|
|
12559
13160
|
slotProps: {
|
|
12560
13161
|
input: {
|
|
12561
|
-
startAdornment: /* @__PURE__ */ (0,
|
|
13162
|
+
startAdornment: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.InputAdornment, { position: "start", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.Search, { size: 18, color: "hsl(var(--muted-foreground))" }) })
|
|
12562
13163
|
}
|
|
12563
13164
|
},
|
|
12564
13165
|
sx: {
|
|
@@ -12578,7 +13179,7 @@ var AgentActivityList = ({
|
|
|
12578
13179
|
}
|
|
12579
13180
|
}
|
|
12580
13181
|
),
|
|
12581
|
-
showStatusChips && /* @__PURE__ */ (0,
|
|
13182
|
+
showStatusChips && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12582
13183
|
SegmentedControl,
|
|
12583
13184
|
{
|
|
12584
13185
|
size: "sm",
|
|
@@ -12588,10 +13189,10 @@ var AgentActivityList = ({
|
|
|
12588
13189
|
options: STATUS_FILTERS.map((f) => ({ value: f.value, label: f.label }))
|
|
12589
13190
|
}
|
|
12590
13191
|
),
|
|
12591
|
-
isLoading && runs.length > 0 && /* @__PURE__ */ (0,
|
|
13192
|
+
isLoading && runs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.CircularProgress, { size: 16, sx: { color: "hsl(var(--primary))", ml: 0.5 } })
|
|
12592
13193
|
] }),
|
|
12593
|
-
selectedAgentWorkflow && /* @__PURE__ */ (0,
|
|
12594
|
-
|
|
13194
|
+
selectedAgentWorkflow && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
13195
|
+
import_material20.Box,
|
|
12595
13196
|
{
|
|
12596
13197
|
sx: {
|
|
12597
13198
|
display: "flex",
|
|
@@ -12603,15 +13204,15 @@ var AgentActivityList = ({
|
|
|
12603
13204
|
bgcolor: "hsl(var(--card))"
|
|
12604
13205
|
},
|
|
12605
13206
|
children: [
|
|
12606
|
-
/* @__PURE__ */ (0,
|
|
12607
|
-
/* @__PURE__ */ (0,
|
|
12608
|
-
selectedAgentWorkflow.description && /* @__PURE__ */ (0,
|
|
13207
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.Box, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
13208
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Typography, { sx: { fontSize: "0.85rem", fontWeight: 600, color: "hsl(var(--foreground))", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: selectedAgentWorkflow.name }),
|
|
13209
|
+
selectedAgentWorkflow.description && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Typography, { sx: { fontSize: "0.75rem", color: "hsl(var(--muted-foreground))", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: selectedAgentWorkflow.description })
|
|
12609
13210
|
] }),
|
|
12610
|
-
/* @__PURE__ */ (0,
|
|
12611
|
-
|
|
13211
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
13212
|
+
import_material20.Button,
|
|
12612
13213
|
{
|
|
12613
13214
|
size: "small",
|
|
12614
|
-
startIcon: /* @__PURE__ */ (0,
|
|
13215
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react14.Pencil, { size: 14 }),
|
|
12615
13216
|
onClick: openEditPrompt,
|
|
12616
13217
|
sx: {
|
|
12617
13218
|
height: 36,
|
|
@@ -12626,11 +13227,11 @@ var AgentActivityList = ({
|
|
|
12626
13227
|
children: "Edit"
|
|
12627
13228
|
}
|
|
12628
13229
|
),
|
|
12629
|
-
/* @__PURE__ */ (0,
|
|
12630
|
-
|
|
13230
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
13231
|
+
import_material20.Button,
|
|
12631
13232
|
{
|
|
12632
13233
|
size: "small",
|
|
12633
|
-
startIcon: /* @__PURE__ */ (0,
|
|
13234
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react14.StopCircle, { size: 14 }),
|
|
12634
13235
|
onClick: () => setStopOpen(true),
|
|
12635
13236
|
sx: {
|
|
12636
13237
|
height: 36,
|
|
@@ -12648,17 +13249,17 @@ var AgentActivityList = ({
|
|
|
12648
13249
|
]
|
|
12649
13250
|
}
|
|
12650
13251
|
),
|
|
12651
|
-
isLoading && runs.length === 0 ? /* @__PURE__ */ (0,
|
|
12652
|
-
/* @__PURE__ */ (0,
|
|
12653
|
-
/* @__PURE__ */ (0,
|
|
12654
|
-
|
|
13252
|
+
isLoading && runs.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Box, { sx: { display: "flex", justifyContent: "center", py: 8 }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.CircularProgress, { size: 28, sx: { color: "hsl(var(--primary))" } }) }) : error ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.Box, { sx: { display: "flex", flexDirection: "column", alignItems: "center", textAlign: "center", py: 6 }, children: [
|
|
13253
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.AlertCircle, { size: 28, style: { color: "hsl(var(--severity-critical, 0 72% 55%))", marginBottom: 8 } }),
|
|
13254
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
13255
|
+
import_material20.Typography,
|
|
12655
13256
|
{
|
|
12656
13257
|
sx: { color: "hsl(var(--severity-critical, 0 72% 55%))", fontSize: "0.9rem", mb: 1 },
|
|
12657
13258
|
children: error
|
|
12658
13259
|
}
|
|
12659
13260
|
),
|
|
12660
|
-
/* @__PURE__ */ (0,
|
|
12661
|
-
|
|
13261
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
13262
|
+
import_material20.Button,
|
|
12662
13263
|
{
|
|
12663
13264
|
size: "small",
|
|
12664
13265
|
onClick: () => fetchRuns(false, ""),
|
|
@@ -12666,24 +13267,24 @@ var AgentActivityList = ({
|
|
|
12666
13267
|
children: "Try again"
|
|
12667
13268
|
}
|
|
12668
13269
|
)
|
|
12669
|
-
] }) : filteredRuns.length === 0 ? /* @__PURE__ */ (0,
|
|
12670
|
-
/* @__PURE__ */ (0,
|
|
13270
|
+
] }) : filteredRuns.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.Box, { sx: { display: "flex", flexDirection: "column", alignItems: "center", textAlign: "center", py: 8 }, children: [
|
|
13271
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12671
13272
|
import_lucide_react13.Activity,
|
|
12672
13273
|
{
|
|
12673
13274
|
size: 40,
|
|
12674
13275
|
style: { color: "hsl(var(--muted-foreground))", marginBottom: 12 }
|
|
12675
13276
|
}
|
|
12676
13277
|
),
|
|
12677
|
-
/* @__PURE__ */ (0,
|
|
12678
|
-
/* @__PURE__ */ (0,
|
|
12679
|
-
|
|
13278
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Typography, { sx: { color: "hsl(var(--muted-foreground))", fontSize: "0.9rem" }, children: emptyTitle }),
|
|
13279
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
13280
|
+
import_material20.Typography,
|
|
12680
13281
|
{
|
|
12681
13282
|
sx: { color: "hsl(var(--muted-foreground))", fontSize: "0.8rem", mt: 0.5, opacity: 0.7 },
|
|
12682
13283
|
children: emptySubtitle
|
|
12683
13284
|
}
|
|
12684
13285
|
)
|
|
12685
|
-
] }) : /* @__PURE__ */ (0,
|
|
12686
|
-
filteredRuns.map((run, idx) => /* @__PURE__ */ (0,
|
|
13286
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.Box, { sx: { display: "flex", flexDirection: "column", gap: 1.5 }, children: [
|
|
13287
|
+
filteredRuns.map((run, idx) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12687
13288
|
AgentRunRow,
|
|
12688
13289
|
{
|
|
12689
13290
|
run,
|
|
@@ -12692,43 +13293,43 @@ var AgentActivityList = ({
|
|
|
12692
13293
|
},
|
|
12693
13294
|
run.execution_id || idx
|
|
12694
13295
|
)),
|
|
12695
|
-
hasMore && /* @__PURE__ */ (0,
|
|
12696
|
-
|
|
13296
|
+
hasMore && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Box, { sx: { display: "flex", justifyContent: "center", mt: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
13297
|
+
import_material20.Button,
|
|
12697
13298
|
{
|
|
12698
13299
|
size: "small",
|
|
12699
13300
|
onClick: loadMore,
|
|
12700
13301
|
disabled: isLoading,
|
|
12701
13302
|
sx: { color: "hsl(var(--primary))", textTransform: "none", fontSize: "0.8rem" },
|
|
12702
13303
|
children: [
|
|
12703
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
13304
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.CircularProgress, { size: 14, sx: { mr: 1 } }) : null,
|
|
12704
13305
|
"Load more"
|
|
12705
13306
|
]
|
|
12706
13307
|
}
|
|
12707
13308
|
) })
|
|
12708
13309
|
] }),
|
|
12709
|
-
/* @__PURE__ */ (0,
|
|
12710
|
-
|
|
13310
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
13311
|
+
import_material20.Dialog,
|
|
12711
13312
|
{
|
|
12712
13313
|
open: stopOpen,
|
|
12713
13314
|
onClose: () => stopLoading ? null : setStopOpen(false),
|
|
12714
13315
|
slotProps: { paper: { sx: { bgcolor: "hsl(var(--card))", color: "hsl(var(--foreground))", border: "1px solid hsl(var(--border))" } } },
|
|
12715
13316
|
children: [
|
|
12716
|
-
/* @__PURE__ */ (0,
|
|
12717
|
-
/* @__PURE__ */ (0,
|
|
13317
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.DialogTitle, { sx: { fontSize: "1rem", fontWeight: 600 }, children: "Stop schedule?" }),
|
|
13318
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.DialogContent, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.Typography, { sx: { fontSize: "0.85rem", color: "hsl(var(--muted-foreground))" }, children: [
|
|
12718
13319
|
'This will stop "',
|
|
12719
13320
|
selectedAgentWorkflow?.name,
|
|
12720
13321
|
'" and delete the scheduled workflow. Past executions remain visible. This cannot be undone.'
|
|
12721
13322
|
] }) }),
|
|
12722
|
-
/* @__PURE__ */ (0,
|
|
12723
|
-
/* @__PURE__ */ (0,
|
|
12724
|
-
/* @__PURE__ */ (0,
|
|
12725
|
-
|
|
13323
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.DialogActions, { sx: { px: 3, pb: 2 }, children: [
|
|
13324
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Button, { onClick: () => setStopOpen(false), disabled: stopLoading, sx: { textTransform: "none", color: "hsl(var(--muted-foreground))" }, children: "Cancel" }),
|
|
13325
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
13326
|
+
import_material20.Button,
|
|
12726
13327
|
{
|
|
12727
13328
|
onClick: confirmStop,
|
|
12728
13329
|
disabled: stopLoading,
|
|
12729
13330
|
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)" } },
|
|
12730
13331
|
children: [
|
|
12731
|
-
stopLoading ? /* @__PURE__ */ (0,
|
|
13332
|
+
stopLoading ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.CircularProgress, { size: 16, sx: { color: "hsl(var(--primary-foreground))", mr: 1 } }) : null,
|
|
12732
13333
|
"Stop schedule"
|
|
12733
13334
|
]
|
|
12734
13335
|
}
|
|
@@ -12744,9 +13345,9 @@ var AgentActivityList = ({
|
|
|
12744
13345
|
var AgentActivityList_default = AgentActivityList;
|
|
12745
13346
|
|
|
12746
13347
|
// components/AgentExecutionDrawer.tsx
|
|
12747
|
-
var
|
|
13348
|
+
var import_material21 = require("@mui/material");
|
|
12748
13349
|
var import_lucide_react15 = require("lucide-react");
|
|
12749
|
-
var
|
|
13350
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
12750
13351
|
var AgentExecutionDrawer = ({
|
|
12751
13352
|
open,
|
|
12752
13353
|
onClose,
|
|
@@ -12768,8 +13369,8 @@ var AgentExecutionDrawer = ({
|
|
|
12768
13369
|
const statusKey = (run?.status || "").toUpperCase();
|
|
12769
13370
|
const cfg = STATUS_CONFIG[statusKey] || STATUS_CONFIG.WAITING;
|
|
12770
13371
|
const duration = run ? formatDuration(run) : "";
|
|
12771
|
-
return /* @__PURE__ */ (0,
|
|
12772
|
-
|
|
13372
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
13373
|
+
import_material21.Drawer,
|
|
12773
13374
|
{
|
|
12774
13375
|
anchor: "right",
|
|
12775
13376
|
open,
|
|
@@ -12791,8 +13392,8 @@ var AgentExecutionDrawer = ({
|
|
|
12791
13392
|
}
|
|
12792
13393
|
},
|
|
12793
13394
|
children: [
|
|
12794
|
-
/* @__PURE__ */ (0,
|
|
12795
|
-
|
|
13395
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
13396
|
+
import_material21.Box,
|
|
12796
13397
|
{
|
|
12797
13398
|
sx: [
|
|
12798
13399
|
{
|
|
@@ -12810,8 +13411,8 @@ var AgentExecutionDrawer = ({
|
|
|
12810
13411
|
...Array.isArray(headerSx) ? headerSx : headerSx ? [headerSx] : []
|
|
12811
13412
|
],
|
|
12812
13413
|
children: [
|
|
12813
|
-
/* @__PURE__ */ (0,
|
|
12814
|
-
|
|
13414
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
13415
|
+
import_material21.Box,
|
|
12815
13416
|
{
|
|
12816
13417
|
sx: {
|
|
12817
13418
|
width: 36,
|
|
@@ -12824,13 +13425,13 @@ var AgentExecutionDrawer = ({
|
|
|
12824
13425
|
color: "hsl(var(--primary))",
|
|
12825
13426
|
flexShrink: 0
|
|
12826
13427
|
},
|
|
12827
|
-
children: /* @__PURE__ */ (0,
|
|
13428
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AgentIcon_default, { size: 20 })
|
|
12828
13429
|
}
|
|
12829
13430
|
),
|
|
12830
|
-
/* @__PURE__ */ (0,
|
|
12831
|
-
/* @__PURE__ */ (0,
|
|
12832
|
-
/* @__PURE__ */ (0,
|
|
12833
|
-
|
|
13431
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material21.Box, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
13432
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material21.Box, { sx: { display: "flex", alignItems: "center", gap: 1, minWidth: 0 }, children: [
|
|
13433
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
13434
|
+
import_material21.Typography,
|
|
12834
13435
|
{
|
|
12835
13436
|
sx: {
|
|
12836
13437
|
fontSize: "0.95rem",
|
|
@@ -12843,22 +13444,22 @@ var AgentExecutionDrawer = ({
|
|
|
12843
13444
|
children: run ? getRunTitle(run) : "Agent execution"
|
|
12844
13445
|
}
|
|
12845
13446
|
),
|
|
12846
|
-
run && /* @__PURE__ */ (0,
|
|
13447
|
+
run && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Box, { sx: { display: "flex", alignItems: "center", color: cfg.color, flexShrink: 0 }, children: cfg.icon })
|
|
12847
13448
|
] }),
|
|
12848
|
-
run && /* @__PURE__ */ (0,
|
|
12849
|
-
/* @__PURE__ */ (0,
|
|
12850
|
-
run.started_at && /* @__PURE__ */ (0,
|
|
12851
|
-
/* @__PURE__ */ (0,
|
|
12852
|
-
/* @__PURE__ */ (0,
|
|
13449
|
+
run && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material21.Box, { sx: { display: "flex", alignItems: "center", gap: 1, mt: 0.25 }, children: [
|
|
13450
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))" }, children: cfg.label }),
|
|
13451
|
+
run.started_at && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
13452
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.4 }, children: "\xB7" }),
|
|
13453
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))" }, children: getTimeAgo(run.started_at) })
|
|
12853
13454
|
] }),
|
|
12854
|
-
duration && /* @__PURE__ */ (0,
|
|
12855
|
-
/* @__PURE__ */ (0,
|
|
12856
|
-
/* @__PURE__ */ (0,
|
|
13455
|
+
duration && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
13456
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.4 }, children: "\xB7" }),
|
|
13457
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))" }, children: duration })
|
|
12857
13458
|
] })
|
|
12858
13459
|
] })
|
|
12859
13460
|
] }),
|
|
12860
|
-
run?.execution_id && /* @__PURE__ */ (0,
|
|
12861
|
-
|
|
13461
|
+
run?.execution_id && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Tooltip, { title: "Open in new tab", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
13462
|
+
import_material21.IconButton,
|
|
12862
13463
|
{
|
|
12863
13464
|
component: "a",
|
|
12864
13465
|
href: `/agents?execution_id=${encodeURIComponent(run.execution_id)}${run.authorization ? `&authorization=${encodeURIComponent(run.authorization)}` : ""}`,
|
|
@@ -12869,11 +13470,11 @@ var AgentExecutionDrawer = ({
|
|
|
12869
13470
|
color: "hsl(var(--muted-foreground))",
|
|
12870
13471
|
"&:hover": { color: "hsl(var(--foreground))", bgcolor: "hsl(var(--muted))" }
|
|
12871
13472
|
},
|
|
12872
|
-
children: /* @__PURE__ */ (0,
|
|
13473
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react15.ExternalLink, { size: 16 })
|
|
12873
13474
|
}
|
|
12874
13475
|
) }),
|
|
12875
|
-
/* @__PURE__ */ (0,
|
|
12876
|
-
|
|
13476
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Tooltip, { title: "Close", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
13477
|
+
import_material21.IconButton,
|
|
12877
13478
|
{
|
|
12878
13479
|
onClick: onClose,
|
|
12879
13480
|
size: "small",
|
|
@@ -12881,15 +13482,15 @@ var AgentExecutionDrawer = ({
|
|
|
12881
13482
|
color: "hsl(var(--muted-foreground))",
|
|
12882
13483
|
"&:hover": { color: "hsl(var(--foreground))", bgcolor: "hsl(var(--muted))" }
|
|
12883
13484
|
},
|
|
12884
|
-
children: /* @__PURE__ */ (0,
|
|
13485
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react15.X, { size: 16 })
|
|
12885
13486
|
}
|
|
12886
13487
|
) })
|
|
12887
13488
|
]
|
|
12888
13489
|
}
|
|
12889
13490
|
),
|
|
12890
|
-
/* @__PURE__ */ (0,
|
|
13491
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material21.Box, { sx: [{ flex: 1, overflowY: "auto", pt: 3 }, ...Array.isArray(bodySx) ? bodySx : bodySx ? [bodySx] : []], children: [
|
|
12891
13492
|
topBanner,
|
|
12892
|
-
run ? /* @__PURE__ */ (0,
|
|
13493
|
+
run ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
12893
13494
|
AgentUI_default,
|
|
12894
13495
|
{
|
|
12895
13496
|
initialExecution: {
|
|
@@ -12926,9 +13527,9 @@ var AgentExecutionDrawer = ({
|
|
|
12926
13527
|
var AgentExecutionDrawer_default = AgentExecutionDrawer;
|
|
12927
13528
|
|
|
12928
13529
|
// views/AgentsView.tsx
|
|
12929
|
-
var
|
|
12930
|
-
var
|
|
12931
|
-
var
|
|
13530
|
+
var import_react20 = require("react");
|
|
13531
|
+
var import_material22 = require("@mui/material");
|
|
13532
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
12932
13533
|
var AgentsView = ({
|
|
12933
13534
|
onSchedule,
|
|
12934
13535
|
maxWidth = 820,
|
|
@@ -12942,45 +13543,54 @@ var AgentsView = ({
|
|
|
12942
13543
|
userdata,
|
|
12943
13544
|
serverside,
|
|
12944
13545
|
theme,
|
|
12945
|
-
colorMode
|
|
13546
|
+
colorMode,
|
|
13547
|
+
apiKey,
|
|
13548
|
+
orgId
|
|
12946
13549
|
}) => {
|
|
12947
13550
|
useSyncHostBaseUrl(globalUrl);
|
|
12948
|
-
const [selectedRun, setSelectedRun] = (0,
|
|
12949
|
-
const [agentView, setAgentView] = (0,
|
|
12950
|
-
const [prefill, setPrefill] = (0,
|
|
13551
|
+
const [selectedRun, setSelectedRun] = (0, import_react20.useState)(null);
|
|
13552
|
+
const [agentView, setAgentView] = (0, import_react20.useState)("start");
|
|
13553
|
+
const [prefill, setPrefill] = (0, import_react20.useState)({
|
|
12951
13554
|
input: "",
|
|
12952
13555
|
apps: [],
|
|
12953
13556
|
key: 0
|
|
12954
13557
|
});
|
|
12955
|
-
const [editing, setEditing] = (0,
|
|
12956
|
-
const [builtInDrawer, setBuiltInDrawer] = (0,
|
|
13558
|
+
const [editing, setEditing] = (0, import_react20.useState)(null);
|
|
13559
|
+
const [builtInDrawer, setBuiltInDrawer] = (0, import_react20.useState)({
|
|
12957
13560
|
open: false,
|
|
12958
13561
|
tab: "localLLM"
|
|
12959
13562
|
});
|
|
12960
|
-
const
|
|
12961
|
-
() =>
|
|
12962
|
-
|
|
12963
|
-
|
|
12964
|
-
|
|
12965
|
-
|
|
12966
|
-
" handler or a",
|
|
12967
|
-
" ",
|
|
12968
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("code", { style: { fontFamily: "monospace" }, children: "localLLMSlot" }),
|
|
12969
|
-
" to",
|
|
12970
|
-
" ",
|
|
12971
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("code", { style: { fontFamily: "monospace" }, children: "<AgentsView />" }),
|
|
12972
|
-
" to render your own configuration UI here."
|
|
12973
|
-
] }),
|
|
12974
|
-
[localLLMSlot]
|
|
13563
|
+
const effectiveSchedule = (0, import_react20.useCallback)(
|
|
13564
|
+
async (info) => {
|
|
13565
|
+
if (onSchedule) return onSchedule(info);
|
|
13566
|
+
await scheduleAgentRun({ ...info, apiKey, apiBaseUrl: globalUrl, orgId });
|
|
13567
|
+
},
|
|
13568
|
+
[onSchedule, apiKey, globalUrl, orgId]
|
|
12975
13569
|
);
|
|
12976
|
-
const
|
|
13570
|
+
const effectiveLocalLLMSlot = (0, import_react20.useMemo)(
|
|
13571
|
+
() => localLLMSlot ?? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
13572
|
+
LocalLLMConfig_default,
|
|
13573
|
+
{
|
|
13574
|
+
compact: true,
|
|
13575
|
+
globalUrl,
|
|
13576
|
+
userdata,
|
|
13577
|
+
isLoaded,
|
|
13578
|
+
isLoggedIn,
|
|
13579
|
+
serverside,
|
|
13580
|
+
theme,
|
|
13581
|
+
colorMode
|
|
13582
|
+
}
|
|
13583
|
+
),
|
|
13584
|
+
[localLLMSlot, globalUrl, userdata, isLoaded, isLoggedIn, serverside, theme, colorMode]
|
|
13585
|
+
);
|
|
13586
|
+
const handleChooseLLM = (0, import_react20.useCallback)(() => {
|
|
12977
13587
|
if (onChooseLLM) {
|
|
12978
13588
|
onChooseLLM();
|
|
12979
13589
|
return;
|
|
12980
13590
|
}
|
|
12981
13591
|
setBuiltInDrawer({ open: true, tab: "localLLM" });
|
|
12982
13592
|
}, [onChooseLLM]);
|
|
12983
|
-
const handleEditWorkflow = (0,
|
|
13593
|
+
const handleEditWorkflow = (0, import_react20.useCallback)(
|
|
12984
13594
|
({ workflowId, name, prompt, apps }) => {
|
|
12985
13595
|
setEditing({ workflowId, name });
|
|
12986
13596
|
setPrefill((prev) => ({
|
|
@@ -12992,7 +13602,7 @@ var AgentsView = ({
|
|
|
12992
13602
|
},
|
|
12993
13603
|
[]
|
|
12994
13604
|
);
|
|
12995
|
-
const handleSaveEdit = (0,
|
|
13605
|
+
const handleSaveEdit = (0, import_react20.useCallback)(
|
|
12996
13606
|
async ({ input, apps }) => {
|
|
12997
13607
|
if (!editing) return;
|
|
12998
13608
|
try {
|
|
@@ -13012,10 +13622,10 @@ var AgentsView = ({
|
|
|
13012
13622
|
},
|
|
13013
13623
|
[editing]
|
|
13014
13624
|
);
|
|
13015
|
-
return /* @__PURE__ */ (0,
|
|
13016
|
-
/* @__PURE__ */ (0,
|
|
13017
|
-
editing && /* @__PURE__ */ (0,
|
|
13018
|
-
|
|
13625
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_material22.Box, { sx: { minHeight: "100%", width: "100%", px: { xs: 2, md: 4 }, pt: { xs: 3, md: "5vh" }, pb: 6, boxSizing: "border-box" }, children: [
|
|
13626
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_material22.Stack, { spacing: 6, sx: { maxWidth, mx: "auto", width: "100%" }, children: [
|
|
13627
|
+
editing && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
13628
|
+
import_material22.Box,
|
|
13019
13629
|
{
|
|
13020
13630
|
sx: {
|
|
13021
13631
|
display: "flex",
|
|
@@ -13028,12 +13638,12 @@ var AgentsView = ({
|
|
|
13028
13638
|
bgcolor: "hsl(var(--primary) / 0.08)"
|
|
13029
13639
|
},
|
|
13030
13640
|
children: [
|
|
13031
|
-
/* @__PURE__ */ (0,
|
|
13641
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_material22.Typography, { sx: { fontSize: "0.85rem", color: "hsl(var(--foreground))" }, children: [
|
|
13032
13642
|
"Editing schedule: ",
|
|
13033
|
-
/* @__PURE__ */ (0,
|
|
13643
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("strong", { children: editing.name })
|
|
13034
13644
|
] }),
|
|
13035
|
-
/* @__PURE__ */ (0,
|
|
13036
|
-
|
|
13645
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
13646
|
+
import_material22.Typography,
|
|
13037
13647
|
{
|
|
13038
13648
|
component: "button",
|
|
13039
13649
|
onClick: () => {
|
|
@@ -13053,13 +13663,15 @@ var AgentsView = ({
|
|
|
13053
13663
|
]
|
|
13054
13664
|
}
|
|
13055
13665
|
),
|
|
13056
|
-
/* @__PURE__ */ (0,
|
|
13666
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
13057
13667
|
AgentUI_default,
|
|
13058
13668
|
{
|
|
13059
13669
|
maxWidth,
|
|
13060
13670
|
apiBaseUrl: globalUrl,
|
|
13061
13671
|
onViewChange: setAgentView,
|
|
13062
|
-
onSchedule,
|
|
13672
|
+
onSchedule: effectiveSchedule,
|
|
13673
|
+
apiKey,
|
|
13674
|
+
orgId,
|
|
13063
13675
|
onChooseLLM: handleChooseLLM,
|
|
13064
13676
|
hideChooseLLM,
|
|
13065
13677
|
defaultInput: prefill.input,
|
|
@@ -13074,28 +13686,32 @@ var AgentsView = ({
|
|
|
13074
13686
|
},
|
|
13075
13687
|
prefill.key
|
|
13076
13688
|
),
|
|
13077
|
-
agentView === "start" && /* @__PURE__ */ (0,
|
|
13689
|
+
agentView === "start" && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material22.Box, { sx: { pt: { xs: 4, md: "8vh" } }, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
13078
13690
|
AgentActivityList_default,
|
|
13079
13691
|
{
|
|
13080
13692
|
apiBaseUrl: globalUrl,
|
|
13693
|
+
apiKey,
|
|
13694
|
+
orgId,
|
|
13081
13695
|
onRunClick: setSelectedRun,
|
|
13082
13696
|
onEditWorkflow: handleEditWorkflow
|
|
13083
13697
|
}
|
|
13084
13698
|
) })
|
|
13085
13699
|
] }),
|
|
13086
|
-
/* @__PURE__ */ (0,
|
|
13700
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
13087
13701
|
AgentExecutionDrawer_default,
|
|
13088
13702
|
{
|
|
13089
13703
|
open: selectedRun !== null,
|
|
13090
13704
|
onClose: () => setSelectedRun(null),
|
|
13091
13705
|
run: selectedRun,
|
|
13092
13706
|
apiBaseUrl: globalUrl,
|
|
13093
|
-
onSchedule,
|
|
13707
|
+
onSchedule: effectiveSchedule,
|
|
13708
|
+
apiKey,
|
|
13709
|
+
orgId,
|
|
13094
13710
|
theme,
|
|
13095
13711
|
colorMode
|
|
13096
13712
|
}
|
|
13097
13713
|
),
|
|
13098
|
-
/* @__PURE__ */ (0,
|
|
13714
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
13099
13715
|
AgentRunDrawer_default,
|
|
13100
13716
|
{
|
|
13101
13717
|
open: builtInDrawer.open,
|
|
@@ -13106,7 +13722,7 @@ var AgentsView = ({
|
|
|
13106
13722
|
permissionsSlot,
|
|
13107
13723
|
theme,
|
|
13108
13724
|
colorMode,
|
|
13109
|
-
agentUIProps: { onSchedule, apiBaseUrl: globalUrl, theme, colorMode }
|
|
13725
|
+
agentUIProps: { onSchedule: effectiveSchedule, apiBaseUrl: globalUrl, apiKey, orgId, theme, colorMode }
|
|
13110
13726
|
}
|
|
13111
13727
|
)
|
|
13112
13728
|
] });
|
|
@@ -13114,14 +13730,14 @@ var AgentsView = ({
|
|
|
13114
13730
|
var AgentsView_default = AgentsView;
|
|
13115
13731
|
|
|
13116
13732
|
// useAppLookup.ts
|
|
13117
|
-
var
|
|
13733
|
+
var import_react21 = require("react");
|
|
13118
13734
|
init_api();
|
|
13119
13735
|
init_appsCache();
|
|
13120
13736
|
var norm3 = (s) => s.toLowerCase().replace(/[\s_\-]+/g, "_");
|
|
13121
13737
|
function useAppLookup(appName) {
|
|
13122
|
-
const [loading, setLoading] = (0,
|
|
13123
|
-
const [info, setInfo] = (0,
|
|
13124
|
-
const [algoliaId, setAlgoliaId] = (0,
|
|
13738
|
+
const [loading, setLoading] = (0, import_react21.useState)(false);
|
|
13739
|
+
const [info, setInfo] = (0, import_react21.useState)(null);
|
|
13740
|
+
const [algoliaId, setAlgoliaId] = (0, import_react21.useState)(null);
|
|
13125
13741
|
const {
|
|
13126
13742
|
authStates,
|
|
13127
13743
|
authenticatedApps,
|
|
@@ -13130,7 +13746,7 @@ function useAppLookup(appName) {
|
|
|
13130
13746
|
handleSaveAuth,
|
|
13131
13747
|
refreshAuth
|
|
13132
13748
|
} = useAppAuth();
|
|
13133
|
-
(0,
|
|
13749
|
+
(0, import_react21.useEffect)(() => {
|
|
13134
13750
|
if (!appName) {
|
|
13135
13751
|
setInfo(null);
|
|
13136
13752
|
setAlgoliaId(null);
|
|
@@ -13209,13 +13825,13 @@ function useAppLookup(appName) {
|
|
|
13209
13825
|
setLoading(false);
|
|
13210
13826
|
})();
|
|
13211
13827
|
}, [appName]);
|
|
13212
|
-
const matchingEntries = (0,
|
|
13828
|
+
const matchingEntries = (0, import_react21.useMemo)(() => {
|
|
13213
13829
|
if (!appName) return [];
|
|
13214
13830
|
return authenticatedApps.filter(
|
|
13215
13831
|
(auth) => auth.app?.name && norm3(auth.app.name) === norm3(appName)
|
|
13216
13832
|
);
|
|
13217
13833
|
}, [appName, authenticatedApps]);
|
|
13218
|
-
const image = (0,
|
|
13834
|
+
const image = (0, import_react21.useMemo)(() => {
|
|
13219
13835
|
if (info?.image) return info.image;
|
|
13220
13836
|
for (const entry of matchingEntries) {
|
|
13221
13837
|
const img = entry.app?.large_image || entry.large_image;
|
|
@@ -13223,7 +13839,7 @@ function useAppLookup(appName) {
|
|
|
13223
13839
|
}
|
|
13224
13840
|
return "";
|
|
13225
13841
|
}, [info, matchingEntries]);
|
|
13226
|
-
const algoliaApp = (0,
|
|
13842
|
+
const algoliaApp = (0, import_react21.useMemo)(() => {
|
|
13227
13843
|
if (!appName) return null;
|
|
13228
13844
|
return {
|
|
13229
13845
|
objectID: algoliaId || appName,
|
|
@@ -13258,108 +13874,27 @@ function useAppLookup(appName) {
|
|
|
13258
13874
|
init_api();
|
|
13259
13875
|
init_fetchBreaker();
|
|
13260
13876
|
init_appsCache();
|
|
13261
|
-
|
|
13262
|
-
// components/UsageBar.tsx
|
|
13263
|
-
var import_material21 = require("@mui/material");
|
|
13264
|
-
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
13265
|
-
var fmt = (n) => n.toLocaleString();
|
|
13266
|
-
var UsageBar = ({
|
|
13267
|
-
label,
|
|
13268
|
-
usage,
|
|
13269
|
-
limit,
|
|
13270
|
-
unit,
|
|
13271
|
-
hint,
|
|
13272
|
-
actionLabel,
|
|
13273
|
-
actionHref
|
|
13274
|
-
}) => {
|
|
13275
|
-
const safeLimit = Math.max(limit, 0);
|
|
13276
|
-
const pct = safeLimit > 0 ? usage / safeLimit * 100 : 0;
|
|
13277
|
-
const isOver = pct >= 100;
|
|
13278
|
-
const isWarn = pct >= 65 && !isOver;
|
|
13279
|
-
const accent = isOver ? "hsl(var(--destructive))" : isWarn ? "hsl(var(--severity-medium))" : "hsl(var(--muted-foreground))";
|
|
13280
|
-
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 : ""}`;
|
|
13281
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Tooltip, { title: tooltipText, placement: "top", arrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material21.Box, { sx: { display: "flex", flexDirection: "column", gap: 0.5, py: 0.25 }, children: [
|
|
13282
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material21.Box, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 1 }, children: [
|
|
13283
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
13284
|
-
import_material21.Typography,
|
|
13285
|
-
{
|
|
13286
|
-
sx: {
|
|
13287
|
-
fontSize: "12.8px",
|
|
13288
|
-
fontWeight: 500,
|
|
13289
|
-
color: "hsl(var(--muted-foreground))",
|
|
13290
|
-
lineHeight: 1.2
|
|
13291
|
-
},
|
|
13292
|
-
children: label
|
|
13293
|
-
}
|
|
13294
|
-
),
|
|
13295
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material21.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
13296
|
-
actionLabel && actionHref && (isWarn || isOver) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
13297
|
-
import_material21.Box,
|
|
13298
|
-
{
|
|
13299
|
-
component: "a",
|
|
13300
|
-
href: actionHref,
|
|
13301
|
-
target: "_blank",
|
|
13302
|
-
rel: "noopener noreferrer",
|
|
13303
|
-
sx: {
|
|
13304
|
-
fontSize: "12.8px",
|
|
13305
|
-
fontWeight: 600,
|
|
13306
|
-
color: accent,
|
|
13307
|
-
textDecoration: "none",
|
|
13308
|
-
"&:hover": { textDecoration: "underline" }
|
|
13309
|
-
},
|
|
13310
|
-
children: actionLabel
|
|
13311
|
-
}
|
|
13312
|
-
),
|
|
13313
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
13314
|
-
import_material21.Typography,
|
|
13315
|
-
{
|
|
13316
|
-
sx: {
|
|
13317
|
-
fontSize: "12.8px",
|
|
13318
|
-
fontWeight: 500,
|
|
13319
|
-
color: accent,
|
|
13320
|
-
whiteSpace: "nowrap",
|
|
13321
|
-
fontVariantNumeric: "tabular-nums"
|
|
13322
|
-
},
|
|
13323
|
-
children: safeLimit > 0 ? `${fmt(usage)} / ${fmt(safeLimit)}${unit ? " " + unit : ""}` : `${fmt(usage)}${unit ? " " + unit : ""}`
|
|
13324
|
-
}
|
|
13325
|
-
)
|
|
13326
|
-
] })
|
|
13327
|
-
] }),
|
|
13328
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Box, { sx: { width: "100%", height: 2, bgcolor: "hsl(var(--muted) / 0.5)", borderRadius: 1, overflow: "hidden" }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
13329
|
-
import_material21.Box,
|
|
13330
|
-
{
|
|
13331
|
-
sx: {
|
|
13332
|
-
width: `${Math.min(Math.max(pct, 0), 100)}%`,
|
|
13333
|
-
height: "100%",
|
|
13334
|
-
bgcolor: isOver ? "hsl(var(--destructive))" : isWarn ? "hsl(var(--severity-medium))" : "hsl(var(--severity-low, 142 71% 45%))",
|
|
13335
|
-
transition: "width 0.3s ease"
|
|
13336
|
-
}
|
|
13337
|
-
}
|
|
13338
|
-
) })
|
|
13339
|
-
] }) });
|
|
13340
|
-
};
|
|
13341
|
-
|
|
13342
|
-
// index.ts
|
|
13343
13877
|
var resolveMode = (theme, colorMode) => {
|
|
13344
13878
|
if (theme === "light" || theme === "dark") return theme;
|
|
13345
13879
|
if (theme === "system") return "auto";
|
|
13346
|
-
|
|
13880
|
+
if (colorMode) return colorMode;
|
|
13881
|
+
return "dark";
|
|
13347
13882
|
};
|
|
13348
13883
|
var withMcpTheme = (Inner, displayName) => {
|
|
13349
|
-
const Wrapped = ({ theme, colorMode, ...rest }) =>
|
|
13884
|
+
const Wrapped = ({ theme, colorMode, ...rest }) => import_react22.default.createElement(
|
|
13350
13885
|
ShuffleMcpThemeProvider,
|
|
13351
13886
|
{ mode: resolveMode(theme, colorMode) },
|
|
13352
|
-
|
|
13887
|
+
import_react22.default.createElement(Inner, { ...rest, theme, colorMode })
|
|
13353
13888
|
);
|
|
13354
13889
|
Wrapped.displayName = `ShuffleMCPs(${displayName})`;
|
|
13355
13890
|
return Wrapped;
|
|
13356
13891
|
};
|
|
13357
13892
|
var withMcpThemeRef = (Inner, displayName) => {
|
|
13358
|
-
const Wrapped =
|
|
13359
|
-
({ theme, colorMode, ...rest }, ref) =>
|
|
13893
|
+
const Wrapped = import_react22.default.forwardRef(
|
|
13894
|
+
({ theme, colorMode, ...rest }, ref) => import_react22.default.createElement(
|
|
13360
13895
|
ShuffleMcpThemeProvider,
|
|
13361
13896
|
{ mode: resolveMode(theme, colorMode) },
|
|
13362
|
-
|
|
13897
|
+
import_react22.default.createElement(Inner, { ...rest, theme, colorMode, ref })
|
|
13363
13898
|
)
|
|
13364
13899
|
);
|
|
13365
13900
|
Wrapped.displayName = `ShuffleMCPs(${displayName})`;
|
|
@@ -13381,6 +13916,7 @@ var AgentActivityList2 = withMcpTheme(AgentActivityList_default, "AgentActivityL
|
|
|
13381
13916
|
var AgentExecutionDrawer2 = withMcpTheme(AgentExecutionDrawer_default, "AgentExecutionDrawer");
|
|
13382
13917
|
var AgentsView2 = withMcpTheme(AgentsView_default, "AgentsView");
|
|
13383
13918
|
var AgentRunDiagnosisBanner2 = withMcpTheme(AgentRunDiagnosisBanner_default, "AgentRunDiagnosisBanner");
|
|
13919
|
+
var LocalLLMConfig2 = withMcpTheme(LocalLLMConfig_default, "LocalLLMConfig");
|
|
13384
13920
|
// Annotate the CommonJS export names for ESM import in node:
|
|
13385
13921
|
0 && (module.exports = {
|
|
13386
13922
|
API_CONFIG,
|
|
@@ -13407,6 +13943,7 @@ var AgentRunDiagnosisBanner2 = withMcpTheme(AgentRunDiagnosisBanner_default, "Ag
|
|
|
13407
13943
|
FORWARD_TICKETS_WORKFLOW_NAME,
|
|
13408
13944
|
INGEST_TICKETS_WORKFLOW_NAME,
|
|
13409
13945
|
IntegrationStatus,
|
|
13946
|
+
LocalLLMConfig,
|
|
13410
13947
|
SIEM_PATTERNS,
|
|
13411
13948
|
ShuffleMCP,
|
|
13412
13949
|
ShuffleMcpThemeProvider,
|
|
@@ -13452,6 +13989,7 @@ var AgentRunDiagnosisBanner2 = withMcpTheme(AgentRunDiagnosisBanner_default, "Ag
|
|
|
13452
13989
|
resetRegionUrl,
|
|
13453
13990
|
resolveApp,
|
|
13454
13991
|
resolveApps,
|
|
13992
|
+
scheduleAgentRun,
|
|
13455
13993
|
searchAgentActivity,
|
|
13456
13994
|
seedResolvedApp,
|
|
13457
13995
|
setDatastoreItem,
|