@shuffleio/shuffle-mcps 0.0.22 → 0.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.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 import_react20 = __toESM(require("react"));
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
- sx: {
5894
- "& .MuiDrawer-paper": {
5895
- width,
5896
- maxWidth: "100vw",
5897
- background: "linear-gradient(180deg, hsl(var(--card)) 0%, hsl(var(--background)) 100%)",
5898
- borderLeft: anchor === "right" ? "1px solid hsl(var(--border))" : "none",
5899
- borderRight: anchor === "left" ? "1px solid hsl(var(--border))" : "none"
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)(SingulActionsPreview_default, { appName: appName || "", appIcon: resolvedImage, categories: appInfo?.categories, activeOrgId })
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
  ]
@@ -6235,6 +6312,7 @@ var ShuffleMCP = import_react12.default.forwardRef(({
6235
6312
  showCheckbox = false,
6236
6313
  multiSelect = false,
6237
6314
  selectedApps = EMPTY_SELECTED_APPS,
6315
+ disableAutoSelectValidatedApps = false,
6238
6316
  preventDefault = false,
6239
6317
  inline = false,
6240
6318
  initialQuery = "",
@@ -6345,6 +6423,7 @@ var ShuffleMCP = import_react12.default.forwardRef(({
6345
6423
  fetchPrivateApps();
6346
6424
  }, [apiKey, apiBaseUrl, privateAppsPath, disablePrivateApps, orgId]);
6347
6425
  (0, import_react12.useEffect)(() => {
6426
+ if (disableAutoSelectValidatedApps) return;
6348
6427
  if (authenticatedApps.length > 0 && results.length > 0) {
6349
6428
  const validatedApps = authenticatedApps.filter((auth) => auth.validation?.valid);
6350
6429
  const appsToAutoSelect = results.filter(
@@ -6363,7 +6442,7 @@ var ShuffleMCP = import_react12.default.forwardRef(({
6363
6442
  }
6364
6443
  }
6365
6444
  }
6366
- }, [authenticatedApps, results]);
6445
+ }, [authenticatedApps, results, disableAutoSelectValidatedApps]);
6367
6446
  (0, import_react12.useEffect)(() => {
6368
6447
  if (externalAuthenticatedApps) {
6369
6448
  setAuthenticatedApps(externalAuthenticatedApps);
@@ -6861,8 +6940,13 @@ function AppSearchDrawer({
6861
6940
  highlightDelayMs = 5e3,
6862
6941
  multiSelect = false,
6863
6942
  selectedApps,
6864
- onSelectionChange
6943
+ onSelectionChange,
6944
+ globalUrl,
6945
+ theme,
6946
+ colorMode
6865
6947
  }) {
6948
+ const themeScope = useShuffleMcpTheme();
6949
+ const scopeClassName = themeScope?.scopeClassName ?? (theme === "dark" ? "shuffle-mcp-scope dark" : theme === "light" ? "shuffle-mcp-scope" : void 0);
6866
6950
  const [detailAppName, setDetailAppName] = (0, import_react13.useState)(null);
6867
6951
  const [detailAppId, setDetailAppId] = (0, import_react13.useState)(null);
6868
6952
  const [highlightActive, setHighlightActive] = (0, import_react13.useState)(false);
@@ -6948,19 +7032,25 @@ function AppSearchDrawer({
6948
7032
  anchor,
6949
7033
  open: open && detailAppName === null,
6950
7034
  onClose: handleClose,
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
+ },
6951
7051
  sx: {
6952
7052
  zIndex: 9999,
6953
- "& .MuiDrawer-paper": {
6954
- width,
6955
- maxWidth: "100vw",
6956
- height: "100vh",
6957
- display: "flex",
6958
- flexDirection: "column",
6959
- overflow: "hidden",
6960
- background: "linear-gradient(180deg, hsl(var(--card)) 0%, hsl(var(--background)) 100%)",
6961
- borderLeft: anchor === "right" ? "1px solid hsl(var(--border))" : "none",
6962
- borderRight: anchor === "left" ? "1px solid hsl(var(--border))" : "none"
6963
- }
7053
+ "& .MuiDrawer-paper": { boxSizing: "border-box" }
6964
7054
  },
6965
7055
  children: [
6966
7056
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
@@ -7056,14 +7146,16 @@ function AppSearchDrawer({
7056
7146
  overflowY: "auto"
7057
7147
  },
7058
7148
  "& .singul-results-grid": {
7059
- gridAutoRows: "75px",
7149
+ gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
7150
+ gridAutoRows: "88px",
7060
7151
  gap: "12px"
7061
7152
  },
7062
7153
  "& .singul-results-grid .singul-dropdown-item": {
7063
- minHeight: 75,
7064
- maxHeight: 75,
7065
- height: 75,
7066
- padding: "14px 16px",
7154
+ minWidth: 0,
7155
+ minHeight: 88,
7156
+ maxHeight: 88,
7157
+ height: 88,
7158
+ padding: "12px 14px",
7067
7159
  alignItems: "center",
7068
7160
  overflow: "hidden"
7069
7161
  },
@@ -7072,11 +7164,14 @@ function AppSearchDrawer({
7072
7164
  gap: "12px"
7073
7165
  },
7074
7166
  "& .singul-results-grid .singul-app-icon": {
7075
- width: 40,
7076
- height: 40,
7167
+ width: 36,
7168
+ height: 36,
7077
7169
  borderRadius: 8,
7078
7170
  padding: 4
7079
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" },
7080
7175
  ...highlightActive && highlightAppName ? {
7081
7176
  [`& .singul-dropdown-item[data-app-name="${highlightAppName}"]`]: {
7082
7177
  borderColor: "hsl(var(--primary)) !important",
@@ -7101,7 +7196,10 @@ function AppSearchDrawer({
7101
7196
  ShuffleMCP2,
7102
7197
  {
7103
7198
  apiKey: API_CONFIG.apiKey || void 0,
7104
- apiBaseUrl: API_CONFIG.baseUrl,
7199
+ apiBaseUrl: globalUrl || API_CONFIG.baseUrl,
7200
+ globalUrl,
7201
+ theme,
7202
+ colorMode,
7105
7203
  placeholder: initialQuery ? `Search ${initialQuery} integrations...` : "Search integrations...",
7106
7204
  layout: "grid",
7107
7205
  gridColumns: 2,
@@ -7113,8 +7211,17 @@ function AppSearchDrawer({
7113
7211
  showCheckbox: multiSelect,
7114
7212
  multiSelect,
7115
7213
  selectedApps: multiSelect ? projectedSelectedApps : void 0,
7214
+ disableAutoSelectValidatedApps: multiSelect,
7116
7215
  preventDefault: true,
7117
7216
  onAppSelected: handleAppSelected,
7217
+ onSelectionChange: multiSelect ? (next) => {
7218
+ onSelectionChange?.(next.map((app) => ({
7219
+ name: app.name,
7220
+ id: app.objectID || null,
7221
+ icon: app.image_url || "",
7222
+ categories: app.categories || []
7223
+ })));
7224
+ } : void 0,
7118
7225
  pinnedApps: pinnedApps?.map((p) => ({
7119
7226
  name: p.name,
7120
7227
  image_url: p.image_url,
@@ -7160,6 +7267,9 @@ function AppSearchDrawer({
7160
7267
  appId: detailAppId,
7161
7268
  anchor,
7162
7269
  width,
7270
+ globalUrl,
7271
+ theme,
7272
+ colorMode,
7163
7273
  onRefresh: onClose,
7164
7274
  onAddToCanvas
7165
7275
  }
@@ -9166,6 +9276,8 @@ var AgentUI = ({
9166
9276
  apiKey,
9167
9277
  apiBaseUrl,
9168
9278
  orgId,
9279
+ theme,
9280
+ colorMode,
9169
9281
  className,
9170
9282
  sx,
9171
9283
  contentSx
@@ -11715,6 +11827,9 @@ var AgentUI = ({
11715
11827
  subtitle: appPickerSubtitle,
11716
11828
  multiSelect: true,
11717
11829
  selectedApps: chosenApps.map((a) => ({ name: a.name, id: a.id || null, icon: a.icon })),
11830
+ globalUrl: apiBaseUrl,
11831
+ theme,
11832
+ colorMode,
11718
11833
  onSelectionChange: (next) => {
11719
11834
  setChosenApps(
11720
11835
  next.map((app) => {
@@ -11738,7 +11853,10 @@ var AgentUI = ({
11738
11853
  onClose: () => setAuthDrawerApp(null),
11739
11854
  appName: authDrawerApp?.name || null,
11740
11855
  appId: authDrawerApp?.id || null,
11741
- activeOrgId: orgId || null
11856
+ activeOrgId: orgId || null,
11857
+ globalUrl: apiBaseUrl,
11858
+ theme,
11859
+ colorMode
11742
11860
  }
11743
11861
  )
11744
11862
  ]
@@ -11750,10 +11868,354 @@ var AgentUI = ({
11750
11868
  var AgentUI_default = AgentUI;
11751
11869
 
11752
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
11753
11876
  var import_react16 = require("react");
11877
+ var import_material18 = require("@mui/material");
11878
+ init_api();
11879
+
11880
+ // components/UsageBar.tsx
11754
11881
  var import_material17 = require("@mui/material");
11755
- var import_lucide_react12 = require("lucide-react");
11756
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");
11757
12219
  var TAB_ORDER = ["run", "permissions", "localLLM"];
11758
12220
  var AgentRunDrawer = ({
11759
12221
  open,
@@ -11773,39 +12235,71 @@ var AgentRunDrawer = ({
11773
12235
  headerSx,
11774
12236
  tabsSx,
11775
12237
  bodySx,
11776
- globalUrl
12238
+ globalUrl,
12239
+ theme,
12240
+ colorMode,
12241
+ userdata,
12242
+ isLoaded,
12243
+ isLoggedIn,
12244
+ serverside
11777
12245
  }) => {
11778
12246
  useSyncHostBaseUrl(globalUrl);
11779
- const [activeTab, setActiveTab] = (0, import_react16.useState)(initialTab);
11780
- const prevOpenRef = (0, import_react16.useRef)(open);
11781
- (0, import_react16.useEffect)(() => {
12247
+ const themeScope = useShuffleMcpTheme();
12248
+ const [activeTab, setActiveTab] = (0, import_react18.useState)(initialTab);
12249
+ const prevOpenRef = (0, import_react18.useRef)(open);
12250
+ (0, import_react18.useEffect)(() => {
11782
12251
  if (open && !prevOpenRef.current) setActiveTab(initialTab);
11783
12252
  prevOpenRef.current = open;
11784
12253
  }, [open, initialTab]);
11785
- (0, import_react16.useEffect)(() => {
12254
+ (0, import_react18.useEffect)(() => {
11786
12255
  if (typeof window === "undefined") return;
11787
12256
  window.__shuffleAgentDrawerMounted = (window.__shuffleAgentDrawerMounted || 0) + 1;
11788
12257
  return () => {
11789
12258
  window.__shuffleAgentDrawerMounted = Math.max(0, (window.__shuffleAgentDrawerMounted || 1) - 1);
11790
12259
  };
11791
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
+ );
11792
12286
  const visibleTabs = TAB_ORDER.filter((t) => {
11793
12287
  if (t === "run") return true;
11794
12288
  if (t === "permissions") return !!permissionsSlot;
11795
- if (t === "localLLM") return !!localLLMSlot;
12289
+ if (t === "localLLM") return !!effectiveLocalLLMSlot;
11796
12290
  return false;
11797
12291
  });
11798
12292
  const showTabs = visibleTabs.length > 1;
11799
12293
  const safeActiveTab = visibleTabs.includes(activeTab) ? activeTab : "run";
11800
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
11801
- import_material17.Drawer,
12294
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
12295
+ import_material19.Drawer,
11802
12296
  {
11803
12297
  anchor: "right",
11804
12298
  open,
11805
12299
  onClose,
11806
12300
  slotProps: {
11807
12301
  paper: {
11808
- className,
12302
+ className: [themeScope?.scopeClassName, className].filter(Boolean).join(" ") || void 0,
11809
12303
  sx: [
11810
12304
  {
11811
12305
  width: { xs: "100%", sm: width },
@@ -11820,8 +12314,8 @@ var AgentRunDrawer = ({
11820
12314
  }
11821
12315
  },
11822
12316
  children: [
11823
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
11824
- import_material17.Box,
12317
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
12318
+ import_material19.Box,
11825
12319
  {
11826
12320
  sx: [
11827
12321
  {
@@ -11836,8 +12330,8 @@ var AgentRunDrawer = ({
11836
12330
  ...Array.isArray(headerSx) ? headerSx : headerSx ? [headerSx] : []
11837
12331
  ],
11838
12332
  children: [
11839
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
11840
- import_material17.Box,
12333
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
12334
+ import_material19.Box,
11841
12335
  {
11842
12336
  sx: {
11843
12337
  width: 40,
@@ -11850,19 +12344,19 @@ var AgentRunDrawer = ({
11850
12344
  color: "hsl(var(--primary))",
11851
12345
  flexShrink: 0
11852
12346
  },
11853
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AgentIcon_default, { size: 22 })
12347
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AgentIcon_default, { size: 22 })
11854
12348
  }
11855
12349
  ),
11856
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material17.Box, { sx: { flex: 1, minWidth: 0 }, children: [
11857
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Typography, { sx: { fontWeight: 600, fontSize: "1.1rem", color: "hsl(var(--foreground))" }, children: title }),
11858
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Typography, { sx: { fontSize: "0.8rem", color: "hsl(var(--muted-foreground))" }, children: subtitle })
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 })
11859
12353
  ] }),
11860
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.IconButton, { onClick: onClose, size: "small", sx: { color: "hsl(var(--muted-foreground))" }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.X, { size: 16 }) })
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 }) })
11861
12355
  ]
11862
12356
  }
11863
12357
  ),
11864
- showTabs && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Box, { sx: { borderBottom: "1px solid hsl(var(--border))", flexShrink: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
11865
- import_material17.Tabs,
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,
11866
12360
  {
11867
12361
  value: safeActiveTab,
11868
12362
  onChange: (_, v) => setActiveTab(v),
@@ -11883,36 +12377,36 @@ var AgentRunDrawer = ({
11883
12377
  ...Array.isArray(tabsSx) ? tabsSx : tabsSx ? [tabsSx] : []
11884
12378
  ],
11885
12379
  children: [
11886
- visibleTabs.includes("run") && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
11887
- import_material17.Tab,
12380
+ visibleTabs.includes("run") && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
12381
+ import_material19.Tab,
11888
12382
  {
11889
12383
  value: "run",
11890
12384
  label: "Run",
11891
- icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.Play, { size: 14 }),
12385
+ icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react12.Play, { size: 14 }),
11892
12386
  iconPosition: "start",
11893
12387
  sx: { gap: 0.75 }
11894
12388
  }
11895
12389
  ),
11896
- visibleTabs.includes("permissions") && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
11897
- import_material17.Tab,
12390
+ visibleTabs.includes("permissions") && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
12391
+ import_material19.Tab,
11898
12392
  {
11899
12393
  value: "permissions",
11900
- label: permissionsDisabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Tooltip, { title: permissionsDisabledTooltip, arrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Box, { component: "span", sx: { display: "inline-flex", alignItems: "center" }, children: "Permissions" }) }) : "Permissions",
11901
- icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.ShieldCheck, { size: 14 }),
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 }),
11902
12396
  iconPosition: "start",
11903
12397
  disabled: permissionsDisabled,
11904
12398
  sx: { gap: 0.75 }
11905
12399
  }
11906
12400
  ),
11907
- visibleTabs.includes("localLLM") && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
11908
- import_material17.Tab,
12401
+ visibleTabs.includes("localLLM") && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
12402
+ import_material19.Tab,
11909
12403
  {
11910
12404
  value: "localLLM",
11911
- label: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material17.Box, { sx: { display: "flex", alignItems: "center", gap: 0.5 }, children: [
12405
+ label: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material19.Box, { sx: { display: "flex", alignItems: "center", gap: 0.5 }, children: [
11912
12406
  "Local LLM",
11913
12407
  localLLMTabBadge
11914
12408
  ] }),
11915
- icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.Server, { size: 14 }),
12409
+ icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react12.Server, { size: 14 }),
11916
12410
  iconPosition: "start",
11917
12411
  sx: { gap: 0.75 }
11918
12412
  }
@@ -11920,20 +12414,22 @@ var AgentRunDrawer = ({
11920
12414
  ]
11921
12415
  }
11922
12416
  ) }),
11923
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material17.Box, { sx: [{ flex: 1, overflowY: "auto" }, ...Array.isArray(bodySx) ? bodySx : bodySx ? [bodySx] : []], children: [
11924
- safeActiveTab === "run" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Box, { sx: { px: 2, py: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
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)(
11925
12419
  AgentUI_default,
11926
12420
  {
11927
12421
  compact: true,
11928
12422
  hideHeroIcon: true,
11929
12423
  title: "",
11930
12424
  subtitle: null,
11931
- apiBaseUrl: globalUrl,
11932
- ...agentUIProps
12425
+ ...agentUIProps,
12426
+ apiBaseUrl: agentUIProps?.apiBaseUrl ?? globalUrl,
12427
+ theme: agentUIProps?.theme ?? theme,
12428
+ colorMode: agentUIProps?.colorMode ?? colorMode
11933
12429
  }
11934
12430
  ) }),
11935
- safeActiveTab === "permissions" && permissionsSlot && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Box, { sx: { px: 3, py: 2.5 }, children: permissionsSlot }),
11936
- safeActiveTab === "localLLM" && localLLMSlot && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Box, { sx: { px: 3, py: 2.5 }, children: localLLMSlot })
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 })
11937
12433
  ] })
11938
12434
  ]
11939
12435
  }
@@ -11942,8 +12438,8 @@ var AgentRunDrawer = ({
11942
12438
  var AgentRunDrawer_default = AgentRunDrawer;
11943
12439
 
11944
12440
  // components/AgentActivityList.tsx
11945
- var import_react17 = require("react");
11946
- var import_material18 = require("@mui/material");
12441
+ var import_react19 = require("react");
12442
+ var import_material20 = require("@mui/material");
11947
12443
  var import_lucide_react13 = require("lucide-react");
11948
12444
 
11949
12445
  // agentActivity.ts
@@ -11954,6 +12450,21 @@ var resolveHeaders = (apiKey, orgId) => {
11954
12450
  if (orgId) h["Org-Id"] = orgId;
11955
12451
  return h;
11956
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
+ };
11957
12468
  var searchAgentActivity = async (params = {}) => {
11958
12469
  const {
11959
12470
  cursor = "",
@@ -12009,6 +12520,127 @@ var listAgentScheduleWorkflows = async (params = {}) => {
12009
12520
  const list = Array.isArray(data) ? data : data?.workflows || [];
12010
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 }));
12011
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
+ };
12012
12644
  var findAgentInputParam = (workflow) => {
12013
12645
  const actions = workflow?.actions || [];
12014
12646
  for (const a of actions) {
@@ -12098,16 +12730,16 @@ var stopAgentSchedule = async (workflowId, params = {}) => {
12098
12730
 
12099
12731
  // components/AgentActivityList.tsx
12100
12732
  var import_lucide_react14 = require("lucide-react");
12101
- var import_jsx_runtime22 = require("react/jsx-runtime");
12733
+ var import_jsx_runtime24 = require("react/jsx-runtime");
12102
12734
  var STATUS_CONFIG = {
12103
- FINISHED: { icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.CheckCircle, { size: 16 }), color: "hsl(var(--severity-low, 142 71% 45%))", label: "Completed" },
12104
- SUCCESS: { icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.CheckCircle, { size: 16 }), color: "hsl(var(--severity-low, 142 71% 45%))", label: "Completed" },
12105
- FAILED: { icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.XCircle, { size: 16 }), color: "hsl(var(--severity-critical, 0 72% 55%))", label: "Failed" },
12106
- ABORTED: { icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.XCircle, { size: 16 }), color: "hsl(var(--severity-critical, 0 72% 55%))", label: "Aborted" },
12107
- EXECUTING: { icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.Loader2, { size: 16 }), color: "hsl(var(--severity-medium, 38 92% 50%))", label: "Running" },
12108
- RUNNING: { icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.Loader2, { size: 16 }), color: "hsl(var(--severity-medium, 38 92% 50%))", label: "Running" },
12109
- WAITING: { icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.Clock, { size: 16 }), color: "hsl(var(--severity-info, 217 91% 60%))", label: "Waiting" },
12110
- LIMIT_REACHED: { icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react14.AlertTriangle, { size: 16 }), color: "hsl(var(--severity-medium, 38 92% 50%))", label: "Limit reached" }
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" }
12111
12743
  };
12112
12744
  var getEffectiveStatus = (run) => {
12113
12745
  const raw = (run.status || "").toUpperCase();
@@ -12123,12 +12755,12 @@ var getEffectiveStatus = (run) => {
12123
12755
  var getRunIcon = (run) => {
12124
12756
  const src = (run.execution_source || "").toLowerCase();
12125
12757
  const arg = (run.execution_argument || "").toLowerCase();
12126
- if (src.includes("schedule") || src.includes("cron")) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.Clock, { size: 18 });
12127
- if (src.includes("webhook") || src.includes("http")) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.Globe, { size: 18 });
12128
- if (arg.includes("alert") || arg.includes("detect")) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.Activity, { size: 18 });
12129
- if (arg.includes("report") || arg.includes("email")) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.FileText, { size: 18 });
12130
- if (arg.includes("endpoint") || arg.includes("server")) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.Server, { size: 18 });
12131
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.Zap, { size: 18 });
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 });
12132
12764
  };
12133
12765
  var getRunIconColor = (run) => {
12134
12766
  const status = getEffectiveStatus(run);
@@ -12222,8 +12854,8 @@ var AgentRunRow = ({ run, onClick, sx }) => {
12222
12854
  const iconColor = getRunIconColor(run);
12223
12855
  const duration = formatDuration(run);
12224
12856
  const tools = getRunTools(run);
12225
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
12226
- import_material18.Box,
12857
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
12858
+ import_material20.Box,
12227
12859
  {
12228
12860
  onClick,
12229
12861
  sx: [
@@ -12246,8 +12878,8 @@ var AgentRunRow = ({ run, onClick, sx }) => {
12246
12878
  ...Array.isArray(sx) ? sx : sx ? [sx] : []
12247
12879
  ],
12248
12880
  children: [
12249
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12250
- import_material18.Box,
12881
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
12882
+ import_material20.Box,
12251
12883
  {
12252
12884
  sx: {
12253
12885
  width: 40,
@@ -12263,10 +12895,10 @@ var AgentRunRow = ({ run, onClick, sx }) => {
12263
12895
  children: getRunIcon(run)
12264
12896
  }
12265
12897
  ),
12266
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Box, { sx: { flex: 1, minWidth: 0 }, children: [
12267
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Box, { sx: { display: "flex", alignItems: "center", gap: 1, mb: 0.25 }, children: [
12268
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12269
- import_material18.Typography,
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,
12270
12902
  {
12271
12903
  sx: {
12272
12904
  fontSize: "0.9rem",
@@ -12279,10 +12911,10 @@ var AgentRunRow = ({ run, onClick, sx }) => {
12279
12911
  children: getRunTitle(run)
12280
12912
  }
12281
12913
  ),
12282
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Box, { sx: { display: "flex", alignItems: "center", color: cfg.color, flexShrink: 0 }, children: cfg.icon })
12914
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Box, { sx: { display: "flex", alignItems: "center", color: cfg.color, flexShrink: 0 }, children: cfg.icon })
12283
12915
  ] }),
12284
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12285
- import_material18.Typography,
12916
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
12917
+ import_material20.Typography,
12286
12918
  {
12287
12919
  sx: {
12288
12920
  fontSize: "0.78rem",
@@ -12294,16 +12926,16 @@ var AgentRunRow = ({ run, onClick, sx }) => {
12294
12926
  children: getRunSubtitle(run)
12295
12927
  }
12296
12928
  ),
12297
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Box, { sx: { display: "flex", alignItems: "center", gap: 1, mt: 0.5 }, children: [
12298
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.7 }, children: run.started_at ? getTimeAgo(run.started_at) : "\u2014" }),
12299
- duration && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
12300
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.4 }, children: "\xB7" }),
12301
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.7 }, children: duration })
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 })
12302
12934
  ] })
12303
12935
  ] })
12304
12936
  ] }),
12305
- tools.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12306
- import_material18.Box,
12937
+ tools.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
12938
+ import_material20.Box,
12307
12939
  {
12308
12940
  sx: {
12309
12941
  display: { xs: "none", sm: "flex" },
@@ -12314,8 +12946,8 @@ var AgentRunRow = ({ run, onClick, sx }) => {
12314
12946
  maxWidth: 220,
12315
12947
  flexShrink: 0
12316
12948
  },
12317
- children: tools.map((t) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Tooltip, { title: t, arrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12318
- import_material18.Chip,
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,
12319
12951
  {
12320
12952
  label: t,
12321
12953
  size: "small",
@@ -12363,21 +12995,21 @@ var AgentActivityList = ({
12363
12995
  toolbarSx,
12364
12996
  rowSx
12365
12997
  }) => {
12366
- const [runs, setRuns] = (0, import_react17.useState)([]);
12367
- const [cursor, setCursor] = (0, import_react17.useState)("");
12368
- const [hasMore, setHasMore] = (0, import_react17.useState)(false);
12369
- const [isLoading, setIsLoading] = (0, import_react17.useState)(false);
12370
- const [error, setError] = (0, import_react17.useState)(null);
12371
- const [statusFilter, setStatusFilter] = (0, import_react17.useState)("");
12372
- const [searchQuery, setSearchQuery] = (0, import_react17.useState)("");
12373
- const [debouncedQuery, setDebouncedQuery] = (0, import_react17.useState)("");
12374
- const [agentWorkflows, setAgentWorkflows] = (0, import_react17.useState)([]);
12375
- const [workflowFilter, setWorkflowFilter] = (0, import_react17.useState)("");
12376
- const [stopOpen, setStopOpen] = (0, import_react17.useState)(false);
12377
- const [stopLoading, setStopLoading] = (0, import_react17.useState)(false);
12378
- const debounceRef = (0, import_react17.useRef)();
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)();
12379
13011
  const selectedAgentWorkflow = agentWorkflows.find((w) => w.id === workflowFilter) || null;
12380
- const openEditPrompt = (0, import_react17.useCallback)(async () => {
13012
+ const openEditPrompt = (0, import_react19.useCallback)(async () => {
12381
13013
  if (!workflowFilter) return;
12382
13014
  try {
12383
13015
  const { prompt, apps } = await getAgentScheduleConfig(workflowFilter, { apiKey, apiBaseUrl, orgId });
@@ -12391,7 +13023,7 @@ var AgentActivityList = ({
12391
13023
  setError(e instanceof Error ? e.message : "Failed to load workflow");
12392
13024
  }
12393
13025
  }, [workflowFilter, selectedAgentWorkflow, apiKey, apiBaseUrl, orgId, onEditWorkflow]);
12394
- const confirmStop = (0, import_react17.useCallback)(async () => {
13026
+ const confirmStop = (0, import_react19.useCallback)(async () => {
12395
13027
  if (!workflowFilter) return;
12396
13028
  setStopLoading(true);
12397
13029
  try {
@@ -12406,15 +13038,15 @@ var AgentActivityList = ({
12406
13038
  setStopLoading(false);
12407
13039
  }
12408
13040
  }, [workflowFilter, apiKey, apiBaseUrl, orgId]);
12409
- const updateSearchQuery = (0, import_react17.useCallback)((q) => {
13041
+ const updateSearchQuery = (0, import_react19.useCallback)((q) => {
12410
13042
  setSearchQuery(q);
12411
13043
  if (debounceRef.current) clearTimeout(debounceRef.current);
12412
13044
  debounceRef.current = setTimeout(() => setDebouncedQuery(q), 350);
12413
13045
  }, []);
12414
- (0, import_react17.useEffect)(() => () => {
13046
+ (0, import_react19.useEffect)(() => () => {
12415
13047
  if (debounceRef.current) clearTimeout(debounceRef.current);
12416
13048
  }, []);
12417
- const fetchRuns = (0, import_react17.useCallback)(
13049
+ const fetchRuns = (0, import_react19.useCallback)(
12418
13050
  async (append = false, cursorParam = "") => {
12419
13051
  setIsLoading(true);
12420
13052
  setError(null);
@@ -12443,10 +13075,10 @@ var AgentActivityList = ({
12443
13075
  },
12444
13076
  [statusFilter, limit, apiKey, apiBaseUrl, orgId, workflowFilter]
12445
13077
  );
12446
- (0, import_react17.useEffect)(() => {
13078
+ (0, import_react19.useEffect)(() => {
12447
13079
  fetchRuns(false, "");
12448
13080
  }, [statusFilter, apiKey, apiBaseUrl, orgId, workflowFilter]);
12449
- (0, import_react17.useEffect)(() => {
13081
+ (0, import_react19.useEffect)(() => {
12450
13082
  let cancelled = false;
12451
13083
  listAgentScheduleWorkflows({ apiKey, apiBaseUrl, orgId }).then((items) => {
12452
13084
  if (!cancelled) setAgentWorkflows(items);
@@ -12456,7 +13088,7 @@ var AgentActivityList = ({
12456
13088
  cancelled = true;
12457
13089
  };
12458
13090
  }, [apiKey, apiBaseUrl, orgId]);
12459
- const loadMore = (0, import_react17.useCallback)(() => {
13091
+ const loadMore = (0, import_react19.useCallback)(() => {
12460
13092
  if (cursor && !isLoading) fetchRuns(true, cursor);
12461
13093
  }, [cursor, isLoading, fetchRuns]);
12462
13094
  const filteredRuns = debouncedQuery ? runs.filter((r) => {
@@ -12469,15 +13101,15 @@ var AgentActivityList = ({
12469
13101
  ].filter(Boolean).join(" ").toLowerCase();
12470
13102
  return hay.includes(debouncedQuery.toLowerCase());
12471
13103
  }) : runs;
12472
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
12473
- import_material18.Box,
13104
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
13105
+ import_material20.Box,
12474
13106
  {
12475
13107
  className,
12476
13108
  sx: [{ display: "flex", flexDirection: "column", gap: 2 }, ...Array.isArray(sx) ? sx : sx ? [sx] : []],
12477
13109
  children: [
12478
- (showSearchBar || showStatusChips) && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Box, { sx: [{ display: "flex", alignItems: "center", justifyContent: "center", gap: 1.5, flexWrap: "wrap" }, ...Array.isArray(toolbarSx) ? toolbarSx : toolbarSx ? [toolbarSx] : []], children: [
12479
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
12480
- import_material18.Select,
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,
12481
13113
  {
12482
13114
  size: "small",
12483
13115
  value: workflowFilter,
@@ -12513,13 +13145,13 @@ var AgentActivityList = ({
12513
13145
  }
12514
13146
  },
12515
13147
  children: [
12516
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.MenuItem, { value: "", sx: { fontSize: "0.85rem" }, children: "All Agent runs" }),
12517
- agentWorkflows.map((w) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.MenuItem, { value: w.id, sx: { fontSize: "0.85rem" }, children: w.name }, w.id))
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))
12518
13150
  ]
12519
13151
  }
12520
13152
  ),
12521
- showSearchBar && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12522
- import_material18.TextField,
13153
+ showSearchBar && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13154
+ import_material20.TextField,
12523
13155
  {
12524
13156
  placeholder: "Search results...",
12525
13157
  size: "small",
@@ -12527,7 +13159,7 @@ var AgentActivityList = ({
12527
13159
  onChange: (e) => updateSearchQuery(e.target.value),
12528
13160
  slotProps: {
12529
13161
  input: {
12530
- startAdornment: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.InputAdornment, { position: "start", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.Search, { size: 18, color: "hsl(var(--muted-foreground))" }) })
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))" }) })
12531
13163
  }
12532
13164
  },
12533
13165
  sx: {
@@ -12547,7 +13179,7 @@ var AgentActivityList = ({
12547
13179
  }
12548
13180
  }
12549
13181
  ),
12550
- showStatusChips && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
13182
+ showStatusChips && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
12551
13183
  SegmentedControl,
12552
13184
  {
12553
13185
  size: "sm",
@@ -12557,10 +13189,10 @@ var AgentActivityList = ({
12557
13189
  options: STATUS_FILTERS.map((f) => ({ value: f.value, label: f.label }))
12558
13190
  }
12559
13191
  ),
12560
- isLoading && runs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.CircularProgress, { size: 16, sx: { color: "hsl(var(--primary))", ml: 0.5 } })
13192
+ isLoading && runs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.CircularProgress, { size: 16, sx: { color: "hsl(var(--primary))", ml: 0.5 } })
12561
13193
  ] }),
12562
- selectedAgentWorkflow && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
12563
- import_material18.Box,
13194
+ selectedAgentWorkflow && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
13195
+ import_material20.Box,
12564
13196
  {
12565
13197
  sx: {
12566
13198
  display: "flex",
@@ -12572,15 +13204,15 @@ var AgentActivityList = ({
12572
13204
  bgcolor: "hsl(var(--card))"
12573
13205
  },
12574
13206
  children: [
12575
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Box, { sx: { flex: 1, minWidth: 0 }, children: [
12576
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Typography, { sx: { fontSize: "0.85rem", fontWeight: 600, color: "hsl(var(--foreground))", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: selectedAgentWorkflow.name }),
12577
- selectedAgentWorkflow.description && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Typography, { sx: { fontSize: "0.75rem", color: "hsl(var(--muted-foreground))", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: selectedAgentWorkflow.description })
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 })
12578
13210
  ] }),
12579
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12580
- import_material18.Button,
13211
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13212
+ import_material20.Button,
12581
13213
  {
12582
13214
  size: "small",
12583
- startIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react14.Pencil, { size: 14 }),
13215
+ startIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react14.Pencil, { size: 14 }),
12584
13216
  onClick: openEditPrompt,
12585
13217
  sx: {
12586
13218
  height: 36,
@@ -12595,11 +13227,11 @@ var AgentActivityList = ({
12595
13227
  children: "Edit"
12596
13228
  }
12597
13229
  ),
12598
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12599
- import_material18.Button,
13230
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13231
+ import_material20.Button,
12600
13232
  {
12601
13233
  size: "small",
12602
- startIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react14.StopCircle, { size: 14 }),
13234
+ startIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react14.StopCircle, { size: 14 }),
12603
13235
  onClick: () => setStopOpen(true),
12604
13236
  sx: {
12605
13237
  height: 36,
@@ -12617,17 +13249,17 @@ var AgentActivityList = ({
12617
13249
  ]
12618
13250
  }
12619
13251
  ),
12620
- isLoading && runs.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Box, { sx: { display: "flex", justifyContent: "center", py: 8 }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.CircularProgress, { size: 28, sx: { color: "hsl(var(--primary))" } }) }) : error ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Box, { sx: { display: "flex", flexDirection: "column", alignItems: "center", textAlign: "center", py: 6 }, children: [
12621
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.AlertCircle, { size: 28, style: { color: "hsl(var(--severity-critical, 0 72% 55%))", marginBottom: 8 } }),
12622
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12623
- import_material18.Typography,
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,
12624
13256
  {
12625
13257
  sx: { color: "hsl(var(--severity-critical, 0 72% 55%))", fontSize: "0.9rem", mb: 1 },
12626
13258
  children: error
12627
13259
  }
12628
13260
  ),
12629
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12630
- import_material18.Button,
13261
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13262
+ import_material20.Button,
12631
13263
  {
12632
13264
  size: "small",
12633
13265
  onClick: () => fetchRuns(false, ""),
@@ -12635,24 +13267,24 @@ var AgentActivityList = ({
12635
13267
  children: "Try again"
12636
13268
  }
12637
13269
  )
12638
- ] }) : filteredRuns.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Box, { sx: { display: "flex", flexDirection: "column", alignItems: "center", textAlign: "center", py: 8 }, children: [
12639
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
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)(
12640
13272
  import_lucide_react13.Activity,
12641
13273
  {
12642
13274
  size: 40,
12643
13275
  style: { color: "hsl(var(--muted-foreground))", marginBottom: 12 }
12644
13276
  }
12645
13277
  ),
12646
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Typography, { sx: { color: "hsl(var(--muted-foreground))", fontSize: "0.9rem" }, children: emptyTitle }),
12647
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12648
- import_material18.Typography,
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,
12649
13281
  {
12650
13282
  sx: { color: "hsl(var(--muted-foreground))", fontSize: "0.8rem", mt: 0.5, opacity: 0.7 },
12651
13283
  children: emptySubtitle
12652
13284
  }
12653
13285
  )
12654
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Box, { sx: { display: "flex", flexDirection: "column", gap: 1.5 }, children: [
12655
- filteredRuns.map((run, idx) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
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)(
12656
13288
  AgentRunRow,
12657
13289
  {
12658
13290
  run,
@@ -12661,43 +13293,43 @@ var AgentActivityList = ({
12661
13293
  },
12662
13294
  run.execution_id || idx
12663
13295
  )),
12664
- hasMore && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Box, { sx: { display: "flex", justifyContent: "center", mt: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
12665
- import_material18.Button,
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,
12666
13298
  {
12667
13299
  size: "small",
12668
13300
  onClick: loadMore,
12669
13301
  disabled: isLoading,
12670
13302
  sx: { color: "hsl(var(--primary))", textTransform: "none", fontSize: "0.8rem" },
12671
13303
  children: [
12672
- isLoading ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.CircularProgress, { size: 14, sx: { mr: 1 } }) : null,
13304
+ isLoading ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.CircularProgress, { size: 14, sx: { mr: 1 } }) : null,
12673
13305
  "Load more"
12674
13306
  ]
12675
13307
  }
12676
13308
  ) })
12677
13309
  ] }),
12678
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
12679
- import_material18.Dialog,
13310
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
13311
+ import_material20.Dialog,
12680
13312
  {
12681
13313
  open: stopOpen,
12682
13314
  onClose: () => stopLoading ? null : setStopOpen(false),
12683
13315
  slotProps: { paper: { sx: { bgcolor: "hsl(var(--card))", color: "hsl(var(--foreground))", border: "1px solid hsl(var(--border))" } } },
12684
13316
  children: [
12685
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.DialogTitle, { sx: { fontSize: "1rem", fontWeight: 600 }, children: "Stop schedule?" }),
12686
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.DialogContent, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Typography, { sx: { fontSize: "0.85rem", color: "hsl(var(--muted-foreground))" }, children: [
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: [
12687
13319
  'This will stop "',
12688
13320
  selectedAgentWorkflow?.name,
12689
13321
  '" and delete the scheduled workflow. Past executions remain visible. This cannot be undone.'
12690
13322
  ] }) }),
12691
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.DialogActions, { sx: { px: 3, pb: 2 }, children: [
12692
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Button, { onClick: () => setStopOpen(false), disabled: stopLoading, sx: { textTransform: "none", color: "hsl(var(--muted-foreground))" }, children: "Cancel" }),
12693
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
12694
- import_material18.Button,
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,
12695
13327
  {
12696
13328
  onClick: confirmStop,
12697
13329
  disabled: stopLoading,
12698
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)" } },
12699
13331
  children: [
12700
- stopLoading ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.CircularProgress, { size: 16, sx: { color: "hsl(var(--primary-foreground))", mr: 1 } }) : null,
13332
+ stopLoading ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.CircularProgress, { size: 16, sx: { color: "hsl(var(--primary-foreground))", mr: 1 } }) : null,
12701
13333
  "Stop schedule"
12702
13334
  ]
12703
13335
  }
@@ -12713,9 +13345,9 @@ var AgentActivityList = ({
12713
13345
  var AgentActivityList_default = AgentActivityList;
12714
13346
 
12715
13347
  // components/AgentExecutionDrawer.tsx
12716
- var import_material19 = require("@mui/material");
13348
+ var import_material21 = require("@mui/material");
12717
13349
  var import_lucide_react15 = require("lucide-react");
12718
- var import_jsx_runtime23 = require("react/jsx-runtime");
13350
+ var import_jsx_runtime25 = require("react/jsx-runtime");
12719
13351
  var AgentExecutionDrawer = ({
12720
13352
  open,
12721
13353
  onClose,
@@ -12729,20 +13361,23 @@ var AgentExecutionDrawer = ({
12729
13361
  headerSx,
12730
13362
  bodySx,
12731
13363
  topBanner,
12732
- onSchedule
13364
+ onSchedule,
13365
+ theme,
13366
+ colorMode
12733
13367
  }) => {
13368
+ const themeScope = useShuffleMcpTheme();
12734
13369
  const statusKey = (run?.status || "").toUpperCase();
12735
13370
  const cfg = STATUS_CONFIG[statusKey] || STATUS_CONFIG.WAITING;
12736
13371
  const duration = run ? formatDuration(run) : "";
12737
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
12738
- import_material19.Drawer,
13372
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
13373
+ import_material21.Drawer,
12739
13374
  {
12740
13375
  anchor: "right",
12741
13376
  open,
12742
13377
  onClose,
12743
13378
  slotProps: {
12744
13379
  paper: {
12745
- className,
13380
+ className: [themeScope?.scopeClassName, className].filter(Boolean).join(" ") || void 0,
12746
13381
  sx: [
12747
13382
  {
12748
13383
  width: { xs: "100%", sm: width },
@@ -12757,8 +13392,8 @@ var AgentExecutionDrawer = ({
12757
13392
  }
12758
13393
  },
12759
13394
  children: [
12760
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
12761
- import_material19.Box,
13395
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
13396
+ import_material21.Box,
12762
13397
  {
12763
13398
  sx: [
12764
13399
  {
@@ -12776,8 +13411,8 @@ var AgentExecutionDrawer = ({
12776
13411
  ...Array.isArray(headerSx) ? headerSx : headerSx ? [headerSx] : []
12777
13412
  ],
12778
13413
  children: [
12779
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
12780
- import_material19.Box,
13414
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13415
+ import_material21.Box,
12781
13416
  {
12782
13417
  sx: {
12783
13418
  width: 36,
@@ -12790,13 +13425,13 @@ var AgentExecutionDrawer = ({
12790
13425
  color: "hsl(var(--primary))",
12791
13426
  flexShrink: 0
12792
13427
  },
12793
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AgentIcon_default, { size: 20 })
13428
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AgentIcon_default, { size: 20 })
12794
13429
  }
12795
13430
  ),
12796
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material19.Box, { sx: { flex: 1, minWidth: 0 }, children: [
12797
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material19.Box, { sx: { display: "flex", alignItems: "center", gap: 1, minWidth: 0 }, children: [
12798
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
12799
- import_material19.Typography,
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,
12800
13435
  {
12801
13436
  sx: {
12802
13437
  fontSize: "0.95rem",
@@ -12809,22 +13444,22 @@ var AgentExecutionDrawer = ({
12809
13444
  children: run ? getRunTitle(run) : "Agent execution"
12810
13445
  }
12811
13446
  ),
12812
- run && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Box, { sx: { display: "flex", alignItems: "center", color: cfg.color, flexShrink: 0 }, children: cfg.icon })
13447
+ run && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Box, { sx: { display: "flex", alignItems: "center", color: cfg.color, flexShrink: 0 }, children: cfg.icon })
12813
13448
  ] }),
12814
- run && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material19.Box, { sx: { display: "flex", alignItems: "center", gap: 1, mt: 0.25 }, children: [
12815
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))" }, children: cfg.label }),
12816
- run.started_at && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
12817
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.4 }, children: "\xB7" }),
12818
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))" }, children: getTimeAgo(run.started_at) })
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) })
12819
13454
  ] }),
12820
- duration && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
12821
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.4 }, children: "\xB7" }),
12822
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))" }, children: duration })
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 })
12823
13458
  ] })
12824
13459
  ] })
12825
13460
  ] }),
12826
- run?.execution_id && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Tooltip, { title: "Open in new tab", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
12827
- import_material19.IconButton,
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,
12828
13463
  {
12829
13464
  component: "a",
12830
13465
  href: `/agents?execution_id=${encodeURIComponent(run.execution_id)}${run.authorization ? `&authorization=${encodeURIComponent(run.authorization)}` : ""}`,
@@ -12835,11 +13470,11 @@ var AgentExecutionDrawer = ({
12835
13470
  color: "hsl(var(--muted-foreground))",
12836
13471
  "&:hover": { color: "hsl(var(--foreground))", bgcolor: "hsl(var(--muted))" }
12837
13472
  },
12838
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react15.ExternalLink, { size: 16 })
13473
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react15.ExternalLink, { size: 16 })
12839
13474
  }
12840
13475
  ) }),
12841
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Tooltip, { title: "Close", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
12842
- import_material19.IconButton,
13476
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Tooltip, { title: "Close", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13477
+ import_material21.IconButton,
12843
13478
  {
12844
13479
  onClick: onClose,
12845
13480
  size: "small",
@@ -12847,15 +13482,15 @@ var AgentExecutionDrawer = ({
12847
13482
  color: "hsl(var(--muted-foreground))",
12848
13483
  "&:hover": { color: "hsl(var(--foreground))", bgcolor: "hsl(var(--muted))" }
12849
13484
  },
12850
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react15.X, { size: 16 })
13485
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react15.X, { size: 16 })
12851
13486
  }
12852
13487
  ) })
12853
13488
  ]
12854
13489
  }
12855
13490
  ),
12856
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material19.Box, { sx: [{ flex: 1, overflowY: "auto", pt: 3 }, ...Array.isArray(bodySx) ? bodySx : bodySx ? [bodySx] : []], children: [
13491
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material21.Box, { sx: [{ flex: 1, overflowY: "auto", pt: 3 }, ...Array.isArray(bodySx) ? bodySx : bodySx ? [bodySx] : []], children: [
12857
13492
  topBanner,
12858
- run ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
13493
+ run ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
12859
13494
  AgentUI_default,
12860
13495
  {
12861
13496
  initialExecution: {
@@ -12878,7 +13513,9 @@ var AgentExecutionDrawer = ({
12878
13513
  apiKey,
12879
13514
  apiBaseUrl,
12880
13515
  orgId,
12881
- onSchedule
13516
+ onSchedule,
13517
+ theme,
13518
+ colorMode
12882
13519
  },
12883
13520
  run.execution_id
12884
13521
  ) : null
@@ -12890,9 +13527,9 @@ var AgentExecutionDrawer = ({
12890
13527
  var AgentExecutionDrawer_default = AgentExecutionDrawer;
12891
13528
 
12892
13529
  // views/AgentsView.tsx
12893
- var import_react18 = require("react");
12894
- var import_material20 = require("@mui/material");
12895
- var import_jsx_runtime24 = require("react/jsx-runtime");
13530
+ var import_react20 = require("react");
13531
+ var import_material22 = require("@mui/material");
13532
+ var import_jsx_runtime26 = require("react/jsx-runtime");
12896
13533
  var AgentsView = ({
12897
13534
  onSchedule,
12898
13535
  maxWidth = 820,
@@ -12904,45 +13541,56 @@ var AgentsView = ({
12904
13541
  isLoaded,
12905
13542
  isLoggedIn,
12906
13543
  userdata,
12907
- serverside
13544
+ serverside,
13545
+ theme,
13546
+ colorMode,
13547
+ apiKey,
13548
+ orgId
12908
13549
  }) => {
12909
13550
  useSyncHostBaseUrl(globalUrl);
12910
- const [selectedRun, setSelectedRun] = (0, import_react18.useState)(null);
12911
- const [agentView, setAgentView] = (0, import_react18.useState)("start");
12912
- const [prefill, setPrefill] = (0, import_react18.useState)({
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)({
12913
13554
  input: "",
12914
13555
  apps: [],
12915
13556
  key: 0
12916
13557
  });
12917
- const [editing, setEditing] = (0, import_react18.useState)(null);
12918
- const [builtInDrawer, setBuiltInDrawer] = (0, import_react18.useState)({
13558
+ const [editing, setEditing] = (0, import_react20.useState)(null);
13559
+ const [builtInDrawer, setBuiltInDrawer] = (0, import_react20.useState)({
12919
13560
  open: false,
12920
13561
  tab: "localLLM"
12921
13562
  });
12922
- const effectiveLocalLLMSlot = (0, import_react18.useMemo)(
12923
- () => localLLMSlot ?? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.Box, { sx: { p: 3, color: "hsl(var(--muted-foreground))", fontSize: "0.85rem", lineHeight: 1.6 }, children: [
12924
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Typography, { sx: { fontSize: "0.95rem", fontWeight: 600, color: "hsl(var(--foreground))", mb: 1 }, children: "Local LLM not configured" }),
12925
- "This host hasn't wired a Local LLM picker yet. Pass an",
12926
- " ",
12927
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("code", { style: { fontFamily: "monospace" }, children: "onChooseLLM" }),
12928
- " handler or a",
12929
- " ",
12930
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("code", { style: { fontFamily: "monospace" }, children: "localLLMSlot" }),
12931
- " to",
12932
- " ",
12933
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("code", { style: { fontFamily: "monospace" }, children: "<AgentsView />" }),
12934
- " to render your own configuration UI here."
12935
- ] }),
12936
- [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]
13569
+ );
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]
12937
13585
  );
12938
- const handleChooseLLM = (0, import_react18.useCallback)(() => {
13586
+ const handleChooseLLM = (0, import_react20.useCallback)(() => {
12939
13587
  if (onChooseLLM) {
12940
13588
  onChooseLLM();
12941
13589
  return;
12942
13590
  }
12943
13591
  setBuiltInDrawer({ open: true, tab: "localLLM" });
12944
13592
  }, [onChooseLLM]);
12945
- const handleEditWorkflow = (0, import_react18.useCallback)(
13593
+ const handleEditWorkflow = (0, import_react20.useCallback)(
12946
13594
  ({ workflowId, name, prompt, apps }) => {
12947
13595
  setEditing({ workflowId, name });
12948
13596
  setPrefill((prev) => ({
@@ -12954,7 +13602,7 @@ var AgentsView = ({
12954
13602
  },
12955
13603
  []
12956
13604
  );
12957
- const handleSaveEdit = (0, import_react18.useCallback)(
13605
+ const handleSaveEdit = (0, import_react20.useCallback)(
12958
13606
  async ({ input, apps }) => {
12959
13607
  if (!editing) return;
12960
13608
  try {
@@ -12974,10 +13622,10 @@ var AgentsView = ({
12974
13622
  },
12975
13623
  [editing]
12976
13624
  );
12977
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.Box, { sx: { minHeight: "100%", width: "100%", px: { xs: 2, md: 4 }, pt: { xs: 3, md: "5vh" }, pb: 6, boxSizing: "border-box" }, children: [
12978
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.Stack, { spacing: 6, sx: { maxWidth, mx: "auto", width: "100%" }, children: [
12979
- editing && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
12980
- import_material20.Box,
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,
12981
13629
  {
12982
13630
  sx: {
12983
13631
  display: "flex",
@@ -12990,12 +13638,12 @@ var AgentsView = ({
12990
13638
  bgcolor: "hsl(var(--primary) / 0.08)"
12991
13639
  },
12992
13640
  children: [
12993
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.Typography, { sx: { fontSize: "0.85rem", color: "hsl(var(--foreground))" }, children: [
13641
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_material22.Typography, { sx: { fontSize: "0.85rem", color: "hsl(var(--foreground))" }, children: [
12994
13642
  "Editing schedule: ",
12995
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("strong", { children: editing.name })
13643
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("strong", { children: editing.name })
12996
13644
  ] }),
12997
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
12998
- import_material20.Typography,
13645
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
13646
+ import_material22.Typography,
12999
13647
  {
13000
13648
  component: "button",
13001
13649
  onClick: () => {
@@ -13015,13 +13663,15 @@ var AgentsView = ({
13015
13663
  ]
13016
13664
  }
13017
13665
  ),
13018
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13666
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
13019
13667
  AgentUI_default,
13020
13668
  {
13021
13669
  maxWidth,
13022
13670
  apiBaseUrl: globalUrl,
13023
13671
  onViewChange: setAgentView,
13024
- onSchedule,
13672
+ onSchedule: effectiveSchedule,
13673
+ apiKey,
13674
+ orgId,
13025
13675
  onChooseLLM: handleChooseLLM,
13026
13676
  hideChooseLLM,
13027
13677
  defaultInput: prefill.input,
@@ -13030,30 +13680,38 @@ var AgentsView = ({
13030
13680
  submitLabel: editing ? "Save" : void 0,
13031
13681
  submitTooltip: editing ? "\u2318+Enter to save" : void 0,
13032
13682
  disableSchedule: Boolean(editing),
13033
- disableScheduleTooltip: editing ? "Scheduling is disabled while editing an existing schedule" : void 0
13683
+ disableScheduleTooltip: editing ? "Scheduling is disabled while editing an existing schedule" : void 0,
13684
+ theme,
13685
+ colorMode
13034
13686
  },
13035
13687
  prefill.key
13036
13688
  ),
13037
- agentView === "start" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Box, { sx: { pt: { xs: 4, md: "8vh" } }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
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)(
13038
13690
  AgentActivityList_default,
13039
13691
  {
13040
13692
  apiBaseUrl: globalUrl,
13693
+ apiKey,
13694
+ orgId,
13041
13695
  onRunClick: setSelectedRun,
13042
13696
  onEditWorkflow: handleEditWorkflow
13043
13697
  }
13044
13698
  ) })
13045
13699
  ] }),
13046
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13700
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
13047
13701
  AgentExecutionDrawer_default,
13048
13702
  {
13049
13703
  open: selectedRun !== null,
13050
13704
  onClose: () => setSelectedRun(null),
13051
13705
  run: selectedRun,
13052
13706
  apiBaseUrl: globalUrl,
13053
- onSchedule
13707
+ onSchedule: effectiveSchedule,
13708
+ apiKey,
13709
+ orgId,
13710
+ theme,
13711
+ colorMode
13054
13712
  }
13055
13713
  ),
13056
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13714
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
13057
13715
  AgentRunDrawer_default,
13058
13716
  {
13059
13717
  open: builtInDrawer.open,
@@ -13062,7 +13720,9 @@ var AgentsView = ({
13062
13720
  globalUrl,
13063
13721
  localLLMSlot: effectiveLocalLLMSlot,
13064
13722
  permissionsSlot,
13065
- agentUIProps: { onSchedule, apiBaseUrl: globalUrl }
13723
+ theme,
13724
+ colorMode,
13725
+ agentUIProps: { onSchedule: effectiveSchedule, apiBaseUrl: globalUrl, apiKey, orgId, theme, colorMode }
13066
13726
  }
13067
13727
  )
13068
13728
  ] });
@@ -13070,14 +13730,14 @@ var AgentsView = ({
13070
13730
  var AgentsView_default = AgentsView;
13071
13731
 
13072
13732
  // useAppLookup.ts
13073
- var import_react19 = require("react");
13733
+ var import_react21 = require("react");
13074
13734
  init_api();
13075
13735
  init_appsCache();
13076
13736
  var norm3 = (s) => s.toLowerCase().replace(/[\s_\-]+/g, "_");
13077
13737
  function useAppLookup(appName) {
13078
- const [loading, setLoading] = (0, import_react19.useState)(false);
13079
- const [info, setInfo] = (0, import_react19.useState)(null);
13080
- const [algoliaId, setAlgoliaId] = (0, import_react19.useState)(null);
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);
13081
13741
  const {
13082
13742
  authStates,
13083
13743
  authenticatedApps,
@@ -13086,7 +13746,7 @@ function useAppLookup(appName) {
13086
13746
  handleSaveAuth,
13087
13747
  refreshAuth
13088
13748
  } = useAppAuth();
13089
- (0, import_react19.useEffect)(() => {
13749
+ (0, import_react21.useEffect)(() => {
13090
13750
  if (!appName) {
13091
13751
  setInfo(null);
13092
13752
  setAlgoliaId(null);
@@ -13165,13 +13825,13 @@ function useAppLookup(appName) {
13165
13825
  setLoading(false);
13166
13826
  })();
13167
13827
  }, [appName]);
13168
- const matchingEntries = (0, import_react19.useMemo)(() => {
13828
+ const matchingEntries = (0, import_react21.useMemo)(() => {
13169
13829
  if (!appName) return [];
13170
13830
  return authenticatedApps.filter(
13171
13831
  (auth) => auth.app?.name && norm3(auth.app.name) === norm3(appName)
13172
13832
  );
13173
13833
  }, [appName, authenticatedApps]);
13174
- const image = (0, import_react19.useMemo)(() => {
13834
+ const image = (0, import_react21.useMemo)(() => {
13175
13835
  if (info?.image) return info.image;
13176
13836
  for (const entry of matchingEntries) {
13177
13837
  const img = entry.app?.large_image || entry.large_image;
@@ -13179,7 +13839,7 @@ function useAppLookup(appName) {
13179
13839
  }
13180
13840
  return "";
13181
13841
  }, [info, matchingEntries]);
13182
- const algoliaApp = (0, import_react19.useMemo)(() => {
13842
+ const algoliaApp = (0, import_react21.useMemo)(() => {
13183
13843
  if (!appName) return null;
13184
13844
  return {
13185
13845
  objectID: algoliaId || appName,
@@ -13214,108 +13874,27 @@ function useAppLookup(appName) {
13214
13874
  init_api();
13215
13875
  init_fetchBreaker();
13216
13876
  init_appsCache();
13217
-
13218
- // components/UsageBar.tsx
13219
- var import_material21 = require("@mui/material");
13220
- var import_jsx_runtime25 = require("react/jsx-runtime");
13221
- var fmt = (n) => n.toLocaleString();
13222
- var UsageBar = ({
13223
- label,
13224
- usage,
13225
- limit,
13226
- unit,
13227
- hint,
13228
- actionLabel,
13229
- actionHref
13230
- }) => {
13231
- const safeLimit = Math.max(limit, 0);
13232
- const pct = safeLimit > 0 ? usage / safeLimit * 100 : 0;
13233
- const isOver = pct >= 100;
13234
- const isWarn = pct >= 65 && !isOver;
13235
- const accent = isOver ? "hsl(var(--destructive))" : isWarn ? "hsl(var(--severity-medium))" : "hsl(var(--muted-foreground))";
13236
- 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 : ""}`;
13237
- 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: [
13238
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material21.Box, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 1 }, children: [
13239
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13240
- import_material21.Typography,
13241
- {
13242
- sx: {
13243
- fontSize: "12.8px",
13244
- fontWeight: 500,
13245
- color: "hsl(var(--muted-foreground))",
13246
- lineHeight: 1.2
13247
- },
13248
- children: label
13249
- }
13250
- ),
13251
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material21.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
13252
- actionLabel && actionHref && (isWarn || isOver) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13253
- import_material21.Box,
13254
- {
13255
- component: "a",
13256
- href: actionHref,
13257
- target: "_blank",
13258
- rel: "noopener noreferrer",
13259
- sx: {
13260
- fontSize: "12.8px",
13261
- fontWeight: 600,
13262
- color: accent,
13263
- textDecoration: "none",
13264
- "&:hover": { textDecoration: "underline" }
13265
- },
13266
- children: actionLabel
13267
- }
13268
- ),
13269
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13270
- import_material21.Typography,
13271
- {
13272
- sx: {
13273
- fontSize: "12.8px",
13274
- fontWeight: 500,
13275
- color: accent,
13276
- whiteSpace: "nowrap",
13277
- fontVariantNumeric: "tabular-nums"
13278
- },
13279
- children: safeLimit > 0 ? `${fmt(usage)} / ${fmt(safeLimit)}${unit ? " " + unit : ""}` : `${fmt(usage)}${unit ? " " + unit : ""}`
13280
- }
13281
- )
13282
- ] })
13283
- ] }),
13284
- /* @__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)(
13285
- import_material21.Box,
13286
- {
13287
- sx: {
13288
- width: `${Math.min(Math.max(pct, 0), 100)}%`,
13289
- height: "100%",
13290
- bgcolor: isOver ? "hsl(var(--destructive))" : isWarn ? "hsl(var(--severity-medium))" : "hsl(var(--severity-low, 142 71% 45%))",
13291
- transition: "width 0.3s ease"
13292
- }
13293
- }
13294
- ) })
13295
- ] }) });
13296
- };
13297
-
13298
- // index.ts
13299
13877
  var resolveMode = (theme, colorMode) => {
13300
13878
  if (theme === "light" || theme === "dark") return theme;
13301
13879
  if (theme === "system") return "auto";
13302
- return colorMode ?? "auto";
13880
+ if (colorMode) return colorMode;
13881
+ return "dark";
13303
13882
  };
13304
13883
  var withMcpTheme = (Inner, displayName) => {
13305
- const Wrapped = ({ theme, colorMode, ...rest }) => import_react20.default.createElement(
13884
+ const Wrapped = ({ theme, colorMode, ...rest }) => import_react22.default.createElement(
13306
13885
  ShuffleMcpThemeProvider,
13307
13886
  { mode: resolveMode(theme, colorMode) },
13308
- import_react20.default.createElement(Inner, { ...rest })
13887
+ import_react22.default.createElement(Inner, { ...rest, theme, colorMode })
13309
13888
  );
13310
13889
  Wrapped.displayName = `ShuffleMCPs(${displayName})`;
13311
13890
  return Wrapped;
13312
13891
  };
13313
13892
  var withMcpThemeRef = (Inner, displayName) => {
13314
- const Wrapped = import_react20.default.forwardRef(
13315
- ({ theme, colorMode, ...rest }, ref) => import_react20.default.createElement(
13893
+ const Wrapped = import_react22.default.forwardRef(
13894
+ ({ theme, colorMode, ...rest }, ref) => import_react22.default.createElement(
13316
13895
  ShuffleMcpThemeProvider,
13317
13896
  { mode: resolveMode(theme, colorMode) },
13318
- import_react20.default.createElement(Inner, { ...rest, ref })
13897
+ import_react22.default.createElement(Inner, { ...rest, theme, colorMode, ref })
13319
13898
  )
13320
13899
  );
13321
13900
  Wrapped.displayName = `ShuffleMCPs(${displayName})`;
@@ -13337,6 +13916,7 @@ var AgentActivityList2 = withMcpTheme(AgentActivityList_default, "AgentActivityL
13337
13916
  var AgentExecutionDrawer2 = withMcpTheme(AgentExecutionDrawer_default, "AgentExecutionDrawer");
13338
13917
  var AgentsView2 = withMcpTheme(AgentsView_default, "AgentsView");
13339
13918
  var AgentRunDiagnosisBanner2 = withMcpTheme(AgentRunDiagnosisBanner_default, "AgentRunDiagnosisBanner");
13919
+ var LocalLLMConfig2 = withMcpTheme(LocalLLMConfig_default, "LocalLLMConfig");
13340
13920
  // Annotate the CommonJS export names for ESM import in node:
13341
13921
  0 && (module.exports = {
13342
13922
  API_CONFIG,
@@ -13363,6 +13943,7 @@ var AgentRunDiagnosisBanner2 = withMcpTheme(AgentRunDiagnosisBanner_default, "Ag
13363
13943
  FORWARD_TICKETS_WORKFLOW_NAME,
13364
13944
  INGEST_TICKETS_WORKFLOW_NAME,
13365
13945
  IntegrationStatus,
13946
+ LocalLLMConfig,
13366
13947
  SIEM_PATTERNS,
13367
13948
  ShuffleMCP,
13368
13949
  ShuffleMcpThemeProvider,
@@ -13408,6 +13989,7 @@ var AgentRunDiagnosisBanner2 = withMcpTheme(AgentRunDiagnosisBanner_default, "Ag
13408
13989
  resetRegionUrl,
13409
13990
  resolveApp,
13410
13991
  resolveApps,
13992
+ scheduleAgentRun,
13411
13993
  searchAgentActivity,
13412
13994
  seedResolvedApp,
13413
13995
  setDatastoreItem,