@shuffleio/shuffle-mcps 0.0.23 → 0.0.25

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
  ]
@@ -6869,9 +6946,21 @@ function AppSearchDrawer({
6869
6946
  colorMode
6870
6947
  }) {
6871
6948
  const themeScope = useShuffleMcpTheme();
6949
+ const scopeClassName = themeScope?.scopeClassName ?? (theme === "dark" ? "shuffle-mcp-scope dark" : theme === "light" ? "shuffle-mcp-scope" : void 0);
6872
6950
  const [detailAppName, setDetailAppName] = (0, import_react13.useState)(null);
6873
6951
  const [detailAppId, setDetailAppId] = (0, import_react13.useState)(null);
6874
6952
  const [highlightActive, setHighlightActive] = (0, import_react13.useState)(false);
6953
+ const [bodyReady, setBodyReady] = (0, import_react13.useState)(false);
6954
+ (0, import_react13.useEffect)(() => {
6955
+ if (!open) {
6956
+ setBodyReady(false);
6957
+ return;
6958
+ }
6959
+ const raf = requestAnimationFrame(() => {
6960
+ requestAnimationFrame(() => setBodyReady(true));
6961
+ });
6962
+ return () => cancelAnimationFrame(raf);
6963
+ }, [open]);
6875
6964
  (0, import_react13.useEffect)(() => {
6876
6965
  setHighlightActive(false);
6877
6966
  if (!open || !highlightAppName) return;
@@ -6954,20 +7043,25 @@ function AppSearchDrawer({
6954
7043
  anchor,
6955
7044
  open: open && detailAppName === null,
6956
7045
  onClose: handleClose,
6957
- slotProps: { paper: { className: themeScope?.scopeClassName } },
7046
+ slotProps: {
7047
+ paper: {
7048
+ className: scopeClassName,
7049
+ sx: {
7050
+ width: { xs: "100%", sm: width },
7051
+ maxWidth: "100vw",
7052
+ height: "100vh",
7053
+ display: "flex",
7054
+ flexDirection: "column",
7055
+ overflow: "hidden",
7056
+ background: "linear-gradient(180deg, hsl(var(--card)) 0%, hsl(var(--background)) 100%)",
7057
+ borderLeft: anchor === "right" ? "1px solid hsl(var(--border))" : "none",
7058
+ borderRight: anchor === "left" ? "1px solid hsl(var(--border))" : "none"
7059
+ }
7060
+ }
7061
+ },
6958
7062
  sx: {
6959
7063
  zIndex: 9999,
6960
- "& .MuiDrawer-paper": {
6961
- width,
6962
- maxWidth: "100vw",
6963
- height: "100vh",
6964
- display: "flex",
6965
- flexDirection: "column",
6966
- overflow: "hidden",
6967
- background: "linear-gradient(180deg, hsl(var(--card)) 0%, hsl(var(--background)) 100%)",
6968
- borderLeft: anchor === "right" ? "1px solid hsl(var(--border))" : "none",
6969
- borderRight: anchor === "left" ? "1px solid hsl(var(--border))" : "none"
6970
- }
7064
+ "& .MuiDrawer-paper": { boxSizing: "border-box" }
6971
7065
  },
6972
7066
  children: [
6973
7067
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
@@ -7063,14 +7157,16 @@ function AppSearchDrawer({
7063
7157
  overflowY: "auto"
7064
7158
  },
7065
7159
  "& .singul-results-grid": {
7066
- gridAutoRows: "75px",
7160
+ gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
7161
+ gridAutoRows: "78px",
7067
7162
  gap: "12px"
7068
7163
  },
7069
7164
  "& .singul-results-grid .singul-dropdown-item": {
7070
- minHeight: 75,
7071
- maxHeight: 75,
7072
- height: 75,
7073
- padding: "14px 16px",
7165
+ minWidth: 0,
7166
+ minHeight: 78,
7167
+ maxHeight: 78,
7168
+ height: 78,
7169
+ padding: "10px 14px",
7074
7170
  alignItems: "center",
7075
7171
  overflow: "hidden"
7076
7172
  },
@@ -7079,11 +7175,14 @@ function AppSearchDrawer({
7079
7175
  gap: "12px"
7080
7176
  },
7081
7177
  "& .singul-results-grid .singul-app-icon": {
7082
- width: 40,
7083
- height: 40,
7178
+ width: 36,
7179
+ height: 36,
7084
7180
  borderRadius: 8,
7085
7181
  padding: 4
7086
7182
  },
7183
+ "& .singul-results-grid .singul-app-details": { minWidth: 0 },
7184
+ "& .singul-results-grid .singul-app-name": { maxWidth: "100%" },
7185
+ "& .singul-results-grid .singul-checkbox": { marginLeft: "auto" },
7087
7186
  ...highlightActive && highlightAppName ? {
7088
7187
  [`& .singul-dropdown-item[data-app-name="${highlightAppName}"]`]: {
7089
7188
  borderColor: "hsl(var(--primary)) !important",
@@ -7104,7 +7203,7 @@ function AppSearchDrawer({
7104
7203
  exit: { opacity: 0, x: -20 },
7105
7204
  transition: { duration: 0.2 },
7106
7205
  style: { height: "100%", minHeight: 0 },
7107
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
7206
+ children: bodyReady ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
7108
7207
  ShuffleMCP2,
7109
7208
  {
7110
7209
  apiKey: API_CONFIG.apiKey || void 0,
@@ -7155,7 +7254,32 @@ function AppSearchDrawer({
7155
7254
  })),
7156
7255
  customStyles: singulStyles
7157
7256
  }
7158
- )
7257
+ ) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_material11.Box, { sx: { display: "flex", flexDirection: "column", gap: 1.5, height: "100%" }, children: [
7258
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material11.Box, { sx: {
7259
+ height: 44,
7260
+ borderRadius: "12px",
7261
+ border: "1px solid hsl(var(--border))",
7262
+ backgroundColor: "hsl(var(--background-elevated))"
7263
+ } }),
7264
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material11.Box, { sx: {
7265
+ display: "grid",
7266
+ gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
7267
+ gap: "12px",
7268
+ mt: 1
7269
+ }, children: Array.from({ length: 8 }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material11.Box, { sx: {
7270
+ height: 78,
7271
+ borderRadius: "12px",
7272
+ backgroundColor: "hsl(var(--input))",
7273
+ border: "1px solid hsl(var(--border))",
7274
+ opacity: 0.6,
7275
+ animation: "shufflePulse 1.4s ease-in-out infinite",
7276
+ animationDelay: `${i * 60}ms`,
7277
+ "@keyframes shufflePulse": {
7278
+ "0%, 100%": { opacity: 0.35 },
7279
+ "50%": { opacity: 0.7 }
7280
+ }
7281
+ } }, i)) })
7282
+ ] })
7159
7283
  },
7160
7284
  "search"
7161
7285
  ) })
@@ -11780,10 +11904,356 @@ var AgentUI = ({
11780
11904
  var AgentUI_default = AgentUI;
11781
11905
 
11782
11906
  // components/AgentRunDrawer.tsx
11907
+ var import_react18 = require("react");
11908
+ var import_material19 = require("@mui/material");
11909
+ var import_lucide_react12 = require("lucide-react");
11910
+
11911
+ // components/LocalLLMConfig.tsx
11783
11912
  var import_react16 = require("react");
11913
+ var import_material18 = require("@mui/material");
11914
+ init_api();
11915
+
11916
+ // components/UsageBar.tsx
11784
11917
  var import_material17 = require("@mui/material");
11785
- var import_lucide_react12 = require("lucide-react");
11786
11918
  var import_jsx_runtime21 = require("react/jsx-runtime");
11919
+ var fmt = (n) => n.toLocaleString();
11920
+ var UsageBar = ({
11921
+ label,
11922
+ usage,
11923
+ limit,
11924
+ unit,
11925
+ hint,
11926
+ actionLabel,
11927
+ actionHref
11928
+ }) => {
11929
+ const safeLimit = Math.max(limit, 0);
11930
+ const pct = safeLimit > 0 ? usage / safeLimit * 100 : 0;
11931
+ const isOver = pct >= 100;
11932
+ const isWarn = pct >= 65 && !isOver;
11933
+ const accent = isOver ? "hsl(var(--destructive))" : isWarn ? "hsl(var(--severity-medium))" : "hsl(var(--muted-foreground))";
11934
+ 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 : ""}`;
11935
+ 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: [
11936
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material17.Box, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 1 }, children: [
11937
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
11938
+ import_material17.Typography,
11939
+ {
11940
+ sx: {
11941
+ fontSize: "12.8px",
11942
+ fontWeight: 500,
11943
+ color: "hsl(var(--muted-foreground))",
11944
+ lineHeight: 1.2
11945
+ },
11946
+ children: label
11947
+ }
11948
+ ),
11949
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material17.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
11950
+ actionLabel && actionHref && (isWarn || isOver) && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
11951
+ import_material17.Box,
11952
+ {
11953
+ component: "a",
11954
+ href: actionHref,
11955
+ target: "_blank",
11956
+ rel: "noopener noreferrer",
11957
+ sx: {
11958
+ fontSize: "12.8px",
11959
+ fontWeight: 600,
11960
+ color: accent,
11961
+ textDecoration: "none",
11962
+ "&:hover": { textDecoration: "underline" }
11963
+ },
11964
+ children: actionLabel
11965
+ }
11966
+ ),
11967
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
11968
+ import_material17.Typography,
11969
+ {
11970
+ sx: {
11971
+ fontSize: "12.8px",
11972
+ fontWeight: 500,
11973
+ color: accent,
11974
+ whiteSpace: "nowrap",
11975
+ fontVariantNumeric: "tabular-nums"
11976
+ },
11977
+ children: safeLimit > 0 ? `${fmt(usage)} / ${fmt(safeLimit)}${unit ? " " + unit : ""}` : `${fmt(usage)}${unit ? " " + unit : ""}`
11978
+ }
11979
+ )
11980
+ ] })
11981
+ ] }),
11982
+ /* @__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)(
11983
+ import_material17.Box,
11984
+ {
11985
+ sx: {
11986
+ width: `${Math.min(Math.max(pct, 0), 100)}%`,
11987
+ height: "100%",
11988
+ bgcolor: isOver ? "hsl(var(--destructive))" : isWarn ? "hsl(var(--severity-medium))" : "hsl(var(--severity-low, 142 71% 45%))",
11989
+ transition: "width 0.3s ease"
11990
+ }
11991
+ }
11992
+ ) })
11993
+ ] }) });
11994
+ };
11995
+
11996
+ // components/LocalLLMConfig.tsx
11997
+ var import_jsx_runtime22 = require("react/jsx-runtime");
11998
+ var import_react17 = require("react");
11999
+ var OPENAI_APP_NAME = "OpenAI";
12000
+ var OPENAI_APP_ID = "5d19dd82517870c68d40cacad9b5ca91";
12001
+ var SHUFFLE_AI_PRESET = "Shuffle AI";
12002
+ var CUSTOM_PRESET = "Custom / self-hosted";
12003
+ var OPENAI_ALGOLIA_APP = {
12004
+ name: OPENAI_APP_NAME,
12005
+ description: "OpenAI-compatible LLM endpoint for agent operations",
12006
+ objectID: OPENAI_APP_ID,
12007
+ creator: "",
12008
+ app_version: "1.0.0",
12009
+ image_url: "",
12010
+ time_edited: 0,
12011
+ generated: false,
12012
+ invalid: false,
12013
+ priority: 0,
12014
+ actions: 0,
12015
+ tags: [],
12016
+ accessible_by: [],
12017
+ categories: [],
12018
+ action_labels: [],
12019
+ triggers: [],
12020
+ verified: true
12021
+ };
12022
+ var ENDPOINT_PRESETS = [
12023
+ { label: SHUFFLE_AI_PRESET, url: "" },
12024
+ { label: "OpenAI", url: "https://api.openai.com/v1" },
12025
+ { label: "Anthropic", url: "https://api.anthropic.com/v1/" },
12026
+ { label: "Google Gemini", url: "https://generativelanguage.googleapis.com/v1beta/openai/" },
12027
+ { label: "Mistral", url: "https://api.mistral.ai/v1" },
12028
+ { label: "Groq", url: "https://api.groq.com/openai/v1" },
12029
+ { label: "Together AI", url: "https://api.together.xyz/v1" },
12030
+ { label: "OpenRouter", url: "https://openrouter.ai/api/v1" },
12031
+ { label: "Ollama (localhost)", url: "http://localhost:11434/v1" },
12032
+ { label: "LM Studio (localhost)", url: "http://localhost:1234/v1" },
12033
+ { label: CUSTOM_PRESET, url: "" }
12034
+ ];
12035
+ var LocalLLMConfig = ({ compact, globalUrl, userdata, isLoaded, isLoggedIn, serverside, theme, colorMode }) => {
12036
+ useSyncHostBaseUrl(globalUrl);
12037
+ const { authStates, authenticatedApps, handleAuthChange, handleTestConnection, handleSaveAuth, refreshAuth } = useAppAuth();
12038
+ const [expanded, setExpanded] = (0, import_react16.useState)(true);
12039
+ const [selectedPreset, setSelectedPreset] = (0, import_react16.useState)("");
12040
+ const [customUrl, setCustomUrl] = (0, import_react16.useState)("");
12041
+ const [confirmShuffleAIOpen, setConfirmShuffleAIOpen] = (0, import_react16.useState)(false);
12042
+ const openaiEntries = authenticatedApps.filter(
12043
+ (a) => a.app?.name?.toLowerCase() === "openai" || a.app?.id === OPENAI_APP_ID
12044
+ );
12045
+ const authState = authStates[OPENAI_APP_ID] || {
12046
+ systemId: OPENAI_APP_ID,
12047
+ status: "pending",
12048
+ credentials: {}
12049
+ };
12050
+ const currentUrl = authState.credentials?.url || "";
12051
+ const attemptedDeletionRef = (0, import_react16.useRef)(/* @__PURE__ */ new Set());
12052
+ (0, import_react16.useEffect)(() => {
12053
+ if (authState.status === "testing") return;
12054
+ const failedEntries = openaiEntries.filter((e) => e.validation && e.validation.valid === false && e.id);
12055
+ if (failedEntries.length === 0) return;
12056
+ let cancelled = false;
12057
+ (async () => {
12058
+ let deletedAny = false;
12059
+ for (const entry of failedEntries) {
12060
+ const id = entry.id;
12061
+ if (attemptedDeletionRef.current.has(id)) continue;
12062
+ attemptedDeletionRef.current.add(id);
12063
+ try {
12064
+ const resp = await fetch(getApiUrl(`/api/v1/apps/authentication/${id}`), {
12065
+ method: "DELETE",
12066
+ credentials: "include",
12067
+ headers: { ...getAuthHeader() }
12068
+ });
12069
+ if (resp.ok) deletedAny = true;
12070
+ } catch (err) {
12071
+ console.error("[LocalLLMConfig] Failed to auto-delete failed OpenAI auth:", err);
12072
+ }
12073
+ }
12074
+ if (!cancelled && deletedAny) {
12075
+ await refreshAuth();
12076
+ refreshAllIntegrationStatus();
12077
+ }
12078
+ })();
12079
+ return () => {
12080
+ cancelled = true;
12081
+ };
12082
+ }, [openaiEntries, authState.status, refreshAuth]);
12083
+ const hasOpenAIEntries = openaiEntries.length > 0;
12084
+ const effectivePreset = (0, import_react16.useMemo)(() => {
12085
+ if (selectedPreset) return selectedPreset;
12086
+ if (!currentUrl && !hasOpenAIEntries) return SHUFFLE_AI_PRESET;
12087
+ if (!currentUrl) return "";
12088
+ const match = ENDPOINT_PRESETS.find((p) => p.url && p.url === currentUrl);
12089
+ return match ? match.label : CUSTOM_PRESET;
12090
+ }, [selectedPreset, currentUrl, hasOpenAIEntries]);
12091
+ const applyShuffleAI = async () => {
12092
+ let deletedAny = false;
12093
+ for (const entry of openaiEntries) {
12094
+ if (!entry.id) continue;
12095
+ try {
12096
+ const resp = await fetch(getApiUrl(`/api/v1/apps/authentication/${entry.id}`), {
12097
+ method: "DELETE",
12098
+ credentials: "include",
12099
+ headers: { ...getAuthHeader() }
12100
+ });
12101
+ if (resp.ok) deletedAny = true;
12102
+ } catch (err) {
12103
+ console.error("[LocalLLMConfig] Failed to delete OpenAI auth when switching to Shuffle AI:", err);
12104
+ }
12105
+ }
12106
+ handleAuthChange(OPENAI_APP_ID, {});
12107
+ setSelectedPreset(SHUFFLE_AI_PRESET);
12108
+ setCustomUrl("");
12109
+ if (deletedAny) {
12110
+ await refreshAuth();
12111
+ refreshAllIntegrationStatus();
12112
+ }
12113
+ };
12114
+ const handlePresetChange = (label) => {
12115
+ if (label === SHUFFLE_AI_PRESET) {
12116
+ if (hasOpenAIEntries) {
12117
+ setConfirmShuffleAIOpen(true);
12118
+ return;
12119
+ }
12120
+ void applyShuffleAI();
12121
+ return;
12122
+ }
12123
+ setSelectedPreset(label);
12124
+ const preset = ENDPOINT_PRESETS.find((p) => p.label === label);
12125
+ if (!preset) return;
12126
+ handleAuthChange(OPENAI_APP_ID, { ...authState.credentials, url: preset.label === CUSTOM_PRESET ? customUrl : preset.url });
12127
+ };
12128
+ const handleCustomUrlChange = (value) => {
12129
+ setCustomUrl(value);
12130
+ handleAuthChange(OPENAI_APP_ID, { ...authState.credentials, url: value });
12131
+ };
12132
+ const isShuffleAI = effectivePreset === SHUFFLE_AI_PRESET;
12133
+ const orgId = userdata?.active_org?.id;
12134
+ const [orgData, setOrgData] = (0, import_react16.useState)(null);
12135
+ (0, import_react16.useEffect)(() => {
12136
+ if (!orgId) return;
12137
+ let cancelled = false;
12138
+ (async () => {
12139
+ try {
12140
+ const res = await fetch(getApiUrl(`/api/v1/orgs/${orgId}`), {
12141
+ method: "GET",
12142
+ credentials: "include",
12143
+ headers: { ...getAuthHeader(), "Content-Type": "application/json" }
12144
+ });
12145
+ if (!res.ok) return;
12146
+ const data = await res.json();
12147
+ if (!cancelled) setOrgData(data);
12148
+ } catch (err) {
12149
+ console.error("[LocalLLMConfig] Failed to fetch org info:", err);
12150
+ }
12151
+ })();
12152
+ return () => {
12153
+ cancelled = true;
12154
+ };
12155
+ }, [orgId]);
12156
+ const sync = orgData?.sync_features ?? userdata?.sync_features ?? {};
12157
+ const appExec = sync.app_executions ?? {};
12158
+ const appRunLimit = Number(appExec.limit) || 0;
12159
+ const appRunUsage = Number(appExec.usage) || 0;
12160
+ const agentTokens = sync.agent_tokens ?? {};
12161
+ const agentTokenLimit = Number(agentTokens.limit) || 0;
12162
+ const agentTokenUsage = Number(agentTokens.usage) || 0;
12163
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Box, { sx: { display: "flex", flexDirection: "column", gap: 2.5 }, children: [
12164
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Box, { sx: { display: "flex", flexDirection: "column", gap: 1 }, children: [
12165
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Typography, { sx: { fontSize: "0.85rem", fontWeight: 600, color: "hsl(var(--foreground))" }, children: "AI Provider" }),
12166
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12167
+ import_material18.Autocomplete,
12168
+ {
12169
+ size: "small",
12170
+ fullWidth: true,
12171
+ disableClearable: true,
12172
+ options: ENDPOINT_PRESETS.map((p) => p.label),
12173
+ value: effectivePreset || null,
12174
+ onChange: (_e, val) => val && handlePresetChange(val),
12175
+ isOptionEqualToValue: (opt, val) => opt === val,
12176
+ renderOption: (props, option) => {
12177
+ const preset = ENDPOINT_PRESETS.find((p) => p.label === option);
12178
+ 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: [
12179
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Typography, { sx: { fontSize: "0.85rem", color: "hsl(var(--popover-foreground))" }, children: option }),
12180
+ 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 })
12181
+ ] }));
12182
+ },
12183
+ renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.TextField, { ...params, placeholder: "Search a provider\u2026" }),
12184
+ slotProps: {
12185
+ paper: { sx: { bgcolor: "hsl(var(--popover))", color: "hsl(var(--popover-foreground))", border: "1px solid hsl(var(--border))" } },
12186
+ popper: { sx: { zIndex: 9999 } }
12187
+ }
12188
+ }
12189
+ )
12190
+ ] }),
12191
+ !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: [
12192
+ 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.",
12193
+ " ",
12194
+ /* @__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" }),
12195
+ "."
12196
+ ] }) }),
12197
+ isShuffleAI && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Box, { sx: { display: "flex", flexDirection: "column", gap: 0.75, mt: 0.5, width: "100%" }, children: [
12198
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(UsageBar, { label: "App runs", usage: appRunUsage, limit: appRunLimit, unit: "runs", actionLabel: "Upgrade", actionHref: "https://shuffler.io/pricing" }),
12199
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(UsageBar, { label: "Agent tokens", usage: agentTokenUsage, limit: agentTokenLimit, unit: "tokens", actionLabel: "Upgrade", actionHref: "https://shuffler.io/pricing" })
12200
+ ] }),
12201
+ effectivePreset === CUSTOM_PRESET && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12202
+ import_material18.TextField,
12203
+ {
12204
+ size: "small",
12205
+ fullWidth: true,
12206
+ placeholder: "https://your-self-hosted-endpoint.example.com",
12207
+ value: customUrl || currentUrl,
12208
+ onChange: (e) => handleCustomUrlChange(e.target.value),
12209
+ helperText: "Enter the base URL of your OpenAI-compatible endpoint",
12210
+ sx: { "& .MuiFormHelperText-root": { color: "hsl(var(--muted-foreground))" } }
12211
+ }
12212
+ ),
12213
+ !isShuffleAI && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12214
+ AppAuthCard,
12215
+ {
12216
+ app: OPENAI_ALGOLIA_APP,
12217
+ authState,
12218
+ isExpanded: expanded,
12219
+ onToggle: () => setExpanded((prev) => !prev),
12220
+ onAuthChange: handleAuthChange,
12221
+ onTestConnection: (appId, authId) => handleTestConnection(appId, authId),
12222
+ onSaveAuth: (appId, creds) => handleSaveAuth(appId, creds, OPENAI_APP_NAME),
12223
+ apiAuthEntries: openaiEntries,
12224
+ onRefreshAuth: refreshAuth,
12225
+ disableUrlPrefill: true,
12226
+ hideHeader: true,
12227
+ hideStatusChips: true,
12228
+ hideDocsLink: true,
12229
+ hideUrlFields: true,
12230
+ borderless: true,
12231
+ globalUrl,
12232
+ userdata,
12233
+ isLoaded,
12234
+ isLoggedIn,
12235
+ serverside,
12236
+ theme,
12237
+ colorMode
12238
+ }
12239
+ ),
12240
+ /* @__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: [
12241
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.DialogTitle, { sx: { fontSize: "1rem", fontWeight: 600 }, children: "Switch to Shuffle AI?" }),
12242
+ /* @__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?" }) }),
12243
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.DialogActions, { sx: { px: 3, pb: 2 }, children: [
12244
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Button, { onClick: () => setConfirmShuffleAIOpen(false), sx: { color: "hsl(var(--muted-foreground))", textTransform: "none", height: 36 }, children: "Cancel" }),
12245
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Button, { onClick: async () => {
12246
+ setConfirmShuffleAIOpen(false);
12247
+ await applyShuffleAI();
12248
+ }, 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" })
12249
+ ] })
12250
+ ] })
12251
+ ] });
12252
+ };
12253
+ var LocalLLMConfig_default = LocalLLMConfig;
12254
+
12255
+ // components/AgentRunDrawer.tsx
12256
+ var import_jsx_runtime23 = require("react/jsx-runtime");
11787
12257
  var TAB_ORDER = ["run", "permissions", "localLLM"];
11788
12258
  var AgentRunDrawer = ({
11789
12259
  open,
@@ -11803,33 +12273,63 @@ var AgentRunDrawer = ({
11803
12273
  headerSx,
11804
12274
  tabsSx,
11805
12275
  bodySx,
11806
- globalUrl
12276
+ globalUrl,
12277
+ theme,
12278
+ colorMode,
12279
+ userdata,
12280
+ isLoaded,
12281
+ isLoggedIn,
12282
+ serverside
11807
12283
  }) => {
11808
12284
  useSyncHostBaseUrl(globalUrl);
11809
12285
  const themeScope = useShuffleMcpTheme();
11810
- const [activeTab, setActiveTab] = (0, import_react16.useState)(initialTab);
11811
- const prevOpenRef = (0, import_react16.useRef)(open);
11812
- (0, import_react16.useEffect)(() => {
12286
+ const [activeTab, setActiveTab] = (0, import_react18.useState)(initialTab);
12287
+ const prevOpenRef = (0, import_react18.useRef)(open);
12288
+ (0, import_react18.useEffect)(() => {
11813
12289
  if (open && !prevOpenRef.current) setActiveTab(initialTab);
11814
12290
  prevOpenRef.current = open;
11815
12291
  }, [open, initialTab]);
11816
- (0, import_react16.useEffect)(() => {
12292
+ (0, import_react18.useEffect)(() => {
11817
12293
  if (typeof window === "undefined") return;
11818
12294
  window.__shuffleAgentDrawerMounted = (window.__shuffleAgentDrawerMounted || 0) + 1;
11819
12295
  return () => {
11820
12296
  window.__shuffleAgentDrawerMounted = Math.max(0, (window.__shuffleAgentDrawerMounted || 1) - 1);
11821
12297
  };
11822
12298
  }, []);
12299
+ (0, import_react18.useEffect)(() => {
12300
+ if (typeof window === "undefined") return;
12301
+ const onOpen = (event) => {
12302
+ const tab = event.detail?.tab;
12303
+ if (tab === "localLLM") {
12304
+ event.preventDefault();
12305
+ setActiveTab("localLLM");
12306
+ }
12307
+ };
12308
+ window.addEventListener("agent-drawer-open", onOpen);
12309
+ return () => window.removeEventListener("agent-drawer-open", onOpen);
12310
+ }, []);
12311
+ const effectiveLocalLLMSlot = localLLMSlot ?? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
12312
+ LocalLLMConfig_default,
12313
+ {
12314
+ globalUrl,
12315
+ userdata,
12316
+ isLoaded,
12317
+ isLoggedIn,
12318
+ serverside,
12319
+ theme,
12320
+ colorMode
12321
+ }
12322
+ );
11823
12323
  const visibleTabs = TAB_ORDER.filter((t) => {
11824
12324
  if (t === "run") return true;
11825
12325
  if (t === "permissions") return !!permissionsSlot;
11826
- if (t === "localLLM") return !!localLLMSlot;
12326
+ if (t === "localLLM") return !!effectiveLocalLLMSlot;
11827
12327
  return false;
11828
12328
  });
11829
12329
  const showTabs = visibleTabs.length > 1;
11830
12330
  const safeActiveTab = visibleTabs.includes(activeTab) ? activeTab : "run";
11831
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
11832
- import_material17.Drawer,
12331
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
12332
+ import_material19.Drawer,
11833
12333
  {
11834
12334
  anchor: "right",
11835
12335
  open,
@@ -11851,8 +12351,8 @@ var AgentRunDrawer = ({
11851
12351
  }
11852
12352
  },
11853
12353
  children: [
11854
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
11855
- import_material17.Box,
12354
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
12355
+ import_material19.Box,
11856
12356
  {
11857
12357
  sx: [
11858
12358
  {
@@ -11867,8 +12367,8 @@ var AgentRunDrawer = ({
11867
12367
  ...Array.isArray(headerSx) ? headerSx : headerSx ? [headerSx] : []
11868
12368
  ],
11869
12369
  children: [
11870
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
11871
- import_material17.Box,
12370
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
12371
+ import_material19.Box,
11872
12372
  {
11873
12373
  sx: {
11874
12374
  width: 40,
@@ -11881,19 +12381,19 @@ var AgentRunDrawer = ({
11881
12381
  color: "hsl(var(--primary))",
11882
12382
  flexShrink: 0
11883
12383
  },
11884
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AgentIcon_default, { size: 22 })
12384
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AgentIcon_default, { size: 22 })
11885
12385
  }
11886
12386
  ),
11887
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material17.Box, { sx: { flex: 1, minWidth: 0 }, children: [
11888
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Typography, { sx: { fontWeight: 600, fontSize: "1.1rem", color: "hsl(var(--foreground))" }, children: title }),
11889
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Typography, { sx: { fontSize: "0.8rem", color: "hsl(var(--muted-foreground))" }, children: subtitle })
12387
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material19.Box, { sx: { flex: 1, minWidth: 0 }, children: [
12388
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Typography, { sx: { fontWeight: 600, fontSize: "1.1rem", color: "hsl(var(--foreground))" }, children: title }),
12389
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Typography, { sx: { fontSize: "0.8rem", color: "hsl(var(--muted-foreground))" }, children: subtitle })
11890
12390
  ] }),
11891
- /* @__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 }) })
12391
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.IconButton, { onClick: onClose, size: "small", sx: { color: "hsl(var(--muted-foreground))" }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react12.X, { size: 16 }) })
11892
12392
  ]
11893
12393
  }
11894
12394
  ),
11895
- 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)(
11896
- import_material17.Tabs,
12395
+ 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)(
12396
+ import_material19.Tabs,
11897
12397
  {
11898
12398
  value: safeActiveTab,
11899
12399
  onChange: (_, v) => setActiveTab(v),
@@ -11914,36 +12414,36 @@ var AgentRunDrawer = ({
11914
12414
  ...Array.isArray(tabsSx) ? tabsSx : tabsSx ? [tabsSx] : []
11915
12415
  ],
11916
12416
  children: [
11917
- visibleTabs.includes("run") && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
11918
- import_material17.Tab,
12417
+ visibleTabs.includes("run") && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
12418
+ import_material19.Tab,
11919
12419
  {
11920
12420
  value: "run",
11921
12421
  label: "Run",
11922
- icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.Play, { size: 14 }),
12422
+ icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react12.Play, { size: 14 }),
11923
12423
  iconPosition: "start",
11924
12424
  sx: { gap: 0.75 }
11925
12425
  }
11926
12426
  ),
11927
- visibleTabs.includes("permissions") && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
11928
- import_material17.Tab,
12427
+ visibleTabs.includes("permissions") && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
12428
+ import_material19.Tab,
11929
12429
  {
11930
12430
  value: "permissions",
11931
- 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",
11932
- icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.ShieldCheck, { size: 14 }),
12431
+ 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",
12432
+ icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react12.ShieldCheck, { size: 14 }),
11933
12433
  iconPosition: "start",
11934
12434
  disabled: permissionsDisabled,
11935
12435
  sx: { gap: 0.75 }
11936
12436
  }
11937
12437
  ),
11938
- visibleTabs.includes("localLLM") && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
11939
- import_material17.Tab,
12438
+ visibleTabs.includes("localLLM") && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
12439
+ import_material19.Tab,
11940
12440
  {
11941
12441
  value: "localLLM",
11942
- label: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material17.Box, { sx: { display: "flex", alignItems: "center", gap: 0.5 }, children: [
12442
+ label: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material19.Box, { sx: { display: "flex", alignItems: "center", gap: 0.5 }, children: [
11943
12443
  "Local LLM",
11944
12444
  localLLMTabBadge
11945
12445
  ] }),
11946
- icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.Server, { size: 14 }),
12446
+ icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react12.Server, { size: 14 }),
11947
12447
  iconPosition: "start",
11948
12448
  sx: { gap: 0.75 }
11949
12449
  }
@@ -11951,20 +12451,22 @@ var AgentRunDrawer = ({
11951
12451
  ]
11952
12452
  }
11953
12453
  ) }),
11954
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material17.Box, { sx: [{ flex: 1, overflowY: "auto" }, ...Array.isArray(bodySx) ? bodySx : bodySx ? [bodySx] : []], children: [
11955
- safeActiveTab === "run" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Box, { sx: { px: 2, py: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12454
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material19.Box, { sx: [{ flex: 1, overflowY: "auto" }, ...Array.isArray(bodySx) ? bodySx : bodySx ? [bodySx] : []], children: [
12455
+ safeActiveTab === "run" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Box, { sx: { px: 2, py: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
11956
12456
  AgentUI_default,
11957
12457
  {
11958
12458
  compact: true,
11959
12459
  hideHeroIcon: true,
11960
12460
  title: "",
11961
12461
  subtitle: null,
11962
- apiBaseUrl: globalUrl,
11963
- ...agentUIProps
12462
+ ...agentUIProps,
12463
+ apiBaseUrl: agentUIProps?.apiBaseUrl ?? globalUrl,
12464
+ theme: agentUIProps?.theme ?? theme,
12465
+ colorMode: agentUIProps?.colorMode ?? colorMode
11964
12466
  }
11965
12467
  ) }),
11966
- safeActiveTab === "permissions" && permissionsSlot && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Box, { sx: { px: 3, py: 2.5 }, children: permissionsSlot }),
11967
- safeActiveTab === "localLLM" && localLLMSlot && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Box, { sx: { px: 3, py: 2.5 }, children: localLLMSlot })
12468
+ safeActiveTab === "permissions" && permissionsSlot && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Box, { sx: { px: 3, py: 2.5 }, children: permissionsSlot }),
12469
+ safeActiveTab === "localLLM" && effectiveLocalLLMSlot && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Box, { sx: { px: 3, py: 2.5 }, children: effectiveLocalLLMSlot })
11968
12470
  ] })
11969
12471
  ]
11970
12472
  }
@@ -11973,8 +12475,8 @@ var AgentRunDrawer = ({
11973
12475
  var AgentRunDrawer_default = AgentRunDrawer;
11974
12476
 
11975
12477
  // components/AgentActivityList.tsx
11976
- var import_react17 = require("react");
11977
- var import_material18 = require("@mui/material");
12478
+ var import_react19 = require("react");
12479
+ var import_material20 = require("@mui/material");
11978
12480
  var import_lucide_react13 = require("lucide-react");
11979
12481
 
11980
12482
  // agentActivity.ts
@@ -11985,6 +12487,21 @@ var resolveHeaders = (apiKey, orgId) => {
11985
12487
  if (orgId) h["Org-Id"] = orgId;
11986
12488
  return h;
11987
12489
  };
12490
+ var uuid = () => {
12491
+ if (typeof crypto !== "undefined" && "randomUUID" in crypto) return crypto.randomUUID();
12492
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
12493
+ const r = Math.random() * 16 | 0;
12494
+ const v = c === "x" ? r : r & 3 | 8;
12495
+ return v.toString(16);
12496
+ });
12497
+ };
12498
+ var buildAppNameValue = (apps = []) => apps.filter((a) => !!a?.name).map((a) => a.name).join(",");
12499
+ var buildScheduleName = (input) => {
12500
+ const prompt = (input || "").trim();
12501
+ const words = prompt.replace(/[^a-zA-Z0-9\s-]/g, " ").split(/\s+/).filter(Boolean).slice(0, 6);
12502
+ const title = words.length ? words.map((w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()).join(" ") : "Scheduled Agent Run";
12503
+ return { name: title.slice(0, 80), description: (prompt || "Scheduled Agent Run").slice(0, 240) };
12504
+ };
11988
12505
  var searchAgentActivity = async (params = {}) => {
11989
12506
  const {
11990
12507
  cursor = "",
@@ -12040,6 +12557,127 @@ var listAgentScheduleWorkflows = async (params = {}) => {
12040
12557
  const list = Array.isArray(data) ? data : data?.workflows || [];
12041
12558
  return list.filter((w) => w && w.workflow_type === "AGENT_SCHEDULE").map((w) => ({ id: w.id || w._id, name: w.name || "Untitled", description: w.description }));
12042
12559
  };
12560
+ var scheduleAgentRun = async ({ cron, input, apps = [], onStep, apiKey, apiBaseUrl, orgId }) => {
12561
+ const headers = { "Content-Type": "application/json", ...resolveHeaders(apiKey, orgId) };
12562
+ const step = (id, state2, detail) => {
12563
+ try {
12564
+ onStep?.({ id, state: state2, detail });
12565
+ } catch {
12566
+ }
12567
+ };
12568
+ step("name", "active");
12569
+ const { name, description } = buildScheduleName(input);
12570
+ step("name", "done", name);
12571
+ step("workflow", "active");
12572
+ const createRes = await fetch(resolveUrl("/api/v1/workflows", apiBaseUrl), {
12573
+ method: "POST",
12574
+ credentials: "include",
12575
+ headers,
12576
+ body: JSON.stringify({ name, description })
12577
+ });
12578
+ if (!createRes.ok) {
12579
+ step("workflow", "error", `HTTP ${createRes.status}`);
12580
+ throw new Error(`Create workflow failed (${createRes.status})`);
12581
+ }
12582
+ const created = await createRes.json();
12583
+ const workflowId = created.id || created._id || created.workflow_id;
12584
+ if (!workflowId) {
12585
+ step("workflow", "error", "no id returned");
12586
+ throw new Error("Workflow created but no id returned");
12587
+ }
12588
+ const triggerId = uuid();
12589
+ const actionId = uuid();
12590
+ const branchId = uuid();
12591
+ const trigger = {
12592
+ app_name: "Schedule",
12593
+ app_version: "1.0.0",
12594
+ environment: "cloud",
12595
+ id_: triggerId,
12596
+ _id_: triggerId,
12597
+ id: triggerId,
12598
+ finished: true,
12599
+ label: name,
12600
+ type: "TRIGGER",
12601
+ is_valid: true,
12602
+ trigger_type: "SCHEDULE",
12603
+ status: "running",
12604
+ name: "Schedule",
12605
+ parameters: [{ name: "cron", example: "", value: cron }, { name: "execution_argument", example: "", value: "" }],
12606
+ position: { x: 254, y: 617 },
12607
+ flowOrientation: "horizontal"
12608
+ };
12609
+ const action = {
12610
+ name: "Run LLM",
12611
+ label: "AI_Agent_1",
12612
+ app_name: "AI Agent",
12613
+ app_version: "1.0.0",
12614
+ app_id: "shuffle_agent",
12615
+ description: "Run an LLM query against any tool you want",
12616
+ environment: "Cloud",
12617
+ errors: [],
12618
+ id_: actionId,
12619
+ _id_: actionId,
12620
+ id: actionId,
12621
+ is_valid: true,
12622
+ type: "ACTION",
12623
+ isStartNode: true,
12624
+ run_magic_output: false,
12625
+ authentication: [],
12626
+ example: "",
12627
+ category: "",
12628
+ authentication_id: "",
12629
+ template: false,
12630
+ finished: true,
12631
+ flowOrientation: "horizontal",
12632
+ position: { x: 517, y: 370 },
12633
+ selectedAuthentication: {},
12634
+ circleId: uuid(),
12635
+ execution_delay: 0,
12636
+ parameters: [
12637
+ { name: "app_name", value: buildAppNameValue(apps), required: true, description: "Comma-separated list of app names the agent is allowed to use." },
12638
+ { name: "input", value: input, required: true, multiline: true, description: "The input data for the LLM query" }
12639
+ ]
12640
+ };
12641
+ 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 }] };
12642
+ const putRes = await fetch(resolveUrl(`/api/v1/workflows/${workflowId}`, apiBaseUrl), {
12643
+ method: "PUT",
12644
+ credentials: "include",
12645
+ headers,
12646
+ body: JSON.stringify(updated)
12647
+ });
12648
+ if (!putRes.ok) {
12649
+ step("workflow", "error", `HTTP ${putRes.status}`);
12650
+ throw new Error(`Update workflow failed (${putRes.status})`);
12651
+ }
12652
+ step("workflow", "done", name);
12653
+ step("schedule", "active");
12654
+ const schedRes = await fetch(resolveUrl(`/api/v1/workflows/${workflowId}/schedule`, apiBaseUrl), {
12655
+ method: "POST",
12656
+ credentials: "include",
12657
+ headers,
12658
+ body: JSON.stringify({
12659
+ name: "Schedule",
12660
+ frequency: cron,
12661
+ cron,
12662
+ execution_argument: "",
12663
+ environment: "cloud",
12664
+ id: triggerId,
12665
+ start: actionId,
12666
+ parameters: [{ name: "cron", value: cron }, { name: "execution_argument", value: "" }]
12667
+ })
12668
+ }).catch(async (err) => {
12669
+ await fetch(resolveUrl(`/api/v1/workflows/${workflowId}`, apiBaseUrl), { method: "DELETE", credentials: "include", headers: resolveHeaders(apiKey, orgId) }).catch(() => void 0);
12670
+ throw err;
12671
+ });
12672
+ if (!schedRes.ok) {
12673
+ const errText = await schedRes.text().catch(() => "");
12674
+ await fetch(resolveUrl(`/api/v1/workflows/${workflowId}`, apiBaseUrl), { method: "DELETE", credentials: "include", headers: resolveHeaders(apiKey, orgId) }).catch(() => void 0);
12675
+ step("schedule", "error", `HTTP ${schedRes.status}`);
12676
+ throw new Error(`Scheduler rejected the cron \`${cron}\` (HTTP ${schedRes.status})${errText ? `: ${errText}` : ""}. The workflow has been deleted.`);
12677
+ }
12678
+ step("schedule", "done", cron);
12679
+ return { workflowId, name, cron };
12680
+ };
12043
12681
  var findAgentInputParam = (workflow) => {
12044
12682
  const actions = workflow?.actions || [];
12045
12683
  for (const a of actions) {
@@ -12129,16 +12767,16 @@ var stopAgentSchedule = async (workflowId, params = {}) => {
12129
12767
 
12130
12768
  // components/AgentActivityList.tsx
12131
12769
  var import_lucide_react14 = require("lucide-react");
12132
- var import_jsx_runtime22 = require("react/jsx-runtime");
12770
+ var import_jsx_runtime24 = require("react/jsx-runtime");
12133
12771
  var STATUS_CONFIG = {
12134
- FINISHED: { icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.CheckCircle, { size: 16 }), color: "hsl(var(--severity-low, 142 71% 45%))", label: "Completed" },
12135
- SUCCESS: { icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.CheckCircle, { size: 16 }), color: "hsl(var(--severity-low, 142 71% 45%))", label: "Completed" },
12136
- FAILED: { icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.XCircle, { size: 16 }), color: "hsl(var(--severity-critical, 0 72% 55%))", label: "Failed" },
12137
- ABORTED: { icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.XCircle, { size: 16 }), color: "hsl(var(--severity-critical, 0 72% 55%))", label: "Aborted" },
12138
- EXECUTING: { icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.Loader2, { size: 16 }), color: "hsl(var(--severity-medium, 38 92% 50%))", label: "Running" },
12139
- RUNNING: { icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.Loader2, { size: 16 }), color: "hsl(var(--severity-medium, 38 92% 50%))", label: "Running" },
12140
- WAITING: { icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.Clock, { size: 16 }), color: "hsl(var(--severity-info, 217 91% 60%))", label: "Waiting" },
12141
- 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" }
12772
+ FINISHED: { icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.CheckCircle, { size: 16 }), color: "hsl(var(--severity-low, 142 71% 45%))", label: "Completed" },
12773
+ SUCCESS: { icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.CheckCircle, { size: 16 }), color: "hsl(var(--severity-low, 142 71% 45%))", label: "Completed" },
12774
+ FAILED: { icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.XCircle, { size: 16 }), color: "hsl(var(--severity-critical, 0 72% 55%))", label: "Failed" },
12775
+ ABORTED: { icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.XCircle, { size: 16 }), color: "hsl(var(--severity-critical, 0 72% 55%))", label: "Aborted" },
12776
+ EXECUTING: { icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.Loader2, { size: 16 }), color: "hsl(var(--severity-medium, 38 92% 50%))", label: "Running" },
12777
+ RUNNING: { icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.Loader2, { size: 16 }), color: "hsl(var(--severity-medium, 38 92% 50%))", label: "Running" },
12778
+ WAITING: { icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.Clock, { size: 16 }), color: "hsl(var(--severity-info, 217 91% 60%))", label: "Waiting" },
12779
+ LIMIT_REACHED: { icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react14.AlertTriangle, { size: 16 }), color: "hsl(var(--severity-medium, 38 92% 50%))", label: "Limit reached" }
12142
12780
  };
12143
12781
  var getEffectiveStatus = (run) => {
12144
12782
  const raw = (run.status || "").toUpperCase();
@@ -12154,12 +12792,12 @@ var getEffectiveStatus = (run) => {
12154
12792
  var getRunIcon = (run) => {
12155
12793
  const src = (run.execution_source || "").toLowerCase();
12156
12794
  const arg = (run.execution_argument || "").toLowerCase();
12157
- if (src.includes("schedule") || src.includes("cron")) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.Clock, { size: 18 });
12158
- if (src.includes("webhook") || src.includes("http")) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.Globe, { size: 18 });
12159
- if (arg.includes("alert") || arg.includes("detect")) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.Activity, { size: 18 });
12160
- if (arg.includes("report") || arg.includes("email")) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.FileText, { size: 18 });
12161
- if (arg.includes("endpoint") || arg.includes("server")) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.Server, { size: 18 });
12162
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.Zap, { size: 18 });
12795
+ if (src.includes("schedule") || src.includes("cron")) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.Clock, { size: 18 });
12796
+ if (src.includes("webhook") || src.includes("http")) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.Globe, { size: 18 });
12797
+ if (arg.includes("alert") || arg.includes("detect")) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.Activity, { size: 18 });
12798
+ if (arg.includes("report") || arg.includes("email")) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.FileText, { size: 18 });
12799
+ if (arg.includes("endpoint") || arg.includes("server")) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.Server, { size: 18 });
12800
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.Zap, { size: 18 });
12163
12801
  };
12164
12802
  var getRunIconColor = (run) => {
12165
12803
  const status = getEffectiveStatus(run);
@@ -12253,8 +12891,8 @@ var AgentRunRow = ({ run, onClick, sx }) => {
12253
12891
  const iconColor = getRunIconColor(run);
12254
12892
  const duration = formatDuration(run);
12255
12893
  const tools = getRunTools(run);
12256
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
12257
- import_material18.Box,
12894
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
12895
+ import_material20.Box,
12258
12896
  {
12259
12897
  onClick,
12260
12898
  sx: [
@@ -12277,8 +12915,8 @@ var AgentRunRow = ({ run, onClick, sx }) => {
12277
12915
  ...Array.isArray(sx) ? sx : sx ? [sx] : []
12278
12916
  ],
12279
12917
  children: [
12280
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12281
- import_material18.Box,
12918
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
12919
+ import_material20.Box,
12282
12920
  {
12283
12921
  sx: {
12284
12922
  width: 40,
@@ -12294,10 +12932,10 @@ var AgentRunRow = ({ run, onClick, sx }) => {
12294
12932
  children: getRunIcon(run)
12295
12933
  }
12296
12934
  ),
12297
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Box, { sx: { flex: 1, minWidth: 0 }, children: [
12298
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Box, { sx: { display: "flex", alignItems: "center", gap: 1, mb: 0.25 }, children: [
12299
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12300
- import_material18.Typography,
12935
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.Box, { sx: { flex: 1, minWidth: 0 }, children: [
12936
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.Box, { sx: { display: "flex", alignItems: "center", gap: 1, mb: 0.25 }, children: [
12937
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
12938
+ import_material20.Typography,
12301
12939
  {
12302
12940
  sx: {
12303
12941
  fontSize: "0.9rem",
@@ -12310,10 +12948,10 @@ var AgentRunRow = ({ run, onClick, sx }) => {
12310
12948
  children: getRunTitle(run)
12311
12949
  }
12312
12950
  ),
12313
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Box, { sx: { display: "flex", alignItems: "center", color: cfg.color, flexShrink: 0 }, children: cfg.icon })
12951
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Box, { sx: { display: "flex", alignItems: "center", color: cfg.color, flexShrink: 0 }, children: cfg.icon })
12314
12952
  ] }),
12315
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12316
- import_material18.Typography,
12953
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
12954
+ import_material20.Typography,
12317
12955
  {
12318
12956
  sx: {
12319
12957
  fontSize: "0.78rem",
@@ -12325,16 +12963,16 @@ var AgentRunRow = ({ run, onClick, sx }) => {
12325
12963
  children: getRunSubtitle(run)
12326
12964
  }
12327
12965
  ),
12328
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Box, { sx: { display: "flex", alignItems: "center", gap: 1, mt: 0.5 }, children: [
12329
- /* @__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" }),
12330
- duration && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
12331
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.4 }, children: "\xB7" }),
12332
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.7 }, children: duration })
12966
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.Box, { sx: { display: "flex", alignItems: "center", gap: 1, mt: 0.5 }, children: [
12967
+ /* @__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" }),
12968
+ duration && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
12969
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.4 }, children: "\xB7" }),
12970
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.7 }, children: duration })
12333
12971
  ] })
12334
12972
  ] })
12335
12973
  ] }),
12336
- tools.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12337
- import_material18.Box,
12974
+ tools.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
12975
+ import_material20.Box,
12338
12976
  {
12339
12977
  sx: {
12340
12978
  display: { xs: "none", sm: "flex" },
@@ -12345,8 +12983,8 @@ var AgentRunRow = ({ run, onClick, sx }) => {
12345
12983
  maxWidth: 220,
12346
12984
  flexShrink: 0
12347
12985
  },
12348
- children: tools.map((t) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Tooltip, { title: t, arrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12349
- import_material18.Chip,
12986
+ children: tools.map((t) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Tooltip, { title: t, arrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
12987
+ import_material20.Chip,
12350
12988
  {
12351
12989
  label: t,
12352
12990
  size: "small",
@@ -12394,21 +13032,21 @@ var AgentActivityList = ({
12394
13032
  toolbarSx,
12395
13033
  rowSx
12396
13034
  }) => {
12397
- const [runs, setRuns] = (0, import_react17.useState)([]);
12398
- const [cursor, setCursor] = (0, import_react17.useState)("");
12399
- const [hasMore, setHasMore] = (0, import_react17.useState)(false);
12400
- const [isLoading, setIsLoading] = (0, import_react17.useState)(false);
12401
- const [error, setError] = (0, import_react17.useState)(null);
12402
- const [statusFilter, setStatusFilter] = (0, import_react17.useState)("");
12403
- const [searchQuery, setSearchQuery] = (0, import_react17.useState)("");
12404
- const [debouncedQuery, setDebouncedQuery] = (0, import_react17.useState)("");
12405
- const [agentWorkflows, setAgentWorkflows] = (0, import_react17.useState)([]);
12406
- const [workflowFilter, setWorkflowFilter] = (0, import_react17.useState)("");
12407
- const [stopOpen, setStopOpen] = (0, import_react17.useState)(false);
12408
- const [stopLoading, setStopLoading] = (0, import_react17.useState)(false);
12409
- const debounceRef = (0, import_react17.useRef)();
13035
+ const [runs, setRuns] = (0, import_react19.useState)([]);
13036
+ const [cursor, setCursor] = (0, import_react19.useState)("");
13037
+ const [hasMore, setHasMore] = (0, import_react19.useState)(false);
13038
+ const [isLoading, setIsLoading] = (0, import_react19.useState)(false);
13039
+ const [error, setError] = (0, import_react19.useState)(null);
13040
+ const [statusFilter, setStatusFilter] = (0, import_react19.useState)("");
13041
+ const [searchQuery, setSearchQuery] = (0, import_react19.useState)("");
13042
+ const [debouncedQuery, setDebouncedQuery] = (0, import_react19.useState)("");
13043
+ const [agentWorkflows, setAgentWorkflows] = (0, import_react19.useState)([]);
13044
+ const [workflowFilter, setWorkflowFilter] = (0, import_react19.useState)("");
13045
+ const [stopOpen, setStopOpen] = (0, import_react19.useState)(false);
13046
+ const [stopLoading, setStopLoading] = (0, import_react19.useState)(false);
13047
+ const debounceRef = (0, import_react19.useRef)();
12410
13048
  const selectedAgentWorkflow = agentWorkflows.find((w) => w.id === workflowFilter) || null;
12411
- const openEditPrompt = (0, import_react17.useCallback)(async () => {
13049
+ const openEditPrompt = (0, import_react19.useCallback)(async () => {
12412
13050
  if (!workflowFilter) return;
12413
13051
  try {
12414
13052
  const { prompt, apps } = await getAgentScheduleConfig(workflowFilter, { apiKey, apiBaseUrl, orgId });
@@ -12422,7 +13060,7 @@ var AgentActivityList = ({
12422
13060
  setError(e instanceof Error ? e.message : "Failed to load workflow");
12423
13061
  }
12424
13062
  }, [workflowFilter, selectedAgentWorkflow, apiKey, apiBaseUrl, orgId, onEditWorkflow]);
12425
- const confirmStop = (0, import_react17.useCallback)(async () => {
13063
+ const confirmStop = (0, import_react19.useCallback)(async () => {
12426
13064
  if (!workflowFilter) return;
12427
13065
  setStopLoading(true);
12428
13066
  try {
@@ -12437,15 +13075,15 @@ var AgentActivityList = ({
12437
13075
  setStopLoading(false);
12438
13076
  }
12439
13077
  }, [workflowFilter, apiKey, apiBaseUrl, orgId]);
12440
- const updateSearchQuery = (0, import_react17.useCallback)((q) => {
13078
+ const updateSearchQuery = (0, import_react19.useCallback)((q) => {
12441
13079
  setSearchQuery(q);
12442
13080
  if (debounceRef.current) clearTimeout(debounceRef.current);
12443
13081
  debounceRef.current = setTimeout(() => setDebouncedQuery(q), 350);
12444
13082
  }, []);
12445
- (0, import_react17.useEffect)(() => () => {
13083
+ (0, import_react19.useEffect)(() => () => {
12446
13084
  if (debounceRef.current) clearTimeout(debounceRef.current);
12447
13085
  }, []);
12448
- const fetchRuns = (0, import_react17.useCallback)(
13086
+ const fetchRuns = (0, import_react19.useCallback)(
12449
13087
  async (append = false, cursorParam = "") => {
12450
13088
  setIsLoading(true);
12451
13089
  setError(null);
@@ -12474,10 +13112,10 @@ var AgentActivityList = ({
12474
13112
  },
12475
13113
  [statusFilter, limit, apiKey, apiBaseUrl, orgId, workflowFilter]
12476
13114
  );
12477
- (0, import_react17.useEffect)(() => {
13115
+ (0, import_react19.useEffect)(() => {
12478
13116
  fetchRuns(false, "");
12479
13117
  }, [statusFilter, apiKey, apiBaseUrl, orgId, workflowFilter]);
12480
- (0, import_react17.useEffect)(() => {
13118
+ (0, import_react19.useEffect)(() => {
12481
13119
  let cancelled = false;
12482
13120
  listAgentScheduleWorkflows({ apiKey, apiBaseUrl, orgId }).then((items) => {
12483
13121
  if (!cancelled) setAgentWorkflows(items);
@@ -12487,7 +13125,7 @@ var AgentActivityList = ({
12487
13125
  cancelled = true;
12488
13126
  };
12489
13127
  }, [apiKey, apiBaseUrl, orgId]);
12490
- const loadMore = (0, import_react17.useCallback)(() => {
13128
+ const loadMore = (0, import_react19.useCallback)(() => {
12491
13129
  if (cursor && !isLoading) fetchRuns(true, cursor);
12492
13130
  }, [cursor, isLoading, fetchRuns]);
12493
13131
  const filteredRuns = debouncedQuery ? runs.filter((r) => {
@@ -12500,15 +13138,15 @@ var AgentActivityList = ({
12500
13138
  ].filter(Boolean).join(" ").toLowerCase();
12501
13139
  return hay.includes(debouncedQuery.toLowerCase());
12502
13140
  }) : runs;
12503
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
12504
- import_material18.Box,
13141
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
13142
+ import_material20.Box,
12505
13143
  {
12506
13144
  className,
12507
13145
  sx: [{ display: "flex", flexDirection: "column", gap: 2 }, ...Array.isArray(sx) ? sx : sx ? [sx] : []],
12508
13146
  children: [
12509
- (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: [
12510
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
12511
- import_material18.Select,
13147
+ (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: [
13148
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
13149
+ import_material20.Select,
12512
13150
  {
12513
13151
  size: "small",
12514
13152
  value: workflowFilter,
@@ -12544,13 +13182,13 @@ var AgentActivityList = ({
12544
13182
  }
12545
13183
  },
12546
13184
  children: [
12547
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.MenuItem, { value: "", sx: { fontSize: "0.85rem" }, children: "All Agent runs" }),
12548
- agentWorkflows.map((w) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.MenuItem, { value: w.id, sx: { fontSize: "0.85rem" }, children: w.name }, w.id))
13185
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.MenuItem, { value: "", sx: { fontSize: "0.85rem" }, children: "All Agent runs" }),
13186
+ agentWorkflows.map((w) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.MenuItem, { value: w.id, sx: { fontSize: "0.85rem" }, children: w.name }, w.id))
12549
13187
  ]
12550
13188
  }
12551
13189
  ),
12552
- showSearchBar && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12553
- import_material18.TextField,
13190
+ showSearchBar && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13191
+ import_material20.TextField,
12554
13192
  {
12555
13193
  placeholder: "Search results...",
12556
13194
  size: "small",
@@ -12558,7 +13196,7 @@ var AgentActivityList = ({
12558
13196
  onChange: (e) => updateSearchQuery(e.target.value),
12559
13197
  slotProps: {
12560
13198
  input: {
12561
- 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))" }) })
13199
+ startAdornment: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.InputAdornment, { position: "start", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.Search, { size: 18, color: "hsl(var(--muted-foreground))" }) })
12562
13200
  }
12563
13201
  },
12564
13202
  sx: {
@@ -12578,7 +13216,7 @@ var AgentActivityList = ({
12578
13216
  }
12579
13217
  }
12580
13218
  ),
12581
- showStatusChips && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
13219
+ showStatusChips && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
12582
13220
  SegmentedControl,
12583
13221
  {
12584
13222
  size: "sm",
@@ -12588,10 +13226,10 @@ var AgentActivityList = ({
12588
13226
  options: STATUS_FILTERS.map((f) => ({ value: f.value, label: f.label }))
12589
13227
  }
12590
13228
  ),
12591
- isLoading && runs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.CircularProgress, { size: 16, sx: { color: "hsl(var(--primary))", ml: 0.5 } })
13229
+ isLoading && runs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.CircularProgress, { size: 16, sx: { color: "hsl(var(--primary))", ml: 0.5 } })
12592
13230
  ] }),
12593
- selectedAgentWorkflow && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
12594
- import_material18.Box,
13231
+ selectedAgentWorkflow && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
13232
+ import_material20.Box,
12595
13233
  {
12596
13234
  sx: {
12597
13235
  display: "flex",
@@ -12603,15 +13241,15 @@ var AgentActivityList = ({
12603
13241
  bgcolor: "hsl(var(--card))"
12604
13242
  },
12605
13243
  children: [
12606
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Box, { sx: { flex: 1, minWidth: 0 }, children: [
12607
- /* @__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 }),
12608
- 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 })
13244
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.Box, { sx: { flex: 1, minWidth: 0 }, children: [
13245
+ /* @__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 }),
13246
+ selectedAgentWorkflow.description && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Typography, { sx: { fontSize: "0.75rem", color: "hsl(var(--muted-foreground))", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: selectedAgentWorkflow.description })
12609
13247
  ] }),
12610
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12611
- import_material18.Button,
13248
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13249
+ import_material20.Button,
12612
13250
  {
12613
13251
  size: "small",
12614
- startIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react14.Pencil, { size: 14 }),
13252
+ startIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react14.Pencil, { size: 14 }),
12615
13253
  onClick: openEditPrompt,
12616
13254
  sx: {
12617
13255
  height: 36,
@@ -12626,11 +13264,11 @@ var AgentActivityList = ({
12626
13264
  children: "Edit"
12627
13265
  }
12628
13266
  ),
12629
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12630
- import_material18.Button,
13267
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13268
+ import_material20.Button,
12631
13269
  {
12632
13270
  size: "small",
12633
- startIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react14.StopCircle, { size: 14 }),
13271
+ startIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react14.StopCircle, { size: 14 }),
12634
13272
  onClick: () => setStopOpen(true),
12635
13273
  sx: {
12636
13274
  height: 36,
@@ -12648,17 +13286,17 @@ var AgentActivityList = ({
12648
13286
  ]
12649
13287
  }
12650
13288
  ),
12651
- 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: [
12652
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.AlertCircle, { size: 28, style: { color: "hsl(var(--severity-critical, 0 72% 55%))", marginBottom: 8 } }),
12653
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12654
- import_material18.Typography,
13289
+ 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: [
13290
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.AlertCircle, { size: 28, style: { color: "hsl(var(--severity-critical, 0 72% 55%))", marginBottom: 8 } }),
13291
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13292
+ import_material20.Typography,
12655
13293
  {
12656
13294
  sx: { color: "hsl(var(--severity-critical, 0 72% 55%))", fontSize: "0.9rem", mb: 1 },
12657
13295
  children: error
12658
13296
  }
12659
13297
  ),
12660
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12661
- import_material18.Button,
13298
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13299
+ import_material20.Button,
12662
13300
  {
12663
13301
  size: "small",
12664
13302
  onClick: () => fetchRuns(false, ""),
@@ -12666,24 +13304,24 @@ var AgentActivityList = ({
12666
13304
  children: "Try again"
12667
13305
  }
12668
13306
  )
12669
- ] }) : filteredRuns.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Box, { sx: { display: "flex", flexDirection: "column", alignItems: "center", textAlign: "center", py: 8 }, children: [
12670
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
13307
+ ] }) : filteredRuns.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.Box, { sx: { display: "flex", flexDirection: "column", alignItems: "center", textAlign: "center", py: 8 }, children: [
13308
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
12671
13309
  import_lucide_react13.Activity,
12672
13310
  {
12673
13311
  size: 40,
12674
13312
  style: { color: "hsl(var(--muted-foreground))", marginBottom: 12 }
12675
13313
  }
12676
13314
  ),
12677
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Typography, { sx: { color: "hsl(var(--muted-foreground))", fontSize: "0.9rem" }, children: emptyTitle }),
12678
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12679
- import_material18.Typography,
13315
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Typography, { sx: { color: "hsl(var(--muted-foreground))", fontSize: "0.9rem" }, children: emptyTitle }),
13316
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13317
+ import_material20.Typography,
12680
13318
  {
12681
13319
  sx: { color: "hsl(var(--muted-foreground))", fontSize: "0.8rem", mt: 0.5, opacity: 0.7 },
12682
13320
  children: emptySubtitle
12683
13321
  }
12684
13322
  )
12685
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Box, { sx: { display: "flex", flexDirection: "column", gap: 1.5 }, children: [
12686
- filteredRuns.map((run, idx) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
13323
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.Box, { sx: { display: "flex", flexDirection: "column", gap: 1.5 }, children: [
13324
+ filteredRuns.map((run, idx) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
12687
13325
  AgentRunRow,
12688
13326
  {
12689
13327
  run,
@@ -12692,43 +13330,43 @@ var AgentActivityList = ({
12692
13330
  },
12693
13331
  run.execution_id || idx
12694
13332
  )),
12695
- hasMore && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Box, { sx: { display: "flex", justifyContent: "center", mt: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
12696
- import_material18.Button,
13333
+ hasMore && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Box, { sx: { display: "flex", justifyContent: "center", mt: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
13334
+ import_material20.Button,
12697
13335
  {
12698
13336
  size: "small",
12699
13337
  onClick: loadMore,
12700
13338
  disabled: isLoading,
12701
13339
  sx: { color: "hsl(var(--primary))", textTransform: "none", fontSize: "0.8rem" },
12702
13340
  children: [
12703
- isLoading ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.CircularProgress, { size: 14, sx: { mr: 1 } }) : null,
13341
+ isLoading ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.CircularProgress, { size: 14, sx: { mr: 1 } }) : null,
12704
13342
  "Load more"
12705
13343
  ]
12706
13344
  }
12707
13345
  ) })
12708
13346
  ] }),
12709
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
12710
- import_material18.Dialog,
13347
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
13348
+ import_material20.Dialog,
12711
13349
  {
12712
13350
  open: stopOpen,
12713
13351
  onClose: () => stopLoading ? null : setStopOpen(false),
12714
13352
  slotProps: { paper: { sx: { bgcolor: "hsl(var(--card))", color: "hsl(var(--foreground))", border: "1px solid hsl(var(--border))" } } },
12715
13353
  children: [
12716
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.DialogTitle, { sx: { fontSize: "1rem", fontWeight: 600 }, children: "Stop schedule?" }),
12717
- /* @__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: [
13354
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.DialogTitle, { sx: { fontSize: "1rem", fontWeight: 600 }, children: "Stop schedule?" }),
13355
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.DialogContent, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.Typography, { sx: { fontSize: "0.85rem", color: "hsl(var(--muted-foreground))" }, children: [
12718
13356
  'This will stop "',
12719
13357
  selectedAgentWorkflow?.name,
12720
13358
  '" and delete the scheduled workflow. Past executions remain visible. This cannot be undone.'
12721
13359
  ] }) }),
12722
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.DialogActions, { sx: { px: 3, pb: 2 }, children: [
12723
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Button, { onClick: () => setStopOpen(false), disabled: stopLoading, sx: { textTransform: "none", color: "hsl(var(--muted-foreground))" }, children: "Cancel" }),
12724
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
12725
- import_material18.Button,
13360
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.DialogActions, { sx: { px: 3, pb: 2 }, children: [
13361
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Button, { onClick: () => setStopOpen(false), disabled: stopLoading, sx: { textTransform: "none", color: "hsl(var(--muted-foreground))" }, children: "Cancel" }),
13362
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
13363
+ import_material20.Button,
12726
13364
  {
12727
13365
  onClick: confirmStop,
12728
13366
  disabled: stopLoading,
12729
13367
  sx: { textTransform: "none", bgcolor: "hsl(var(--severity-critical, 0 72% 55%))", color: "hsl(var(--primary-foreground))", "&:hover": { bgcolor: "hsla(var(--severity-critical, 0 72% 55%) / 0.9)" } },
12730
13368
  children: [
12731
- stopLoading ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.CircularProgress, { size: 16, sx: { color: "hsl(var(--primary-foreground))", mr: 1 } }) : null,
13369
+ stopLoading ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.CircularProgress, { size: 16, sx: { color: "hsl(var(--primary-foreground))", mr: 1 } }) : null,
12732
13370
  "Stop schedule"
12733
13371
  ]
12734
13372
  }
@@ -12744,9 +13382,9 @@ var AgentActivityList = ({
12744
13382
  var AgentActivityList_default = AgentActivityList;
12745
13383
 
12746
13384
  // components/AgentExecutionDrawer.tsx
12747
- var import_material19 = require("@mui/material");
13385
+ var import_material21 = require("@mui/material");
12748
13386
  var import_lucide_react15 = require("lucide-react");
12749
- var import_jsx_runtime23 = require("react/jsx-runtime");
13387
+ var import_jsx_runtime25 = require("react/jsx-runtime");
12750
13388
  var AgentExecutionDrawer = ({
12751
13389
  open,
12752
13390
  onClose,
@@ -12768,8 +13406,8 @@ var AgentExecutionDrawer = ({
12768
13406
  const statusKey = (run?.status || "").toUpperCase();
12769
13407
  const cfg = STATUS_CONFIG[statusKey] || STATUS_CONFIG.WAITING;
12770
13408
  const duration = run ? formatDuration(run) : "";
12771
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
12772
- import_material19.Drawer,
13409
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
13410
+ import_material21.Drawer,
12773
13411
  {
12774
13412
  anchor: "right",
12775
13413
  open,
@@ -12791,8 +13429,8 @@ var AgentExecutionDrawer = ({
12791
13429
  }
12792
13430
  },
12793
13431
  children: [
12794
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
12795
- import_material19.Box,
13432
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
13433
+ import_material21.Box,
12796
13434
  {
12797
13435
  sx: [
12798
13436
  {
@@ -12810,8 +13448,8 @@ var AgentExecutionDrawer = ({
12810
13448
  ...Array.isArray(headerSx) ? headerSx : headerSx ? [headerSx] : []
12811
13449
  ],
12812
13450
  children: [
12813
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
12814
- import_material19.Box,
13451
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13452
+ import_material21.Box,
12815
13453
  {
12816
13454
  sx: {
12817
13455
  width: 36,
@@ -12824,13 +13462,13 @@ var AgentExecutionDrawer = ({
12824
13462
  color: "hsl(var(--primary))",
12825
13463
  flexShrink: 0
12826
13464
  },
12827
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AgentIcon_default, { size: 20 })
13465
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AgentIcon_default, { size: 20 })
12828
13466
  }
12829
13467
  ),
12830
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material19.Box, { sx: { flex: 1, minWidth: 0 }, children: [
12831
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material19.Box, { sx: { display: "flex", alignItems: "center", gap: 1, minWidth: 0 }, children: [
12832
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
12833
- import_material19.Typography,
13468
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material21.Box, { sx: { flex: 1, minWidth: 0 }, children: [
13469
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material21.Box, { sx: { display: "flex", alignItems: "center", gap: 1, minWidth: 0 }, children: [
13470
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13471
+ import_material21.Typography,
12834
13472
  {
12835
13473
  sx: {
12836
13474
  fontSize: "0.95rem",
@@ -12843,22 +13481,22 @@ var AgentExecutionDrawer = ({
12843
13481
  children: run ? getRunTitle(run) : "Agent execution"
12844
13482
  }
12845
13483
  ),
12846
- run && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Box, { sx: { display: "flex", alignItems: "center", color: cfg.color, flexShrink: 0 }, children: cfg.icon })
13484
+ run && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Box, { sx: { display: "flex", alignItems: "center", color: cfg.color, flexShrink: 0 }, children: cfg.icon })
12847
13485
  ] }),
12848
- run && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material19.Box, { sx: { display: "flex", alignItems: "center", gap: 1, mt: 0.25 }, children: [
12849
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))" }, children: cfg.label }),
12850
- run.started_at && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
12851
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.4 }, children: "\xB7" }),
12852
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))" }, children: getTimeAgo(run.started_at) })
13486
+ run && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material21.Box, { sx: { display: "flex", alignItems: "center", gap: 1, mt: 0.25 }, children: [
13487
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))" }, children: cfg.label }),
13488
+ run.started_at && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
13489
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.4 }, children: "\xB7" }),
13490
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))" }, children: getTimeAgo(run.started_at) })
12853
13491
  ] }),
12854
- duration && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
12855
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.4 }, children: "\xB7" }),
12856
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))" }, children: duration })
13492
+ duration && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
13493
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.4 }, children: "\xB7" }),
13494
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))" }, children: duration })
12857
13495
  ] })
12858
13496
  ] })
12859
13497
  ] }),
12860
- run?.execution_id && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Tooltip, { title: "Open in new tab", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
12861
- import_material19.IconButton,
13498
+ run?.execution_id && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Tooltip, { title: "Open in new tab", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13499
+ import_material21.IconButton,
12862
13500
  {
12863
13501
  component: "a",
12864
13502
  href: `/agents?execution_id=${encodeURIComponent(run.execution_id)}${run.authorization ? `&authorization=${encodeURIComponent(run.authorization)}` : ""}`,
@@ -12869,11 +13507,11 @@ var AgentExecutionDrawer = ({
12869
13507
  color: "hsl(var(--muted-foreground))",
12870
13508
  "&:hover": { color: "hsl(var(--foreground))", bgcolor: "hsl(var(--muted))" }
12871
13509
  },
12872
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react15.ExternalLink, { size: 16 })
13510
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react15.ExternalLink, { size: 16 })
12873
13511
  }
12874
13512
  ) }),
12875
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Tooltip, { title: "Close", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
12876
- import_material19.IconButton,
13513
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Tooltip, { title: "Close", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13514
+ import_material21.IconButton,
12877
13515
  {
12878
13516
  onClick: onClose,
12879
13517
  size: "small",
@@ -12881,15 +13519,15 @@ var AgentExecutionDrawer = ({
12881
13519
  color: "hsl(var(--muted-foreground))",
12882
13520
  "&:hover": { color: "hsl(var(--foreground))", bgcolor: "hsl(var(--muted))" }
12883
13521
  },
12884
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react15.X, { size: 16 })
13522
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react15.X, { size: 16 })
12885
13523
  }
12886
13524
  ) })
12887
13525
  ]
12888
13526
  }
12889
13527
  ),
12890
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material19.Box, { sx: [{ flex: 1, overflowY: "auto", pt: 3 }, ...Array.isArray(bodySx) ? bodySx : bodySx ? [bodySx] : []], children: [
13528
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material21.Box, { sx: [{ flex: 1, overflowY: "auto", pt: 3 }, ...Array.isArray(bodySx) ? bodySx : bodySx ? [bodySx] : []], children: [
12891
13529
  topBanner,
12892
- run ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
13530
+ run ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
12893
13531
  AgentUI_default,
12894
13532
  {
12895
13533
  initialExecution: {
@@ -12926,9 +13564,9 @@ var AgentExecutionDrawer = ({
12926
13564
  var AgentExecutionDrawer_default = AgentExecutionDrawer;
12927
13565
 
12928
13566
  // views/AgentsView.tsx
12929
- var import_react18 = require("react");
12930
- var import_material20 = require("@mui/material");
12931
- var import_jsx_runtime24 = require("react/jsx-runtime");
13567
+ var import_react20 = require("react");
13568
+ var import_material22 = require("@mui/material");
13569
+ var import_jsx_runtime26 = require("react/jsx-runtime");
12932
13570
  var AgentsView = ({
12933
13571
  onSchedule,
12934
13572
  maxWidth = 820,
@@ -12942,45 +13580,59 @@ var AgentsView = ({
12942
13580
  userdata,
12943
13581
  serverside,
12944
13582
  theme,
12945
- colorMode
13583
+ colorMode,
13584
+ apiKey,
13585
+ orgId
12946
13586
  }) => {
12947
13587
  useSyncHostBaseUrl(globalUrl);
12948
- const [selectedRun, setSelectedRun] = (0, import_react18.useState)(null);
12949
- const [agentView, setAgentView] = (0, import_react18.useState)("start");
12950
- const [prefill, setPrefill] = (0, import_react18.useState)({
13588
+ const [selectedRun, setSelectedRun] = (0, import_react20.useState)(null);
13589
+ const [agentView, setAgentView] = (0, import_react20.useState)("start");
13590
+ const [prefill, setPrefill] = (0, import_react20.useState)({
12951
13591
  input: "",
12952
13592
  apps: [],
12953
13593
  key: 0
12954
13594
  });
12955
- const [editing, setEditing] = (0, import_react18.useState)(null);
12956
- const [builtInDrawer, setBuiltInDrawer] = (0, import_react18.useState)({
13595
+ const [editing, setEditing] = (0, import_react20.useState)(null);
13596
+ const [builtInDrawer, setBuiltInDrawer] = (0, import_react20.useState)({
12957
13597
  open: false,
12958
13598
  tab: "localLLM"
12959
13599
  });
12960
- const effectiveLocalLLMSlot = (0, import_react18.useMemo)(
12961
- () => 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: [
12962
- /* @__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" }),
12963
- "This host hasn't wired a Local LLM picker yet. Pass an",
12964
- " ",
12965
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("code", { style: { fontFamily: "monospace" }, children: "onChooseLLM" }),
12966
- " handler or a",
12967
- " ",
12968
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("code", { style: { fontFamily: "monospace" }, children: "localLLMSlot" }),
12969
- " to",
12970
- " ",
12971
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("code", { style: { fontFamily: "monospace" }, children: "<AgentsView />" }),
12972
- " to render your own configuration UI here."
12973
- ] }),
12974
- [localLLMSlot]
13600
+ const effectiveSchedule = (0, import_react20.useCallback)(
13601
+ async (info) => {
13602
+ if (onSchedule) return onSchedule(info);
13603
+ await scheduleAgentRun({ ...info, apiKey, apiBaseUrl: globalUrl, orgId });
13604
+ },
13605
+ [onSchedule, apiKey, globalUrl, orgId]
12975
13606
  );
12976
- const handleChooseLLM = (0, import_react18.useCallback)(() => {
13607
+ const effectiveLocalLLMSlot = (0, import_react20.useMemo)(
13608
+ () => localLLMSlot ?? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
13609
+ LocalLLMConfig_default,
13610
+ {
13611
+ globalUrl,
13612
+ userdata,
13613
+ isLoaded,
13614
+ isLoggedIn,
13615
+ serverside,
13616
+ theme,
13617
+ colorMode
13618
+ }
13619
+ ),
13620
+ [localLLMSlot, globalUrl, userdata, isLoaded, isLoggedIn, serverside, theme, colorMode]
13621
+ );
13622
+ const handleChooseLLM = (0, import_react20.useCallback)(() => {
12977
13623
  if (onChooseLLM) {
12978
13624
  onChooseLLM();
12979
13625
  return;
12980
13626
  }
13627
+ if (typeof window !== "undefined" && window.__shuffleAgentDrawerMounted > 0) {
13628
+ window.dispatchEvent(
13629
+ new CustomEvent("agent-drawer-open", { detail: { tab: "localLLM" } })
13630
+ );
13631
+ return;
13632
+ }
12981
13633
  setBuiltInDrawer({ open: true, tab: "localLLM" });
12982
13634
  }, [onChooseLLM]);
12983
- const handleEditWorkflow = (0, import_react18.useCallback)(
13635
+ const handleEditWorkflow = (0, import_react20.useCallback)(
12984
13636
  ({ workflowId, name, prompt, apps }) => {
12985
13637
  setEditing({ workflowId, name });
12986
13638
  setPrefill((prev) => ({
@@ -12992,7 +13644,7 @@ var AgentsView = ({
12992
13644
  },
12993
13645
  []
12994
13646
  );
12995
- const handleSaveEdit = (0, import_react18.useCallback)(
13647
+ const handleSaveEdit = (0, import_react20.useCallback)(
12996
13648
  async ({ input, apps }) => {
12997
13649
  if (!editing) return;
12998
13650
  try {
@@ -13012,10 +13664,10 @@ var AgentsView = ({
13012
13664
  },
13013
13665
  [editing]
13014
13666
  );
13015
- 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: [
13016
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.Stack, { spacing: 6, sx: { maxWidth, mx: "auto", width: "100%" }, children: [
13017
- editing && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
13018
- import_material20.Box,
13667
+ 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: [
13668
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_material22.Stack, { spacing: 6, sx: { maxWidth, mx: "auto", width: "100%" }, children: [
13669
+ editing && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
13670
+ import_material22.Box,
13019
13671
  {
13020
13672
  sx: {
13021
13673
  display: "flex",
@@ -13028,12 +13680,12 @@ var AgentsView = ({
13028
13680
  bgcolor: "hsl(var(--primary) / 0.08)"
13029
13681
  },
13030
13682
  children: [
13031
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.Typography, { sx: { fontSize: "0.85rem", color: "hsl(var(--foreground))" }, children: [
13683
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_material22.Typography, { sx: { fontSize: "0.85rem", color: "hsl(var(--foreground))" }, children: [
13032
13684
  "Editing schedule: ",
13033
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("strong", { children: editing.name })
13685
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("strong", { children: editing.name })
13034
13686
  ] }),
13035
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13036
- import_material20.Typography,
13687
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
13688
+ import_material22.Typography,
13037
13689
  {
13038
13690
  component: "button",
13039
13691
  onClick: () => {
@@ -13053,13 +13705,15 @@ var AgentsView = ({
13053
13705
  ]
13054
13706
  }
13055
13707
  ),
13056
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13708
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
13057
13709
  AgentUI_default,
13058
13710
  {
13059
13711
  maxWidth,
13060
13712
  apiBaseUrl: globalUrl,
13061
13713
  onViewChange: setAgentView,
13062
- onSchedule,
13714
+ onSchedule: effectiveSchedule,
13715
+ apiKey,
13716
+ orgId,
13063
13717
  onChooseLLM: handleChooseLLM,
13064
13718
  hideChooseLLM,
13065
13719
  defaultInput: prefill.input,
@@ -13074,28 +13728,32 @@ var AgentsView = ({
13074
13728
  },
13075
13729
  prefill.key
13076
13730
  ),
13077
- agentView === "start" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Box, { sx: { pt: { xs: 4, md: "8vh" } }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13731
+ agentView === "start" && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material22.Box, { sx: { pt: { xs: 4, md: "8vh" } }, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
13078
13732
  AgentActivityList_default,
13079
13733
  {
13080
13734
  apiBaseUrl: globalUrl,
13735
+ apiKey,
13736
+ orgId,
13081
13737
  onRunClick: setSelectedRun,
13082
13738
  onEditWorkflow: handleEditWorkflow
13083
13739
  }
13084
13740
  ) })
13085
13741
  ] }),
13086
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13742
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
13087
13743
  AgentExecutionDrawer_default,
13088
13744
  {
13089
13745
  open: selectedRun !== null,
13090
13746
  onClose: () => setSelectedRun(null),
13091
13747
  run: selectedRun,
13092
13748
  apiBaseUrl: globalUrl,
13093
- onSchedule,
13749
+ onSchedule: effectiveSchedule,
13750
+ apiKey,
13751
+ orgId,
13094
13752
  theme,
13095
13753
  colorMode
13096
13754
  }
13097
13755
  ),
13098
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13756
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
13099
13757
  AgentRunDrawer_default,
13100
13758
  {
13101
13759
  open: builtInDrawer.open,
@@ -13106,7 +13764,7 @@ var AgentsView = ({
13106
13764
  permissionsSlot,
13107
13765
  theme,
13108
13766
  colorMode,
13109
- agentUIProps: { onSchedule, apiBaseUrl: globalUrl, theme, colorMode }
13767
+ agentUIProps: { onSchedule: effectiveSchedule, apiBaseUrl: globalUrl, apiKey, orgId, theme, colorMode }
13110
13768
  }
13111
13769
  )
13112
13770
  ] });
@@ -13114,14 +13772,14 @@ var AgentsView = ({
13114
13772
  var AgentsView_default = AgentsView;
13115
13773
 
13116
13774
  // useAppLookup.ts
13117
- var import_react19 = require("react");
13775
+ var import_react21 = require("react");
13118
13776
  init_api();
13119
13777
  init_appsCache();
13120
13778
  var norm3 = (s) => s.toLowerCase().replace(/[\s_\-]+/g, "_");
13121
13779
  function useAppLookup(appName) {
13122
- const [loading, setLoading] = (0, import_react19.useState)(false);
13123
- const [info, setInfo] = (0, import_react19.useState)(null);
13124
- const [algoliaId, setAlgoliaId] = (0, import_react19.useState)(null);
13780
+ const [loading, setLoading] = (0, import_react21.useState)(false);
13781
+ const [info, setInfo] = (0, import_react21.useState)(null);
13782
+ const [algoliaId, setAlgoliaId] = (0, import_react21.useState)(null);
13125
13783
  const {
13126
13784
  authStates,
13127
13785
  authenticatedApps,
@@ -13130,7 +13788,7 @@ function useAppLookup(appName) {
13130
13788
  handleSaveAuth,
13131
13789
  refreshAuth
13132
13790
  } = useAppAuth();
13133
- (0, import_react19.useEffect)(() => {
13791
+ (0, import_react21.useEffect)(() => {
13134
13792
  if (!appName) {
13135
13793
  setInfo(null);
13136
13794
  setAlgoliaId(null);
@@ -13209,13 +13867,13 @@ function useAppLookup(appName) {
13209
13867
  setLoading(false);
13210
13868
  })();
13211
13869
  }, [appName]);
13212
- const matchingEntries = (0, import_react19.useMemo)(() => {
13870
+ const matchingEntries = (0, import_react21.useMemo)(() => {
13213
13871
  if (!appName) return [];
13214
13872
  return authenticatedApps.filter(
13215
13873
  (auth) => auth.app?.name && norm3(auth.app.name) === norm3(appName)
13216
13874
  );
13217
13875
  }, [appName, authenticatedApps]);
13218
- const image = (0, import_react19.useMemo)(() => {
13876
+ const image = (0, import_react21.useMemo)(() => {
13219
13877
  if (info?.image) return info.image;
13220
13878
  for (const entry of matchingEntries) {
13221
13879
  const img = entry.app?.large_image || entry.large_image;
@@ -13223,7 +13881,7 @@ function useAppLookup(appName) {
13223
13881
  }
13224
13882
  return "";
13225
13883
  }, [info, matchingEntries]);
13226
- const algoliaApp = (0, import_react19.useMemo)(() => {
13884
+ const algoliaApp = (0, import_react21.useMemo)(() => {
13227
13885
  if (!appName) return null;
13228
13886
  return {
13229
13887
  objectID: algoliaId || appName,
@@ -13258,108 +13916,27 @@ function useAppLookup(appName) {
13258
13916
  init_api();
13259
13917
  init_fetchBreaker();
13260
13918
  init_appsCache();
13261
-
13262
- // components/UsageBar.tsx
13263
- var import_material21 = require("@mui/material");
13264
- var import_jsx_runtime25 = require("react/jsx-runtime");
13265
- var fmt = (n) => n.toLocaleString();
13266
- var UsageBar = ({
13267
- label,
13268
- usage,
13269
- limit,
13270
- unit,
13271
- hint,
13272
- actionLabel,
13273
- actionHref
13274
- }) => {
13275
- const safeLimit = Math.max(limit, 0);
13276
- const pct = safeLimit > 0 ? usage / safeLimit * 100 : 0;
13277
- const isOver = pct >= 100;
13278
- const isWarn = pct >= 65 && !isOver;
13279
- const accent = isOver ? "hsl(var(--destructive))" : isWarn ? "hsl(var(--severity-medium))" : "hsl(var(--muted-foreground))";
13280
- const tooltipText = safeLimit > 0 ? `${pct.toFixed(0)}% used \xB7 ${fmt(usage)} / ${fmt(safeLimit)}${unit ? " " + unit : ""}${hint ? " \xB7 " + hint : ""}` : `${fmt(usage)}${unit ? " " + unit : ""}${hint ? " \xB7 " + hint : ""}`;
13281
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Tooltip, { title: tooltipText, placement: "top", arrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material21.Box, { sx: { display: "flex", flexDirection: "column", gap: 0.5, py: 0.25 }, children: [
13282
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material21.Box, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 1 }, children: [
13283
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13284
- import_material21.Typography,
13285
- {
13286
- sx: {
13287
- fontSize: "12.8px",
13288
- fontWeight: 500,
13289
- color: "hsl(var(--muted-foreground))",
13290
- lineHeight: 1.2
13291
- },
13292
- children: label
13293
- }
13294
- ),
13295
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material21.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
13296
- actionLabel && actionHref && (isWarn || isOver) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13297
- import_material21.Box,
13298
- {
13299
- component: "a",
13300
- href: actionHref,
13301
- target: "_blank",
13302
- rel: "noopener noreferrer",
13303
- sx: {
13304
- fontSize: "12.8px",
13305
- fontWeight: 600,
13306
- color: accent,
13307
- textDecoration: "none",
13308
- "&:hover": { textDecoration: "underline" }
13309
- },
13310
- children: actionLabel
13311
- }
13312
- ),
13313
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13314
- import_material21.Typography,
13315
- {
13316
- sx: {
13317
- fontSize: "12.8px",
13318
- fontWeight: 500,
13319
- color: accent,
13320
- whiteSpace: "nowrap",
13321
- fontVariantNumeric: "tabular-nums"
13322
- },
13323
- children: safeLimit > 0 ? `${fmt(usage)} / ${fmt(safeLimit)}${unit ? " " + unit : ""}` : `${fmt(usage)}${unit ? " " + unit : ""}`
13324
- }
13325
- )
13326
- ] })
13327
- ] }),
13328
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Box, { sx: { width: "100%", height: 2, bgcolor: "hsl(var(--muted) / 0.5)", borderRadius: 1, overflow: "hidden" }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13329
- import_material21.Box,
13330
- {
13331
- sx: {
13332
- width: `${Math.min(Math.max(pct, 0), 100)}%`,
13333
- height: "100%",
13334
- bgcolor: isOver ? "hsl(var(--destructive))" : isWarn ? "hsl(var(--severity-medium))" : "hsl(var(--severity-low, 142 71% 45%))",
13335
- transition: "width 0.3s ease"
13336
- }
13337
- }
13338
- ) })
13339
- ] }) });
13340
- };
13341
-
13342
- // index.ts
13343
13919
  var resolveMode = (theme, colorMode) => {
13344
13920
  if (theme === "light" || theme === "dark") return theme;
13345
13921
  if (theme === "system") return "auto";
13346
- return colorMode ?? "auto";
13922
+ if (colorMode) return colorMode;
13923
+ return "dark";
13347
13924
  };
13348
13925
  var withMcpTheme = (Inner, displayName) => {
13349
- const Wrapped = ({ theme, colorMode, ...rest }) => import_react20.default.createElement(
13926
+ const Wrapped = ({ theme, colorMode, ...rest }) => import_react22.default.createElement(
13350
13927
  ShuffleMcpThemeProvider,
13351
13928
  { mode: resolveMode(theme, colorMode) },
13352
- import_react20.default.createElement(Inner, { ...rest, theme, colorMode })
13929
+ import_react22.default.createElement(Inner, { ...rest, theme, colorMode })
13353
13930
  );
13354
13931
  Wrapped.displayName = `ShuffleMCPs(${displayName})`;
13355
13932
  return Wrapped;
13356
13933
  };
13357
13934
  var withMcpThemeRef = (Inner, displayName) => {
13358
- const Wrapped = import_react20.default.forwardRef(
13359
- ({ theme, colorMode, ...rest }, ref) => import_react20.default.createElement(
13935
+ const Wrapped = import_react22.default.forwardRef(
13936
+ ({ theme, colorMode, ...rest }, ref) => import_react22.default.createElement(
13360
13937
  ShuffleMcpThemeProvider,
13361
13938
  { mode: resolveMode(theme, colorMode) },
13362
- import_react20.default.createElement(Inner, { ...rest, theme, colorMode, ref })
13939
+ import_react22.default.createElement(Inner, { ...rest, theme, colorMode, ref })
13363
13940
  )
13364
13941
  );
13365
13942
  Wrapped.displayName = `ShuffleMCPs(${displayName})`;
@@ -13381,6 +13958,7 @@ var AgentActivityList2 = withMcpTheme(AgentActivityList_default, "AgentActivityL
13381
13958
  var AgentExecutionDrawer2 = withMcpTheme(AgentExecutionDrawer_default, "AgentExecutionDrawer");
13382
13959
  var AgentsView2 = withMcpTheme(AgentsView_default, "AgentsView");
13383
13960
  var AgentRunDiagnosisBanner2 = withMcpTheme(AgentRunDiagnosisBanner_default, "AgentRunDiagnosisBanner");
13961
+ var LocalLLMConfig2 = withMcpTheme(LocalLLMConfig_default, "LocalLLMConfig");
13384
13962
  // Annotate the CommonJS export names for ESM import in node:
13385
13963
  0 && (module.exports = {
13386
13964
  API_CONFIG,
@@ -13407,6 +13985,7 @@ var AgentRunDiagnosisBanner2 = withMcpTheme(AgentRunDiagnosisBanner_default, "Ag
13407
13985
  FORWARD_TICKETS_WORKFLOW_NAME,
13408
13986
  INGEST_TICKETS_WORKFLOW_NAME,
13409
13987
  IntegrationStatus,
13988
+ LocalLLMConfig,
13410
13989
  SIEM_PATTERNS,
13411
13990
  ShuffleMCP,
13412
13991
  ShuffleMcpThemeProvider,
@@ -13452,6 +14031,7 @@ var AgentRunDiagnosisBanner2 = withMcpTheme(AgentRunDiagnosisBanner_default, "Ag
13452
14031
  resetRegionUrl,
13453
14032
  resolveApp,
13454
14033
  resolveApps,
14034
+ scheduleAgentRun,
13455
14035
  searchAgentActivity,
13456
14036
  seedResolvedApp,
13457
14037
  setDatastoreItem,