@shuffleio/shuffle-mcps 0.0.67 → 0.0.68

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.mjs CHANGED
@@ -25,9 +25,6 @@ import {
25
25
  shuffleFetch
26
26
  } from "./chunk-V3R4HDJT.mjs";
27
27
 
28
- // index.ts
29
- import "./shuffle-mcp-LXISGW4I.css";
30
-
31
28
  // ../lib/crypto-polyfill.ts
32
29
  var getGlobalCrypto = () => {
33
30
  if (typeof globalThis !== "undefined" && globalThis.crypto) {
@@ -358,8 +355,213 @@ import { QueryClient, QueryClientProvider, useQueryClient } from "@tanstack/reac
358
355
  // ShuffleMcpThemeProvider.tsx
359
356
  import React from "react";
360
357
  import { ThemeProvider, createTheme, useTheme as useMuiTheme } from "@mui/material";
361
- import "./shuffle-mcp-LXISGW4I.css";
358
+ import "./shuffle-mcp-ML4YQTUP.css";
362
359
  import { jsx, jsxs } from "react/jsx-runtime";
360
+ var lightTokenStyle = {
361
+ "--background": "0 0% 98%",
362
+ "--background-elevated": "0 0% 100%",
363
+ "--background-surface": "0 0% 96%",
364
+ "--foreground": "0 0% 9%",
365
+ "--foreground-muted": "0 0% 40%",
366
+ "--card": "0 0% 100%",
367
+ "--card-foreground": "0 0% 9%",
368
+ "--popover": "0 0% 100%",
369
+ "--popover-foreground": "0 0% 9%",
370
+ "--primary": "22 100% 50%",
371
+ "--primary-foreground": "0 0% 100%",
372
+ "--secondary": "0 0% 94%",
373
+ "--secondary-foreground": "0 0% 9%",
374
+ "--muted": "0 0% 94%",
375
+ "--muted-foreground": "0 0% 45%",
376
+ "--accent": "0 0% 92%",
377
+ "--accent-foreground": "0 0% 9%",
378
+ "--destructive": "0 84% 60%",
379
+ "--destructive-foreground": "0 0% 100%",
380
+ "--border": "0 0% 80%",
381
+ "--border-subtle": "0 0% 86%",
382
+ "--input": "0 0% 94%",
383
+ "--ring": "22 100% 50%",
384
+ "--severity-critical": "0 84% 60%",
385
+ "--severity-high": "12 92% 52%",
386
+ "--severity-medium": "45 93% 47%",
387
+ "--severity-low": "142 71% 45%",
388
+ "--severity-info": "210 100% 56%",
389
+ "--sidebar-background": "0 0% 97%",
390
+ "--sidebar-foreground": "0 0% 9%",
391
+ "--sidebar-accent": "0 0% 94%",
392
+ "--sidebar-accent-foreground": "0 0% 9%",
393
+ "--sidebar-border": "0 0% 80%",
394
+ "--gradient-card": "linear-gradient(145deg, hsl(0 0% 100%) 0%, hsl(0 0% 98%) 100%)"
395
+ };
396
+ var darkTokenStyle = {
397
+ ...lightTokenStyle,
398
+ "--background": "0 0% 10%",
399
+ "--background-elevated": "0 0% 13%",
400
+ "--background-surface": "0 0% 16%",
401
+ "--foreground": "0 0% 100%",
402
+ "--foreground-muted": "0 0% 60%",
403
+ "--card": "0 0% 13%",
404
+ "--card-foreground": "0 0% 100%",
405
+ "--popover": "0 0% 12%",
406
+ "--popover-foreground": "0 0% 100%",
407
+ "--secondary": "0 0% 18%",
408
+ "--secondary-foreground": "0 0% 100%",
409
+ "--muted": "0 0% 16%",
410
+ "--muted-foreground": "0 0% 50%",
411
+ "--accent": "0 0% 20%",
412
+ "--accent-foreground": "0 0% 100%",
413
+ "--destructive": "0 84% 60%",
414
+ "--destructive-foreground": "0 0% 100%",
415
+ "--border": "0 0% 20%",
416
+ "--border-subtle": "0 0% 16%",
417
+ "--input": "0 0% 18%",
418
+ "--sidebar-background": "0 0% 9%",
419
+ "--sidebar-foreground": "0 0% 100%",
420
+ "--sidebar-accent": "0 0% 16%",
421
+ "--sidebar-accent-foreground": "0 0% 100%",
422
+ "--sidebar-border": "0 0% 16%",
423
+ "--gradient-card": "linear-gradient(145deg, hsl(0 0% 14%) 0%, hsl(0 0% 12%) 100%)"
424
+ };
425
+ var SHUFFLE_MCP_BASE_CSS = `
426
+ :where(:root) {
427
+ --background: 0 0% 10%;
428
+ --background-elevated: 0 0% 13%;
429
+ --background-surface: 0 0% 16%;
430
+ --foreground: 0 0% 98%;
431
+ --card: 0 0% 13%;
432
+ --card-foreground: 0 0% 100%;
433
+ --popover: 0 0% 13%;
434
+ --popover-foreground: 0 0% 100%;
435
+ --primary: 22 100% 50%;
436
+ --primary-foreground: 0 0% 100%;
437
+ --secondary: 0 0% 16%;
438
+ --secondary-foreground: 0 0% 100%;
439
+ --muted: 0 0% 16%;
440
+ --muted-foreground: 0 0% 65%;
441
+ --accent: 22 100% 50%;
442
+ --accent-foreground: 0 0% 100%;
443
+ --destructive: 0 84% 60%;
444
+ --destructive-foreground: 0 0% 100%;
445
+ --border: 0 0% 20%;
446
+ --input: 0 0% 16%;
447
+ --ring: 22 100% 50%;
448
+ --severity-info: 210 90% 60%;
449
+ --severity-low: 142 70% 45%;
450
+ --severity-medium: 38 92% 50%;
451
+ --severity-high: 12 92% 52%;
452
+ --severity-critical: 0 84% 60%;
453
+ --infra-email: 210 90% 60%;
454
+ }
455
+
456
+ .shuffle-mcp-scope,
457
+ .shuffle-mcp-scope *,
458
+ .shuffle-mcp-scope *::before,
459
+ .shuffle-mcp-scope *::after {
460
+ box-sizing: border-box;
461
+ }
462
+
463
+ .shuffle-mcp-scope {
464
+ color: hsl(var(--foreground));
465
+ font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
466
+ line-height: 1.5;
467
+ isolation: isolate;
468
+ }
469
+
470
+ :root:not(.dark) .shuffle-mcp-scope:not(.dark),
471
+ html:not(.dark) .shuffle-mcp-scope:not(.dark),
472
+ body:not(.dark) .shuffle-mcp-scope:not(.dark),
473
+ .shuffle-mcp-scope.light,
474
+ [data-shuffle-mode="light"] .shuffle-mcp-scope,
475
+ [data-shuffle-mode="light"] {
476
+ --background: 0 0% 98%;
477
+ --background-elevated: 0 0% 100%;
478
+ --background-surface: 0 0% 96%;
479
+ --foreground: 0 0% 9%;
480
+ --card: 0 0% 100%;
481
+ --card-foreground: 0 0% 9%;
482
+ --popover: 0 0% 100%;
483
+ --popover-foreground: 0 0% 9%;
484
+ --secondary: 0 0% 94%;
485
+ --secondary-foreground: 0 0% 9%;
486
+ --muted: 0 0% 94%;
487
+ --muted-foreground: 0 0% 40%;
488
+ --accent: 0 0% 92%;
489
+ --accent-foreground: 0 0% 9%;
490
+ --destructive: 0 72% 51%;
491
+ --destructive-foreground: 0 0% 100%;
492
+ --border: 0 0% 78%;
493
+ --input: 0 0% 94%;
494
+ --severity-info: 215 90% 45%;
495
+ --severity-low: 142 72% 31%;
496
+ --severity-medium: 38 92% 33%;
497
+ --severity-high: 12 88% 46%;
498
+ --severity-critical: 0 72% 51%;
499
+ --infra-email: 215 90% 45%;
500
+ }
501
+
502
+ .dark .shuffle-mcp-scope:not(.light),
503
+ .shuffle-mcp-scope.dark,
504
+ [data-shuffle-mode="dark"] .shuffle-mcp-scope,
505
+ [data-shuffle-mode="dark"] {
506
+ --background: 0 0% 10%;
507
+ --background-elevated: 0 0% 13%;
508
+ --background-surface: 0 0% 16%;
509
+ --foreground: 0 0% 100%;
510
+ --card: 0 0% 13%;
511
+ --card-foreground: 0 0% 100%;
512
+ --popover: 0 0% 12%;
513
+ --popover-foreground: 0 0% 100%;
514
+ --secondary: 0 0% 18%;
515
+ --secondary-foreground: 0 0% 100%;
516
+ --muted: 0 0% 16%;
517
+ --muted-foreground: 0 0% 50%;
518
+ --accent: 0 0% 20%;
519
+ --accent-foreground: 0 0% 100%;
520
+ --destructive: 0 84% 60%;
521
+ --destructive-foreground: 0 0% 100%;
522
+ --border: 0 0% 20%;
523
+ --input: 0 0% 18%;
524
+ }
525
+
526
+ .MuiTooltip-tooltip.shuffle-mcp-scope {
527
+ background-color: hsl(var(--popover)) !important;
528
+ color: hsl(var(--popover-foreground)) !important;
529
+ border: 1px solid hsl(var(--border)) !important;
530
+ box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12) !important;
531
+ border-radius: 8px !important;
532
+ }
533
+
534
+ .MuiTooltip-tooltip.shuffle-mcp-scope .MuiTooltip-arrow {
535
+ color: hsl(var(--popover)) !important;
536
+ }
537
+
538
+ .MuiTooltip-tooltip.shuffle-mcp-scope .MuiTooltip-arrow::before {
539
+ border: 1px solid hsl(var(--border)) !important;
540
+ box-sizing: border-box;
541
+ }
542
+
543
+ @keyframes singul-spin {
544
+ 0% { transform: rotate(0deg); }
545
+ 100% { transform: rotate(360deg); }
546
+ }
547
+
548
+ @keyframes singul-skeleton-pulse {
549
+ 0%, 100% { opacity: 0.4; }
550
+ 50% { opacity: 0.8; }
551
+ }
552
+ `;
553
+ var ensureShuffleMcpStyles = () => {
554
+ if (typeof document === "undefined") return;
555
+ const STYLE_ID = "shuffle-mcp-injected-styles";
556
+ if (document.getElementById(STYLE_ID)) return;
557
+ const style = document.createElement("style");
558
+ style.id = STYLE_ID;
559
+ style.textContent = SHUFFLE_MCP_BASE_CSS;
560
+ document.head.appendChild(style);
561
+ };
562
+ if (typeof document !== "undefined") {
563
+ ensureShuffleMcpStyles();
564
+ }
363
565
  var readHtmlDarkClass = () => {
364
566
  if (typeof document === "undefined") return false;
365
567
  return document.documentElement.classList.contains("dark") || Boolean(document.body) && document.body.classList.contains("dark");
@@ -405,19 +607,20 @@ var useAutoDarkClass = (enabled, anchorRef) => {
405
607
  };
406
608
  var ShuffleMcpThemeContext = React.createContext(null);
407
609
  var useShuffleMcpTheme = () => React.useContext(ShuffleMcpThemeContext);
408
- var buildComponentOverrides = (scopeClassName) => ({
610
+ var buildComponentOverrides = (scopeClassName, scopeStyle) => ({
409
611
  MuiButton: { defaultProps: { size: "small" } },
410
612
  MuiAutocomplete: {
411
613
  defaultProps: {
412
614
  slotProps: {
413
- popper: { className: scopeClassName, sx: { zIndex: 10040 } },
414
- paper: { className: scopeClassName }
615
+ popper: { className: scopeClassName, style: scopeStyle, sx: { zIndex: 10040 } },
616
+ paper: { className: scopeClassName, style: scopeStyle }
415
617
  }
416
618
  }
417
619
  },
418
620
  MuiPopper: {
419
621
  defaultProps: {
420
- className: scopeClassName
622
+ className: scopeClassName,
623
+ style: scopeStyle
421
624
  },
422
625
  styleOverrides: {
423
626
  root: { zIndex: 10040 }
@@ -457,9 +660,9 @@ var buildComponentOverrides = (scopeClassName) => ({
457
660
  }
458
661
  }
459
662
  },
460
- // ---- Portaled surfaces: stamp scopeClassName so HSL tokens resolve ----
663
+ // ---- Portaled surfaces: stamp scopeClassName and scopeStyle so HSL tokens resolve ----
461
664
  MuiDrawer: {
462
- defaultProps: { slotProps: { paper: { className: scopeClassName } } },
665
+ defaultProps: { slotProps: { paper: { className: scopeClassName, style: scopeStyle } } },
463
666
  styleOverrides: {
464
667
  paper: {
465
668
  backgroundColor: "hsl(var(--sidebar-background, var(--card)))",
@@ -469,7 +672,7 @@ var buildComponentOverrides = (scopeClassName) => ({
469
672
  }
470
673
  },
471
674
  MuiDialog: {
472
- defaultProps: { slotProps: { paper: { className: scopeClassName } } },
675
+ defaultProps: { slotProps: { paper: { className: scopeClassName, style: scopeStyle } } },
473
676
  styleOverrides: {
474
677
  root: { zIndex: 10010 },
475
678
  paper: {
@@ -481,7 +684,7 @@ var buildComponentOverrides = (scopeClassName) => ({
481
684
  }
482
685
  },
483
686
  MuiMenu: {
484
- defaultProps: { slotProps: { paper: { className: scopeClassName } } },
687
+ defaultProps: { slotProps: { paper: { className: scopeClassName, style: scopeStyle } } },
485
688
  styleOverrides: {
486
689
  root: { zIndex: 10040 },
487
690
  paper: {
@@ -493,7 +696,7 @@ var buildComponentOverrides = (scopeClassName) => ({
493
696
  }
494
697
  },
495
698
  MuiPopover: {
496
- defaultProps: { slotProps: { paper: { className: scopeClassName } } },
699
+ defaultProps: { slotProps: { paper: { className: scopeClassName, style: scopeStyle } } },
497
700
  styleOverrides: {
498
701
  root: { zIndex: 10040 },
499
702
  paper: {
@@ -507,7 +710,7 @@ var buildComponentOverrides = (scopeClassName) => ({
507
710
  MuiTooltip: {
508
711
  defaultProps: {
509
712
  slotProps: {
510
- tooltip: { className: scopeClassName },
713
+ tooltip: { className: scopeClassName, style: scopeStyle },
511
714
  // Render above app drawers, dialogs, menus, and popovers.
512
715
  popper: { sx: { zIndex: 10050 } }
513
716
  }
@@ -546,6 +749,7 @@ var ShuffleMcpThemeProvider = ({
546
749
  const sameAsParent = parentCtx !== null && parentCtx.isDark === effectiveDark;
547
750
  const scopeClassName = effectiveDark ? "shuffle-mcp-scope dark" : "shuffle-mcp-scope light";
548
751
  const resolvedModeAttr = effectiveDark ? "dark" : "light";
752
+ const scopeStyle = effectiveDark ? darkTokenStyle : lightTokenStyle;
549
753
  const merged = React.useMemo(
550
754
  () => createTheme({
551
755
  ...parent,
@@ -555,22 +759,25 @@ var ShuffleMcpThemeProvider = ({
555
759
  },
556
760
  components: {
557
761
  ...parent.components,
558
- ...buildComponentOverrides(scopeClassName)
762
+ ...buildComponentOverrides(scopeClassName, scopeStyle)
559
763
  }
560
764
  }),
561
- [parent, effectiveDark, scopeClassName]
765
+ [parent, effectiveDark, scopeClassName, scopeStyle]
562
766
  );
563
767
  const ctxValue = React.useMemo(
564
768
  () => ({ mode, isDark: effectiveDark, scopeClassName }),
565
769
  [mode, effectiveDark, scopeClassName]
566
770
  );
771
+ React.useEffect(() => {
772
+ ensureShuffleMcpStyles();
773
+ }, []);
567
774
  if (sameAsParent) {
568
775
  return /* @__PURE__ */ jsxs(ShuffleMcpThemeContext.Provider, { value: ctxValue, children: [
569
776
  /* @__PURE__ */ jsx("span", { ref: anchorRef, style: { display: "none" }, "aria-hidden": true }),
570
777
  children2
571
778
  ] });
572
779
  }
573
- return /* @__PURE__ */ jsx(ShuffleMcpThemeContext.Provider, { value: ctxValue, children: /* @__PURE__ */ jsx(ThemeProvider, { theme: merged, children: /* @__PURE__ */ jsxs("div", { className: scopeClassName, "data-shuffle-mode": resolvedModeAttr, "data-shuffle-mcp-root": true, children: [
780
+ return /* @__PURE__ */ jsx(ShuffleMcpThemeContext.Provider, { value: ctxValue, children: /* @__PURE__ */ jsx(ThemeProvider, { theme: merged, children: /* @__PURE__ */ jsxs("div", { className: scopeClassName, style: scopeStyle, "data-shuffle-mode": resolvedModeAttr, "data-shuffle-mcp-root": true, children: [
574
781
  /* @__PURE__ */ jsx("span", { ref: anchorRef, style: { display: "none" }, "aria-hidden": true }),
575
782
  children2
576
783
  ] }) }) });
@@ -1029,11 +1236,23 @@ var setDatastoreItems = async (items, category) => {
1029
1236
  `[datastore.setMany] category=${category} unchanged keys: ${okParsed.keysExisted.filter((k) => !k.changed).map((k) => k.key).join(", ")}`
1030
1237
  );
1031
1238
  }
1239
+ if (okParsed.success === false) {
1240
+ const fallbackResults = await Promise.all(items.map(
1241
+ (item) => setDatastoreItem(item.key, item.value, category)
1242
+ ));
1243
+ const failedWrites = fallbackResults.filter((result) => !result.success);
1244
+ if (failedWrites.length > 0) {
1245
+ return {
1246
+ success: false,
1247
+ error: failedWrites[0]?.error || "Backend reported success=false for bulk datastore write"
1248
+ };
1249
+ }
1250
+ return { success: true };
1251
+ }
1032
1252
  return {
1033
- success: okParsed.success !== false,
1253
+ success: true,
1034
1254
  keysExisted: okParsed.keysExisted,
1035
- changed: okParsed.keysExisted ? okParsed.keysExisted.some((k) => k.changed) : void 0,
1036
- ...okParsed.success === false ? { error: "Backend reported success=false for bulk datastore write" } : {}
1255
+ changed: okParsed.keysExisted ? okParsed.keysExisted.some((k) => k.changed) : void 0
1037
1256
  };
1038
1257
  };
1039
1258
  var getDatastoreItem = async (key, category, overrideOrgId, options) => {
@@ -3633,7 +3852,14 @@ var getOverlayStack = () => {
3633
3852
  if (!Array.isArray(store[STACK_KEY])) {
3634
3853
  store[STACK_KEY] = [];
3635
3854
  }
3636
- return store[STACK_KEY];
3855
+ const stack = store[STACK_KEY];
3856
+ for (let i = stack.length - 1; i >= 0; i--) {
3857
+ const el = stack[i].element;
3858
+ if (el && !el.isConnected) {
3859
+ stack.splice(i, 1);
3860
+ }
3861
+ }
3862
+ return stack;
3637
3863
  };
3638
3864
  var getTopSurfaceZIndex = (base2 = OVERLAY_BASE) => {
3639
3865
  const stack = getOverlayStack();
@@ -3717,7 +3943,23 @@ var isChildPopupElement = (el) => {
3717
3943
  if (!(el instanceof HTMLElement)) return false;
3718
3944
  return el.classList.contains("MuiPopover-root") || el.classList.contains("MuiMenu-root") || el.classList.contains("MuiAutocomplete-popper") || Boolean(el.closest("[data-radix-popper-content-wrapper]")) || el.classList.contains("MuiPopper-root") && !el.classList.contains("MuiTooltip-popper");
3719
3945
  };
3720
- var isShuffleOwnedOverlay = (el) => el.classList.contains("shuffle-core-scope") || el.classList.contains("shuffle-mcp-scope") || el.querySelector(".shuffle-core-scope, .shuffle-mcp-scope") !== null || el.closest("[data-radix-portal]") !== null || el.hasAttribute("data-shuffle-layer") || el.querySelector("[data-shuffle-layer]") !== null || getOverlayStack().some((r) => r.type === "surface") && isChildPopupElement(el);
3946
+ var SHUFFLE_SCOPE_SELECTOR = ".shuffle-core-scope, .shuffle-mcp-scope, [data-shuffle-layer]";
3947
+ var OWN_PANEL_SELECTOR = [
3948
+ ":scope > .MuiPaper-root",
3949
+ ":scope > .MuiDialog-container > .MuiPaper-root",
3950
+ ':scope > [role="dialog"]',
3951
+ ':scope > [role="alertdialog"]',
3952
+ ':scope > [role="tooltip"]',
3953
+ ":scope > .MuiTooltip-tooltip"
3954
+ ].join(", ");
3955
+ var hasShuffleScopedPanel = (el) => {
3956
+ const panels = el.querySelectorAll(OWN_PANEL_SELECTOR);
3957
+ for (let i = 0; i < panels.length; i++) {
3958
+ if (panels[i].matches(SHUFFLE_SCOPE_SELECTOR)) return true;
3959
+ }
3960
+ return false;
3961
+ };
3962
+ var isShuffleOwnedOverlay = (el) => el.matches(SHUFFLE_SCOPE_SELECTOR) || hasShuffleScopedPanel(el) || el.closest("[data-radix-portal]") !== null || getOverlayStack().some((r) => r.type === "surface") && isChildPopupElement(el);
3721
3963
  var isTooltipElement = (el) => {
3722
3964
  if (!(el instanceof HTMLElement)) return false;
3723
3965
  return el.classList.contains("MuiTooltip-popper") || el.getAttribute("role") === "tooltip";
@@ -3737,7 +3979,10 @@ var installGlobalOverlayAutoLayer = () => {
3737
3979
  if (store[AUTO_LAYER_KEY]) return;
3738
3980
  store[AUTO_LAYER_KEY] = true;
3739
3981
  const handleElementOpen = (el) => {
3740
- if (!isShuffleOwnedOverlay(el)) return;
3982
+ if (!isShuffleOwnedOverlay(el)) {
3983
+ if (el.dataset.shuffleLayerZ) handleElementClose(el);
3984
+ return;
3985
+ }
3741
3986
  if (isSurfaceElement(el)) {
3742
3987
  let layerId = el.dataset.shuffleLayerId;
3743
3988
  if (!layerId) {
@@ -3781,10 +4026,13 @@ var installGlobalOverlayAutoLayer = () => {
3781
4026
  if (layerId) {
3782
4027
  releaseOverlayLayer(layerId);
3783
4028
  delete el.dataset.shuffleLayerId;
3784
- delete el.dataset.shuffleLayerZ;
3785
4029
  } else {
3786
4030
  releaseOverlayLayer(el);
3787
4031
  }
4032
+ if (el.dataset.shuffleLayerZ) {
4033
+ if (el.style.zIndex === el.dataset.shuffleLayerZ) el.style.removeProperty("z-index");
4034
+ delete el.dataset.shuffleLayerZ;
4035
+ }
3788
4036
  };
3789
4037
  const scanNode = (node) => {
3790
4038
  if (!(node instanceof HTMLElement)) return;
@@ -7075,9 +7323,189 @@ import {
7075
7323
  // ../Shuffle-Core/components/ShuffleCoreThemeProvider.tsx
7076
7324
  import React3 from "react";
7077
7325
  import { ThemeProvider as ThemeProvider2, createTheme as createTheme2, useTheme as useMuiTheme2 } from "@mui/material";
7078
- import "./shuffle-core-LIQTRTFD.css";
7079
7326
  import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
7080
- var lightTokenStyle = {
7327
+ var SHUFFLE_CORE_BASE_CSS = `
7328
+ :where(:root) {
7329
+ --background: 0 0% 10%;
7330
+ --background-elevated: 0 0% 13%;
7331
+ --background-surface: 0 0% 16%;
7332
+ --foreground: 0 0% 98%;
7333
+ --foreground-muted: 0 0% 60%;
7334
+ --card: 0 0% 13%;
7335
+ --card-foreground: 0 0% 100%;
7336
+ --popover: 0 0% 13%;
7337
+ --popover-foreground: 0 0% 100%;
7338
+ --primary: 22 100% 50%;
7339
+ --primary-foreground: 0 0% 100%;
7340
+ --secondary: 0 0% 16%;
7341
+ --secondary-foreground: 0 0% 100%;
7342
+ --muted: 0 0% 16%;
7343
+ --muted-foreground: 0 0% 65%;
7344
+ --accent: 22 100% 50%;
7345
+ --accent-foreground: 0 0% 100%;
7346
+ --destructive: 0 84% 60%;
7347
+ --destructive-foreground: 0 0% 100%;
7348
+ --border: 0 0% 20%;
7349
+ --border-subtle: 0 0% 16%;
7350
+ --input: 0 0% 16%;
7351
+ --ring: 22 100% 50%;
7352
+ --primary-glow: 24 100% 60%;
7353
+ --severity-critical: 0 84% 60%;
7354
+ --severity-high: 12 92% 52%;
7355
+ --severity-medium: 45 93% 47%;
7356
+ --severity-low: 142 71% 45%;
7357
+ --severity-info: 210 100% 56%;
7358
+ --sidebar-background: 0 0% 9%;
7359
+ --sidebar-foreground: 0 0% 100%;
7360
+ --sidebar-primary: 24 100% 50%;
7361
+ --sidebar-primary-foreground: 0 0% 100%;
7362
+ --sidebar-accent: 0 0% 16%;
7363
+ --sidebar-accent-foreground: 0 0% 100%;
7364
+ --sidebar-border: 0 0% 16%;
7365
+ --sidebar-ring: 24 100% 50%;
7366
+ --gradient-card: linear-gradient(145deg, hsl(0 0% 14%) 0%, hsl(0 0% 12%) 100%);
7367
+ --gradient-accent: linear-gradient(135deg, hsl(24 100% 50%) 0%, hsl(24 100% 60%) 100%);
7368
+ }
7369
+
7370
+ .shuffle-core-scope,
7371
+ .shuffle-core-scope *,
7372
+ .shuffle-core-scope *::before,
7373
+ .shuffle-core-scope *::after {
7374
+ box-sizing: border-box;
7375
+ }
7376
+
7377
+ .shuffle-core-scope {
7378
+ color: hsl(var(--foreground));
7379
+ font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
7380
+ line-height: 1.5;
7381
+ isolation: isolate;
7382
+ }
7383
+
7384
+ .shuffle-core-scope button,
7385
+ .shuffle-core-scope input,
7386
+ .shuffle-core-scope textarea,
7387
+ .shuffle-core-scope select {
7388
+ font: inherit;
7389
+ }
7390
+
7391
+ :root:not(.dark) .shuffle-core-scope:not(.dark),
7392
+ html:not(.dark) .shuffle-core-scope:not(.dark),
7393
+ body:not(.dark) .shuffle-core-scope:not(.dark),
7394
+ .shuffle-core-scope.light,
7395
+ [data-shuffle-mode="light"] .shuffle-core-scope,
7396
+ [data-shuffle-mode="light"] {
7397
+ --background: 0 0% 98%;
7398
+ --background-elevated: 0 0% 100%;
7399
+ --background-surface: 0 0% 96%;
7400
+ --foreground: 0 0% 9%;
7401
+ --foreground-muted: 0 0% 40%;
7402
+ --card: 0 0% 100%;
7403
+ --card-foreground: 0 0% 9%;
7404
+ --popover: 0 0% 100%;
7405
+ --popover-foreground: 0 0% 9%;
7406
+ --secondary: 0 0% 94%;
7407
+ --secondary-foreground: 0 0% 9%;
7408
+ --muted: 0 0% 94%;
7409
+ --muted-foreground: 0 0% 40%;
7410
+ --accent: 0 0% 92%;
7411
+ --accent-foreground: 0 0% 9%;
7412
+ --destructive: 0 72% 51%;
7413
+ --destructive-foreground: 0 0% 100%;
7414
+ --border: 0 0% 78%;
7415
+ --border-subtle: 0 0% 86%;
7416
+ --input: 0 0% 94%;
7417
+ --severity-critical: 0 72% 51%;
7418
+ --severity-high: 12 88% 46%;
7419
+ --severity-medium: 38 92% 33%;
7420
+ --severity-low: 142 72% 31%;
7421
+ --severity-info: 215 90% 45%;
7422
+ --sidebar-background: 0 0% 97%;
7423
+ --sidebar-foreground: 0 0% 9%;
7424
+ --sidebar-accent: 0 0% 94%;
7425
+ --sidebar-accent-foreground: 0 0% 9%;
7426
+ --sidebar-border: 0 0% 80%;
7427
+ --gradient-card: linear-gradient(145deg, hsl(0 0% 100%) 0%, hsl(0 0% 98%) 100%);
7428
+ }
7429
+
7430
+ .dark .shuffle-core-scope:not(.light),
7431
+ .shuffle-core-scope.dark,
7432
+ [data-shuffle-mode="dark"] .shuffle-core-scope,
7433
+ [data-shuffle-mode="dark"] {
7434
+ --background: 0 0% 10%;
7435
+ --background-elevated: 0 0% 13%;
7436
+ --background-surface: 0 0% 16%;
7437
+ --foreground: 0 0% 100%;
7438
+ --foreground-muted: 0 0% 60%;
7439
+ --card: 0 0% 13%;
7440
+ --card-foreground: 0 0% 100%;
7441
+ --popover: 0 0% 12%;
7442
+ --popover-foreground: 0 0% 100%;
7443
+ --secondary: 0 0% 18%;
7444
+ --secondary-foreground: 0 0% 100%;
7445
+ --muted: 0 0% 16%;
7446
+ --muted-foreground: 0 0% 50%;
7447
+ --accent: 0 0% 20%;
7448
+ --accent-foreground: 0 0% 100%;
7449
+ --destructive: 0 84% 60%;
7450
+ --destructive-foreground: 0 0% 100%;
7451
+ --border: 0 0% 20%;
7452
+ --border-subtle: 0 0% 16%;
7453
+ --input: 0 0% 18%;
7454
+ --severity-critical: 0 84% 60%;
7455
+ --severity-high: 12 92% 52%;
7456
+ --severity-medium: 45 93% 47%;
7457
+ --severity-low: 142 71% 45%;
7458
+ --severity-info: 210 100% 56%;
7459
+ --sidebar-background: 0 0% 9%;
7460
+ --sidebar-foreground: 0 0% 100%;
7461
+ --sidebar-accent: 0 0% 16%;
7462
+ --sidebar-accent-foreground: 0 0% 100%;
7463
+ --sidebar-border: 0 0% 16%;
7464
+ --gradient-card: linear-gradient(145deg, hsl(0 0% 14%) 0%, hsl(0 0% 12%) 100%);
7465
+ }
7466
+
7467
+ .MuiTooltip-tooltip.shuffle-core-scope {
7468
+ background-color: hsl(var(--popover)) !important;
7469
+ color: hsl(var(--popover-foreground)) !important;
7470
+ border: 1px solid hsl(var(--border)) !important;
7471
+ box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12) !important;
7472
+ border-radius: 8px !important;
7473
+ }
7474
+
7475
+ .MuiTooltip-tooltip.shuffle-core-scope .MuiTooltip-arrow {
7476
+ color: hsl(var(--popover)) !important;
7477
+ }
7478
+
7479
+ .MuiTooltip-tooltip.shuffle-core-scope .MuiTooltip-arrow::before {
7480
+ border: 1px solid hsl(var(--border)) !important;
7481
+ box-sizing: border-box;
7482
+ }
7483
+ `;
7484
+ var ensureShuffleCoreStyles = () => {
7485
+ if (typeof document === "undefined") return;
7486
+ const STYLE_ID = "shuffle-core-injected-styles";
7487
+ if (document.getElementById(STYLE_ID)) return;
7488
+ const style = document.createElement("style");
7489
+ style.id = STYLE_ID;
7490
+ style.textContent = SHUFFLE_CORE_BASE_CSS;
7491
+ document.head.appendChild(style);
7492
+ };
7493
+ if (typeof document !== "undefined") {
7494
+ ensureShuffleCoreStyles();
7495
+ }
7496
+ var readElementAncestorDark = (node) => {
7497
+ if (!node || typeof document === "undefined") return null;
7498
+ const scoped = node.closest('[data-shuffle-mode="dark"], [data-shuffle-mode="light"]');
7499
+ if (scoped) return scoped.getAttribute("data-shuffle-mode") === "dark";
7500
+ if (node.closest(".dark")) return true;
7501
+ if (node.closest(".light")) return false;
7502
+ return null;
7503
+ };
7504
+ var readHtmlDarkClass2 = () => {
7505
+ if (typeof document === "undefined") return false;
7506
+ return document.documentElement.classList.contains("dark") || document.body?.classList.contains("dark") || document.documentElement.getAttribute("data-theme") === "dark" || document.body?.getAttribute("data-theme") === "dark";
7507
+ };
7508
+ var lightTokenStyle2 = {
7081
7509
  "--background": "0 0% 98%",
7082
7510
  "--background-elevated": "0 0% 100%",
7083
7511
  "--background-surface": "0 0% 96%",
@@ -7110,8 +7538,8 @@ var lightTokenStyle = {
7110
7538
  "--sidebar-border": "0 0% 80%",
7111
7539
  "--gradient-card": "linear-gradient(145deg, hsl(0 0% 100%) 0%, hsl(0 0% 98%) 100%)"
7112
7540
  };
7113
- var darkTokenStyle = {
7114
- ...lightTokenStyle,
7541
+ var darkTokenStyle2 = {
7542
+ ...lightTokenStyle2,
7115
7543
  "--background": "0 0% 10%",
7116
7544
  "--background-elevated": "0 0% 13%",
7117
7545
  "--background-surface": "0 0% 16%",
@@ -7944,7 +8372,7 @@ var SingulActionsPreview = ({
7944
8372
  var SingulActionsPreview_default = SingulActionsPreview;
7945
8373
 
7946
8374
  // components/AgentUI.tsx
7947
- import React5, { useCallback as useCallback5, useEffect as useEffect12, useLayoutEffect, useMemo as useMemo9, useRef as useRef8, useState as useState13 } from "react";
8375
+ import React5, { useCallback as useCallback6, useEffect as useEffect12, useLayoutEffect as useLayoutEffect2, useMemo as useMemo9, useRef as useRef9, useState as useState13 } from "react";
7948
8376
  import { flushSync } from "react-dom";
7949
8377
 
7950
8378
  // agentRunSync.ts
@@ -8333,10 +8761,13 @@ function safeHandler(label, fn) {
8333
8761
  var safeHandler_default = safeHandler;
8334
8762
 
8335
8763
  // ../Shuffle-Core/components/AgentPresets.tsx
8336
- import { useEffect as useEffect7, useMemo as useMemo6, useState as useState8 } from "react";
8337
- import { Box as Box11, ButtonBase, ClickAwayListener, Paper, Popper, TextField as TextField4, Tooltip as Tooltip6, Typography as Typography9 } from "@mui/material";
8764
+ import { useCallback as useCallback4, useEffect as useEffect7, useLayoutEffect, useMemo as useMemo6, useRef as useRef6, useState as useState8 } from "react";
8765
+ import { Box as Box11, ButtonBase, ClickAwayListener, Paper, Popper, TextField as TextField4, Tooltip as Tooltip6, Typography as Typography9, useTheme as useTheme3 } from "@mui/material";
8338
8766
  import { Workflow, ShieldAlert, LifeBuoy, Bug, Radar, Monitor, Plus, X as CloseIcon3, BellRing } from "lucide-react";
8339
8767
  import { Fragment as Fragment4, jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
8768
+ if (typeof document !== "undefined") {
8769
+ ensureShuffleCoreStyles();
8770
+ }
8340
8771
  var normalizeToolName = (name) => (name || "").toLowerCase().trim().replace(/[\s-]+/g, "_");
8341
8772
  var isRequiredPresetApp = (preset, appName) => {
8342
8773
  if (!preset?.requiredApps || preset.requiredApps.length === 0) return false;
@@ -8449,9 +8880,68 @@ var filterAgentPresets = (list, support) => {
8449
8880
  if (support === true || support === void 0 && isSupportUser()) return list;
8450
8881
  return list.map((p) => SUPPORT_ONLY_PRESET_IDS.includes(p.id) ? { ...p, enabled: false } : p);
8451
8882
  };
8452
- var AgentPresets = ({ variant = "default", onSelectPreset, selectedPreset, onRemoveSelected, presets, chipRef, isSupport, sx, placement }) => {
8883
+ var AgentPresets = ({
8884
+ variant = "default",
8885
+ onSelectPreset,
8886
+ selectedPreset,
8887
+ onRemoveSelected,
8888
+ presets,
8889
+ chipRef,
8890
+ isSupport,
8891
+ sx,
8892
+ placement,
8893
+ theme,
8894
+ colorMode
8895
+ }) => {
8453
8896
  const [anchorEl, setAnchorEl] = useState8(null);
8454
8897
  const open = Boolean(anchorEl);
8898
+ const buttonRef = useRef6(null);
8899
+ const setButtonRefs = useCallback4(
8900
+ (node) => {
8901
+ buttonRef.current = node;
8902
+ if (typeof chipRef === "function") {
8903
+ chipRef(node);
8904
+ } else if (chipRef && typeof chipRef === "object" && "current" in chipRef) {
8905
+ chipRef.current = node;
8906
+ }
8907
+ },
8908
+ [chipRef]
8909
+ );
8910
+ const themeScope = useShuffleCoreTheme();
8911
+ const muiTheme = useTheme3();
8912
+ const resolvedThemeProp = colorMode || (theme === "system" ? "auto" : theme);
8913
+ const computeIsDark = useCallback4(() => {
8914
+ if (resolvedThemeProp === "dark") return true;
8915
+ if (resolvedThemeProp === "light") return false;
8916
+ if (themeScope) return themeScope.isDark;
8917
+ const targetEl = anchorEl || buttonRef.current;
8918
+ if (targetEl) {
8919
+ const ancestorDark = readElementAncestorDark(targetEl);
8920
+ if (ancestorDark !== null) return ancestorDark;
8921
+ }
8922
+ const muiMode = muiTheme?.palette?.mode || muiTheme?.palette?.type || muiTheme?.palette?.theme;
8923
+ if (muiMode === "dark") return true;
8924
+ if (muiMode === "light") return false;
8925
+ if (readHtmlDarkClass2()) return true;
8926
+ if (typeof window !== "undefined" && window.matchMedia?.("(prefers-color-scheme: dark)")?.matches) {
8927
+ return true;
8928
+ }
8929
+ return false;
8930
+ }, [resolvedThemeProp, themeScope, anchorEl, muiTheme]);
8931
+ const useIsoLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect7;
8932
+ const [isDark, setIsDark] = useState8(computeIsDark);
8933
+ useIsoLayoutEffect(() => {
8934
+ setIsDark(computeIsDark());
8935
+ }, [computeIsDark, open]);
8936
+ useEffect7(() => {
8937
+ if (typeof window === "undefined") return;
8938
+ const handleThemeChange = () => setIsDark(computeIsDark());
8939
+ window.addEventListener("shuffle:theme-change", handleThemeChange);
8940
+ return () => window.removeEventListener("shuffle:theme-change", handleThemeChange);
8941
+ }, [computeIsDark]);
8942
+ const scopeStyle = isDark ? darkTokenStyle2 : lightTokenStyle2;
8943
+ const scopeClassName = isDark ? "shuffle-core-scope shuffle-mcp-scope dark" : "shuffle-core-scope shuffle-mcp-scope light";
8944
+ const resolvedModeAttr = isDark ? "dark" : "light";
8455
8945
  const [supportTick, setSupportTick] = useState8(0);
8456
8946
  useEffect7(() => {
8457
8947
  const bump = () => setSupportTick((t) => t + 1);
@@ -8469,7 +8959,10 @@ var AgentPresets = ({ variant = "default", onSelectPreset, selectedPreset, onRem
8469
8959
  const trigger = /* @__PURE__ */ jsxs11(
8470
8960
  ButtonBase,
8471
8961
  {
8472
- ref: chipRef,
8962
+ ref: setButtonRefs,
8963
+ className: scopeClassName,
8964
+ "data-shuffle-mode": resolvedModeAttr,
8965
+ style: scopeStyle,
8473
8966
  onClick: (e) => setAnchorEl(e.currentTarget),
8474
8967
  "aria-label": selectedPreset ? `Skill: ${selectedPreset.label}` : "Select skill",
8475
8968
  sx: [
@@ -8500,19 +8993,14 @@ var AgentPresets = ({ variant = "default", onSelectPreset, selectedPreset, onRem
8500
8993
  ],
8501
8994
  children: [
8502
8995
  /* @__PURE__ */ jsx17(
8503
- Box11,
8996
+ "span",
8504
8997
  {
8505
- component: "span",
8506
- sx: {
8998
+ style: {
8507
8999
  display: "inline-flex",
8508
9000
  alignItems: "center",
8509
9001
  justifyContent: "center",
8510
9002
  flexShrink: 0,
8511
- color: selectedPreset ? "hsl(var(--primary))" : "inherit",
8512
- "& svg": {
8513
- width: variant === "floating" ? 14 : 16,
8514
- height: variant === "floating" ? 14 : 16
8515
- }
9003
+ color: selectedPreset ? "hsl(var(--primary))" : "inherit"
8516
9004
  },
8517
9005
  children: selectedPreset ? selectedPreset.icon ?? void 0 : /* @__PURE__ */ jsx17(Plus, { size: variant === "floating" ? 12 : 14 })
8518
9006
  }
@@ -8574,8 +9062,6 @@ var AgentPresets = ({ variant = "default", onSelectPreset, selectedPreset, onRem
8574
9062
  (p) => p.label.toLowerCase().includes(q) || p.description.toLowerCase().includes(q) || p.tag && p.tag.toLowerCase().includes(q)
8575
9063
  );
8576
9064
  }, [list, query]);
8577
- const themeScope = useShuffleCoreTheme();
8578
- const scopeClassName = themeScope?.scopeClassName || "shuffle-mcp-scope";
8579
9065
  const popperZIndex = getPopupZIndex();
8580
9066
  const menu = open ? /* @__PURE__ */ jsx17(
8581
9067
  Popper,
@@ -8585,7 +9071,8 @@ var AgentPresets = ({ variant = "default", onSelectPreset, selectedPreset, onRem
8585
9071
  placement: placement || "bottom-start",
8586
9072
  className: scopeClassName,
8587
9073
  "data-shuffle-layer": "popup",
8588
- style: { zIndex: popperZIndex },
9074
+ "data-shuffle-mode": resolvedModeAttr,
9075
+ style: { ...scopeStyle, zIndex: popperZIndex },
8589
9076
  modifiers: [
8590
9077
  { name: "offset", options: { offset: [0, 6] } },
8591
9078
  { name: "preventOverflow", options: { padding: 8 } }
@@ -8598,16 +9085,19 @@ var AgentPresets = ({ variant = "default", onSelectPreset, selectedPreset, onRem
8598
9085
  {
8599
9086
  className: scopeClassName,
8600
9087
  "data-shuffle-layer": "popup",
9088
+ "data-shuffle-mode": resolvedModeAttr,
9089
+ style: scopeStyle,
8601
9090
  sx: {
8602
9091
  width: 360,
8603
9092
  maxWidth: "90vw",
8604
- bgcolor: "hsl(var(--card))",
8605
- border: "1px solid hsl(var(--border))",
8606
- boxShadow: "0 8px 24px hsl(var(--background) / 0.4)",
9093
+ bgcolor: isDark ? "hsl(0 0% 13%)" : "hsl(0 0% 100%)",
9094
+ color: isDark ? "hsl(0 0% 100%)" : "hsl(0 0% 9%)",
9095
+ border: `1px solid ${isDark ? "hsl(0 0% 20%)" : "hsl(0 0% 80%)"}`,
9096
+ boxShadow: isDark ? "0 8px 24px rgba(0, 0, 0, 0.4)" : "0 8px 24px rgba(0, 0, 0, 0.1)",
8607
9097
  overflow: "hidden"
8608
9098
  },
8609
9099
  children: [
8610
- /* @__PURE__ */ jsxs11(Box11, { sx: { px: 1.5, py: 1, borderBottom: "1px solid hsl(var(--border))" }, children: [
9100
+ /* @__PURE__ */ jsxs11(Box11, { sx: { px: 1.5, py: 1, borderBottom: `1px solid ${isDark ? "hsl(0 0% 20%)" : "hsl(0 0% 80%)"}` }, children: [
8611
9101
  /* @__PURE__ */ jsx17(Typography9, { sx: { fontSize: "0.72rem", fontWeight: 600, letterSpacing: 1, textTransform: "uppercase", color: "hsl(var(--muted-foreground))" }, children: "Agent skills" }),
8612
9102
  /* @__PURE__ */ jsx17(Typography9, { sx: { fontSize: "0.7rem", color: "hsl(var(--muted-foreground))", opacity: 0.7, mt: 0.25 }, children: "Click a skill to seed the prompt. More coming soon." })
8613
9103
  ] }),
@@ -8659,17 +9149,17 @@ var AgentPresets = ({ variant = "default", onSelectPreset, selectedPreset, onRem
8659
9149
  },
8660
9150
  children: [
8661
9151
  /* @__PURE__ */ jsx17(
8662
- Box11,
9152
+ "div",
8663
9153
  {
8664
- sx: {
8665
- mt: 0.25,
9154
+ style: {
9155
+ marginTop: 2,
8666
9156
  width: 26,
8667
9157
  height: 26,
8668
- borderRadius: 1,
9158
+ borderRadius: 4,
8669
9159
  display: "flex",
8670
9160
  alignItems: "center",
8671
9161
  justifyContent: "center",
8672
- bgcolor: "hsl(var(--muted))",
9162
+ backgroundColor: "hsl(var(--muted))",
8673
9163
  color: "hsl(var(--muted-foreground))",
8674
9164
  flexShrink: 0
8675
9165
  },
@@ -8988,7 +9478,7 @@ var getToolsForSkill = (skillOrPresetId) => {
8988
9478
  };
8989
9479
 
8990
9480
  // useAgentPromptPrefix.ts
8991
- import { useCallback as useCallback4, useEffect as useEffect8, useRef as useRef6, useState as useState9 } from "react";
9481
+ import { useCallback as useCallback5, useEffect as useEffect8, useRef as useRef7, useState as useState9 } from "react";
8992
9482
  var AGENT_PROMPT_PREFIX_CATEGORY = "agent-prompt-prefix";
8993
9483
  var DEFAULT_AGENT_PROMPT_PREFIX = "";
8994
9484
  var decodePrompt = (raw) => {
@@ -9023,7 +9513,7 @@ var useAgentPromptPrefix = (options = {}) => {
9023
9513
  const [prompt, setPrompt] = useState9(defaultPrompt);
9024
9514
  const [hasFetched, setHasFetched] = useState9(false);
9025
9515
  const [isSaving, setIsSaving] = useState9(false);
9026
- const fetchedForKey = useRef6(null);
9516
+ const fetchedForKey = useRef7(null);
9027
9517
  useEffect8(() => {
9028
9518
  if (!persist) {
9029
9519
  setHasFetched(true);
@@ -9051,7 +9541,7 @@ var useAgentPromptPrefix = (options = {}) => {
9051
9541
  cancelled = true;
9052
9542
  };
9053
9543
  }, [key, persist]);
9054
- const savePrompt = useCallback4(async (next) => {
9544
+ const savePrompt = useCallback5(async (next) => {
9055
9545
  const prev = prompt;
9056
9546
  setPrompt(next);
9057
9547
  if (!persist) return true;
@@ -14516,7 +15006,10 @@ var TimelineRow = ({
14516
15006
  const req = extractAuthRequest(details);
14517
15007
  if (!req) return null;
14518
15008
  if (authAppsLoading) return null;
15009
+ if (isNoAuthApp(normalizeAgentAppName(req.appName))) return null;
14519
15010
  const authed = !!isAppAuthenticated?.(req.appName, req.appId);
15011
+ const stepBlocked = isFailed || effectiveStatus === "WAITING" || effectiveStatus === "PENDING";
15012
+ if (!stepBlocked) return null;
14520
15013
  const pretty = req.appName.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
14521
15014
  const slug = normalizeAgentAppName(req.appName);
14522
15015
  const appId = req.appId || appsById[req.appName]?.id || appsById[slug]?.id || null;
@@ -14742,11 +15235,11 @@ var AgentUI = ({
14742
15235
  renderAppDetailDrawer
14743
15236
  }) => {
14744
15237
  const isEffectiveSupport = isSupport !== void 0 ? isSupport : isSupportUser();
14745
- const resolveUrl2 = useCallback5(
15238
+ const resolveUrl2 = useCallback6(
14746
15239
  (path) => apiBaseUrl ? `${apiBaseUrl.replace(/\/+$/, "")}${path}` : getApiUrl(path),
14747
15240
  [apiBaseUrl]
14748
15241
  );
14749
- const resolveHeaders2 = useCallback5(() => {
15242
+ const resolveHeaders2 = useCallback6(() => {
14750
15243
  const h = apiKey ? { Authorization: `Bearer ${apiKey}` } : { ...getAuthHeader() };
14751
15244
  if (orgId) h["Org-Id"] = orgId;
14752
15245
  return h;
@@ -14769,7 +15262,7 @@ var AgentUI = ({
14769
15262
  }
14770
15263
  return defaultInput || "";
14771
15264
  });
14772
- const lastStorageKeyRef = useRef8(contextStorageKey);
15265
+ const lastStorageKeyRef = useRef9(contextStorageKey);
14773
15266
  useEffect12(() => {
14774
15267
  if (lastStorageKeyRef.current !== contextStorageKey) {
14775
15268
  lastStorageKeyRef.current = contextStorageKey;
@@ -14783,7 +15276,7 @@ var AgentUI = ({
14783
15276
  }
14784
15277
  }
14785
15278
  }, [contextStorageKey, defaultInput]);
14786
- const prevDefaultInputRef = useRef8(defaultInput);
15279
+ const prevDefaultInputRef = useRef9(defaultInput);
14787
15280
  useEffect12(() => {
14788
15281
  if (defaultInput && defaultInput !== prevDefaultInputRef.current) {
14789
15282
  prevDefaultInputRef.current = defaultInput;
@@ -14792,12 +15285,12 @@ var AgentUI = ({
14792
15285
  }, [defaultInput]);
14793
15286
  const { prompt: savedPromptPrefix } = useAgentPromptPrefix({ userId, persist: !disableStartTab });
14794
15287
  const [selectedPreset, setSelectedPreset] = useState13(null);
14795
- const presetsChipNodeRef = useRef8(null);
15288
+ const presetsChipNodeRef = useRef9(null);
14796
15289
  const [presetsChipWidth, setPresetsChipWidth] = useState13(0);
14797
15290
  const [inputScrolled, setInputScrolled] = useState13(false);
14798
15291
  const [inputScrollTop, setInputScrollTop] = useState13(0);
14799
- const chipOverlayRef = useRef8(null);
14800
- const applyChipScroll = useCallback5((st) => {
15292
+ const chipOverlayRef = useRef9(null);
15293
+ const applyChipScroll = useCallback6((st) => {
14801
15294
  const el = chipOverlayRef.current;
14802
15295
  if (!el) return;
14803
15296
  if (el.dataset.static === "1") {
@@ -14813,15 +15306,15 @@ var AgentUI = ({
14813
15306
  const [promptSingleLine, setPromptSingleLine] = useState13(true);
14814
15307
  const promptMultilineBase = !promptSingleLine;
14815
15308
  const [attachmentsRowHeight, setAttachmentsRowHeight] = useState13(0);
14816
- const attachmentsRowRef = useCallback5((node) => {
15309
+ const attachmentsRowRef = useCallback6((node) => {
14817
15310
  setAttachmentsRowHeight(node ? node.getBoundingClientRect().height : 0);
14818
15311
  }, []);
14819
- const presetsChipRef = useCallback5((node) => {
15312
+ const presetsChipRef = useCallback6((node) => {
14820
15313
  presetsChipNodeRef.current = node;
14821
15314
  if (node) setPresetsChipWidth(node.getBoundingClientRect().width);
14822
15315
  }, []);
14823
- const inputRef = useRef8(null);
14824
- const seededPresetIdRef = useRef8(null);
15316
+ const inputRef = useRef9(null);
15317
+ const seededPresetIdRef = useRef9(null);
14825
15318
  useEffect12(() => {
14826
15319
  if (!initialPresetId && defaultInput && defaultInput.trim().length > 0) {
14827
15320
  setSelectedPreset(null);
@@ -14869,7 +15362,7 @@ var AgentUI = ({
14869
15362
  window.addEventListener(AGENT_TOOLS_CHANGED_EVENT, handleToolsChanged);
14870
15363
  return () => window.removeEventListener(AGENT_TOOLS_CHANGED_EVENT, handleToolsChanged);
14871
15364
  }, [selectedPreset]);
14872
- useLayoutEffect(() => {
15365
+ useLayoutEffect2(() => {
14873
15366
  if (hidePresets) {
14874
15367
  setPresetsChipWidth(0);
14875
15368
  return;
@@ -14911,7 +15404,7 @@ var AgentUI = ({
14911
15404
  setInputScrollTop(el.scrollTop || 0);
14912
15405
  applyChipScroll(el.scrollTop || 0);
14913
15406
  }, [actionInput, inputScrolled, applyChipScroll]);
14914
- useLayoutEffect(() => {
15407
+ useLayoutEffect2(() => {
14915
15408
  const el = inputRef.current;
14916
15409
  if (!el) {
14917
15410
  setPromptSingleLine(true);
@@ -14972,8 +15465,8 @@ var AgentUI = ({
14972
15465
  const [fullPlaceholder, setFullPlaceholder] = useState13(
14973
15466
  () => placeholder ?? getRandomAgentPromptPlaceholder()
14974
15467
  );
14975
- const pickedPlaceholderRef = useRef8(null);
14976
- useLayoutEffect(() => {
15468
+ const pickedPlaceholderRef = useRef9(null);
15469
+ useLayoutEffect2(() => {
14977
15470
  if (!shouldTypewrite) return;
14978
15471
  const el = inputRef.current;
14979
15472
  if (!el) return;
@@ -15027,7 +15520,7 @@ var AgentUI = ({
15027
15520
  return () => window.clearInterval(id);
15028
15521
  }, [fullPlaceholder, shouldTypewrite]);
15029
15522
  const activePromptPrefix = savedPromptPrefix;
15030
- const composeSubmitInput = useCallback5(
15523
+ const composeSubmitInput = useCallback6(
15031
15524
  (raw) => {
15032
15525
  if (typeof propComposeSubmitInput === "function") {
15033
15526
  return propComposeSubmitInput(raw);
@@ -15043,7 +15536,7 @@ var AgentUI = ({
15043
15536
  () => matchAgentPromptSuggestions(actionInput, 8),
15044
15537
  [actionInput]
15045
15538
  );
15046
- const programmaticInputRef = useRef8(false);
15539
+ const programmaticInputRef = useRef9(false);
15047
15540
  useEffect12(() => {
15048
15541
  if (programmaticInputRef.current) {
15049
15542
  programmaticInputRef.current = false;
@@ -15054,7 +15547,7 @@ var AgentUI = ({
15054
15547
  }, [actionInput]);
15055
15548
  const suggestionsOpen = promptSuggestions.length > 0 && !suggestionsDismissed;
15056
15549
  const [pendingCategories, setPendingCategories] = useState13([]);
15057
- const acceptSuggestion = useCallback5((s) => {
15550
+ const acceptSuggestion = useCallback6((s) => {
15058
15551
  programmaticInputRef.current = true;
15059
15552
  setActionInput(s);
15060
15553
  if (contextStorageKey) {
@@ -15093,12 +15586,12 @@ var AgentUI = ({
15093
15586
  if (saved) return saved;
15094
15587
  return BUILTIN_DEFAULT_APPS;
15095
15588
  });
15096
- const isInitialMountChosenAppsRef = useRef8(true);
15097
- const isInitialMountPresetOverrideRef = useRef8(true);
15589
+ const isInitialMountChosenAppsRef = useRef9(true);
15590
+ const isInitialMountPresetOverrideRef = useRef9(true);
15098
15591
  const [availableApps, setAvailableApps] = useState13([]);
15099
15592
  const [authAppsLoading, setAuthAppsLoading] = useState13(autoLoadApps && hasApiKey);
15100
15593
  const [detectedLLM, setDetectedLLM] = useState13(null);
15101
- const pendingLLMRef = useRef8(null);
15594
+ const pendingLLMRef = useRef9(null);
15102
15595
  const [configuredLLMOptions, setConfiguredLLMOptions] = useState13([]);
15103
15596
  const [llmMenuAnchor, setLlmMenuAnchor] = useState13(null);
15104
15597
  const [executionApps, setExecutionApps] = useState13([]);
@@ -15109,7 +15602,7 @@ var AgentUI = ({
15109
15602
  const [authDrawerApp, setAuthDrawerApp] = useState13(null);
15110
15603
  const [agentRequestLoading, setAgentRequestLoading] = useState13(false);
15111
15604
  const [rerunningDecisionId, setRerunningDecisionId] = useState13(null);
15112
- const rerunDecisionsSigRef = useRef8("");
15605
+ const rerunDecisionsSigRef = useRef9("");
15113
15606
  const [rerunAgentPending, setRerunAgentPending] = useState13(false);
15114
15607
  const [abortLoading, setAbortLoading] = useState13(false);
15115
15608
  const [execution, setExecution] = useState13(() => {
@@ -15142,14 +15635,14 @@ var AgentUI = ({
15142
15635
  }
15143
15636
  return true;
15144
15637
  });
15145
- const handleRemovePreset = useCallback5(() => {
15638
+ const handleRemovePreset = useCallback6(() => {
15146
15639
  try {
15147
15640
  localStorage.removeItem(LAST_PRESET_STORAGE_KEY);
15148
15641
  } catch {
15149
15642
  }
15150
15643
  setSelectedPreset(null);
15151
15644
  }, []);
15152
- const handleSelectPresetInternal = useCallback5((preset) => {
15645
+ const handleSelectPresetInternal = useCallback6((preset) => {
15153
15646
  try {
15154
15647
  localStorage.setItem(LAST_PRESET_STORAGE_KEY, preset.id);
15155
15648
  } catch {
@@ -15198,7 +15691,7 @@ var AgentUI = ({
15198
15691
  const [schedWeekdays, setSchedWeekdays] = useState13(() => /* @__PURE__ */ new Set([1]));
15199
15692
  const [schedDayOfMonth, setSchedDayOfMonth] = useState13(1);
15200
15693
  const [schedAdvancedOpen, setSchedAdvancedOpen] = useState13(false);
15201
- const cronManualOverrideRef = useRef8(false);
15694
+ const cronManualOverrideRef = useRef9(false);
15202
15695
  const [openIndexes, setOpenIndexes] = useState13(/* @__PURE__ */ new Set());
15203
15696
  const [highlightedIndex, setHighlightedIndex] = useState13(null);
15204
15697
  const [continueHighlighted, setContinueHighlighted] = useState13(false);
@@ -15208,13 +15701,13 @@ var AgentUI = ({
15208
15701
  const [continuationText, setContinuationText] = useState13("");
15209
15702
  const [runComplete, setRunComplete] = useState13(false);
15210
15703
  const [optimisticContinue, setOptimisticContinue] = useState13(null);
15211
- const continuationInputRef = useRef8(null);
15212
- const continuationFocusedForRef = useRef8(null);
15704
+ const continuationInputRef = useRef9(null);
15705
+ const continuationFocusedForRef = useRef9(null);
15213
15706
  const [error, setError] = useState13(null);
15214
15707
  const [pollWarning, setPollWarning] = useState13(null);
15215
- const hasExecutionDataRef = useRef8(false);
15216
- const loadedExecutionIdRef = useRef8(null);
15217
- const keepPollingUntilRef = useRef8(0);
15708
+ const hasExecutionDataRef = useRef9(false);
15709
+ const loadedExecutionIdRef = useRef9(null);
15710
+ const keepPollingUntilRef = useRef9(0);
15218
15711
  const [runExplorerAvailable, setRunExplorerAvailable] = useState13("checking");
15219
15712
  const [searchParams, setSearchParams] = useSearchParams();
15220
15713
  const initialViewParam = searchParams.get("agentView");
@@ -15249,11 +15742,11 @@ var AgentUI = ({
15249
15742
  const promptSingleLineLocked = !promptMultiline;
15250
15743
  const [nowTick, setNowTick] = useState13(() => Math.floor(Date.now() / 1e3));
15251
15744
  const [localRunStart, setLocalRunStart] = useState13(null);
15252
- const chipBarRef = useRef8(null);
15253
- const chipBarResizeObserverRef = useRef8(null);
15745
+ const chipBarRef = useRef9(null);
15746
+ const chipBarResizeObserverRef = useRef9(null);
15254
15747
  const [chipBarMultiline, setChipBarMultiline] = useState13(false);
15255
- const fileInputRef = useRef8(null);
15256
- const chipBarCallbackRef = useCallback5((node) => {
15748
+ const fileInputRef = useRef9(null);
15749
+ const chipBarCallbackRef = useCallback6((node) => {
15257
15750
  chipBarRef.current = node;
15258
15751
  chipBarResizeObserverRef.current?.disconnect();
15259
15752
  if (!node) return;
@@ -15274,14 +15767,14 @@ var AgentUI = ({
15274
15767
  }
15275
15768
  }
15276
15769
  }, []);
15277
- const activeExecutionIdRef = useRef8(
15770
+ const activeExecutionIdRef = useRef9(
15278
15771
  executionId || initialExecution?.execution_id || (contextStorageKey ? getPageContextChoice(contextStorageKey)?.executionId || null : null)
15279
15772
  );
15280
- const executionPollGenerationRef = useRef8(0);
15281
- const runAbortRef = useRef8(null);
15282
- const runGenerationRef = useRef8(0);
15283
- const userPickedStartRef = useRef8(false);
15284
- const stateRef = useRef8({
15773
+ const executionPollGenerationRef = useRef9(0);
15774
+ const runAbortRef = useRef9(null);
15775
+ const runGenerationRef = useRef9(0);
15776
+ const userPickedStartRef = useRef9(false);
15777
+ const stateRef = useRef9({
15285
15778
  execution: null,
15286
15779
  agentData: {},
15287
15780
  agentActionResult: null,
@@ -15378,7 +15871,7 @@ var AgentUI = ({
15378
15871
  }
15379
15872
  return m;
15380
15873
  }, [chosenApps, executionApps, resolvedToolApps]);
15381
- const isAppAuthenticated = useCallback5((appName, appId) => {
15874
+ const isAppAuthenticated = useCallback6((appName, appId) => {
15382
15875
  if (!appName && !appId) return false;
15383
15876
  const target = normalizeAgentAppName(appName);
15384
15877
  if (isNoAuthApp(target)) return true;
@@ -15536,7 +16029,7 @@ var AgentUI = ({
15536
16029
  cancelled = true;
15537
16030
  };
15538
16031
  }, [chosenApps, availableApps, resolveUrl2, resolveHeaders2]);
15539
- const loadAuthenticatedApps = useCallback5(async (signal) => {
16032
+ const loadAuthenticatedApps = useCallback6(async (signal) => {
15540
16033
  setAuthAppsLoading(true);
15541
16034
  try {
15542
16035
  const [authRes, wfRes] = await Promise.allSettled([
@@ -15785,7 +16278,7 @@ var AgentUI = ({
15785
16278
  cancelled = true;
15786
16279
  };
15787
16280
  }, [JSON.stringify(agentData?.allowed_actions || []), availableApps]);
15788
- const getExecution = useCallback5(async (executionId2, authorization2) => {
16281
+ const getExecution = useCallback6(async (executionId2, authorization2) => {
15789
16282
  const pollGeneration = executionPollGenerationRef.current;
15790
16283
  if (loadedExecutionIdRef.current !== executionId2) hasExecutionDataRef.current = false;
15791
16284
  if (!executionId2 || executionId2.startsWith("demo-") || executionId2.startsWith("dummy-")) return;
@@ -15988,7 +16481,7 @@ var AgentUI = ({
15988
16481
  }, intervalMs);
15989
16482
  return () => clearInterval(id);
15990
16483
  }, [execution?.execution_id, execution?.authorization, execution?.status, agentData?.decisions, runComplete, getExecution]);
15991
- const submitInput = useCallback5(async (text2, presetOverride, appsOverride) => {
16484
+ const submitInput = useCallback6(async (text2, presetOverride, appsOverride) => {
15992
16485
  if (!text2.trim()) return;
15993
16486
  if (isLoggedIn === false) {
15994
16487
  setError("Authentication required. Please log in to run AI agents.");
@@ -16180,14 +16673,14 @@ var AgentUI = ({
16180
16673
  onRun?.({ input: text2, success: true, executionId: eid, authorization: auth });
16181
16674
  }
16182
16675
  }, [chosenApps, executionApps, getExecution, onRun, attachedImages, readUrlParams, setSearchParams, viewMode, selectedPreset, isLoggedIn]);
16183
- const lastSubmittedInputRef = useRef8(null);
16676
+ const lastSubmittedInputRef = useRef9(null);
16184
16677
  useEffect12(() => {
16185
16678
  if (autoSubmit && defaultInput && defaultInput !== lastSubmittedInputRef.current) {
16186
16679
  lastSubmittedInputRef.current = defaultInput;
16187
16680
  submitInput(defaultInput);
16188
16681
  }
16189
16682
  }, [autoSubmit, defaultInput, submitInput]);
16190
- const submitQuestions = useCallback5(async (decisionId, answers, isContinuation) => {
16683
+ const submitQuestions = useCallback6(async (decisionId, answers, isContinuation) => {
16191
16684
  if (!execution?.execution_id || !execution?.authorization) return;
16192
16685
  let newArgument = {};
16193
16686
  if (isContinuation) {
@@ -16245,7 +16738,7 @@ var AgentUI = ({
16245
16738
  setAgentRequestLoading(false);
16246
16739
  }
16247
16740
  }, [execution, getExecution, agentData?.decisions]);
16248
- const resolveRunInput = useCallback5(() => {
16741
+ const resolveRunInput = useCallback6(() => {
16249
16742
  const fromData = agentData?.original_input;
16250
16743
  if (fromData && typeof fromData === "string") return fromData;
16251
16744
  if (actionInput && typeof actionInput === "string" && actionInput.trim()) return actionInput;
@@ -16313,7 +16806,7 @@ var AgentUI = ({
16313
16806
  };
16314
16807
  return deepFind(agentData) || deepFind(agentActionResult) || deepFind(execution) || "";
16315
16808
  }, [agentData, actionInput, agentActionResult, execution]);
16316
- const resolveRunTemplate = useCallback5(() => {
16809
+ const resolveRunTemplate = useCallback6(() => {
16317
16810
  const candidates = [
16318
16811
  agentData?.template,
16319
16812
  agentData?.input?.template,
@@ -16334,7 +16827,7 @@ var AgentUI = ({
16334
16827
  (p) => p.id === slug || PRESET_TEMPLATE_SLUGS[p.id] === slug || TEMPLATE_SLUG_TO_PRESET_ID[slug] === p.id
16335
16828
  ) ?? null;
16336
16829
  }, [agentData, agentActionResult, execution, presets]);
16337
- const rerunAgent = useCallback5(() => {
16830
+ const rerunAgent = useCallback6(() => {
16338
16831
  const resolved = resolveRunInput();
16339
16832
  const input = (typeof resolved === "string" && resolved.trim() ? resolved : actionInput) || "";
16340
16833
  const template = resolveRunTemplate();
@@ -16367,7 +16860,7 @@ var AgentUI = ({
16367
16860
  setRerunAgentPending(false);
16368
16861
  }
16369
16862
  }, [rerunAgentPending, agentRequestLoading, execution?.execution_id]);
16370
- const abortAgent = useCallback5(async () => {
16863
+ const abortAgent = useCallback6(async () => {
16371
16864
  flushSync(() => setAbortLoading(true));
16372
16865
  const execId = execution?.execution_id;
16373
16866
  const auth = execution?.authorization;
@@ -16436,7 +16929,7 @@ var AgentUI = ({
16436
16929
  useEffect12(() => {
16437
16930
  if (execution?.execution_id) setLastOpenedAgentRun(execution.execution_id);
16438
16931
  }, [execution?.execution_id]);
16439
- const getFormUrl = useCallback5((decisionId) => {
16932
+ const getFormUrl = useCallback6((decisionId) => {
16440
16933
  const wfId = execution?.workflow?.id;
16441
16934
  const auth = execution?.authorization;
16442
16935
  const execId = execution?.execution_id;
@@ -16452,7 +16945,7 @@ var AgentUI = ({
16452
16945
  });
16453
16946
  return `/forms/${wfId}?${params.toString()}`;
16454
16947
  }, [execution, agentActionResult, apiBaseUrl]);
16455
- const rerunDecision = useCallback5(async (decision) => {
16948
+ const rerunDecision = useCallback6(async (decision) => {
16456
16949
  if (!execution?.execution_id) {
16457
16950
  toast2({ title: "No execution loaded", description: "Cannot rerun this decision.", variant: "destructive" });
16458
16951
  return;
@@ -16756,7 +17249,7 @@ var AgentUI = ({
16756
17249
  }, 150);
16757
17250
  return () => clearTimeout(t);
16758
17251
  }, [finishDecisionId, agentRequestLoading]);
16759
- const openLocalLlmArea = useCallback5(() => {
17252
+ const openLocalLlmArea = useCallback6(() => {
16760
17253
  if (onChooseLLM) {
16761
17254
  onChooseLLM();
16762
17255
  return;
@@ -16835,8 +17328,8 @@ var AgentUI = ({
16835
17328
  requestAnimationFrame(() => requestAnimationFrame(scrollRowIntoView));
16836
17329
  window.setTimeout(scrollRowIntoView, 260);
16837
17330
  };
16838
- const timelineEndRef = useRef8(null);
16839
- const followTimelineRef = useRef8(true);
17331
+ const timelineEndRef = useRef9(null);
17332
+ const followTimelineRef = useRef9(true);
16840
17333
  useEffect12(() => {
16841
17334
  if (typeof window === "undefined") return;
16842
17335
  const getScrollParent = (node) => {
@@ -16898,7 +17391,7 @@ var AgentUI = ({
16898
17391
  useEffect12(() => {
16899
17392
  followTimelineRef.current = true;
16900
17393
  }, [execution?.execution_id]);
16901
- const handlePrimarySubmit = useCallback5(() => {
17394
+ const handlePrimarySubmit = useCallback6(() => {
16902
17395
  const composed = composeSubmitInput(actionInput);
16903
17396
  if (submitOverride) {
16904
17397
  submitOverride({ input: composed, apps: chosenApps });
@@ -17085,7 +17578,7 @@ var AgentUI = ({
17085
17578
  const parsed = parseScheduleHint(actionInput);
17086
17579
  return parsed && parsed.once ? null : parsed;
17087
17580
  }, [actionInput]);
17088
- const lastAppliedHintRef = useRef8(null);
17581
+ const lastAppliedHintRef = useRef9(null);
17089
17582
  useEffect12(() => {
17090
17583
  if (!scheduleHint) return;
17091
17584
  if (scheduleAnchor) return;
@@ -17151,7 +17644,7 @@ var AgentUI = ({
17151
17644
  /* @__PURE__ */ jsx24(Box16, { component: "span", children: r })
17152
17645
  ] }, i)) })
17153
17646
  ] }) : "";
17154
- const tabBarRef = useRef8(null);
17647
+ const tabBarRef = useRef9(null);
17155
17648
  const runStatusUpper = resolveRunStatus(execution?.status, agentData?.status);
17156
17649
  const runIsActive = hasExecution && !["FINISHED", "FAILURE", "ABORTED", "CANCELLED", "CANCELED"].includes(runStatusUpper);
17157
17650
  const tabBar = /* @__PURE__ */ jsx24(
@@ -17773,6 +18266,8 @@ var AgentUI = ({
17773
18266
  onRemoveSelected: handleRemovePreset,
17774
18267
  onSelectPreset: handleSelectPresetInternal,
17775
18268
  placement: "bottom-start",
18269
+ theme: theme || (themeScope?.isDark ? "dark" : "light"),
18270
+ colorMode,
17776
18271
  sx: {
17777
18272
  height: 32,
17778
18273
  alignSelf: "center"
@@ -18297,7 +18792,9 @@ var AgentUI = ({
18297
18792
  isSupport: isEffectiveSupport,
18298
18793
  selectedPreset,
18299
18794
  onRemoveSelected: handleRemovePreset,
18300
- onSelectPreset: handleSelectPresetInternal
18795
+ onSelectPreset: handleSelectPresetInternal,
18796
+ theme: theme || (themeScope?.isDark ? "dark" : "light"),
18797
+ colorMode
18301
18798
  }
18302
18799
  )
18303
18800
  }
@@ -19896,7 +20393,7 @@ var AgentUI = ({
19896
20393
  var AgentUI_default = AgentUI;
19897
20394
 
19898
20395
  // components/AgentRunDrawer.tsx
19899
- import { useEffect as useEffect16, useRef as useRef11, useState as useState18 } from "react";
20396
+ import { useEffect as useEffect16, useRef as useRef12, useState as useState18 } from "react";
19900
20397
  import {
19901
20398
  Box as Box20,
19902
20399
  Drawer,
@@ -19914,7 +20411,7 @@ import {
19914
20411
  } from "lucide-react";
19915
20412
 
19916
20413
  // ../Shuffle-Core/components/LocalLLMConfig.tsx
19917
- import { useEffect as useEffect15, useMemo as useMemo10, useRef as useRef10, useState as useState17 } from "react";
20414
+ import { useEffect as useEffect15, useMemo as useMemo10, useRef as useRef11, useState as useState17 } from "react";
19918
20415
  import { Check } from "lucide-react";
19919
20416
  import {
19920
20417
  Autocomplete as Autocomplete2,
@@ -19926,10 +20423,10 @@ import {
19926
20423
  } from "@mui/material";
19927
20424
 
19928
20425
  // ../Shuffle-Core/useAppAuth.ts
19929
- import { useState as useState16, useCallback as useCallback8, useEffect as useEffect14, useRef as useRef9 } from "react";
20426
+ import { useState as useState16, useCallback as useCallback9, useEffect as useEffect14, useRef as useRef10 } from "react";
19930
20427
 
19931
20428
  // ../Shuffle-Core/components/IntegrationStatus.tsx
19932
- import { useState as useState15, useEffect as useEffect13, useCallback as useCallback7 } from "react";
20429
+ import { useState as useState15, useEffect as useEffect13, useCallback as useCallback8 } from "react";
19933
20430
  import {
19934
20431
  Plus as AddIcon3
19935
20432
  } from "lucide-react";
@@ -19944,7 +20441,7 @@ import {
19944
20441
  import { Link as RouterLink } from "react-router-dom";
19945
20442
 
19946
20443
  // ../Shuffle-Core/AppDetailContext.tsx
19947
- import { createContext as createContext2, useContext as useContext2, useState as useState14, useCallback as useCallback6 } from "react";
20444
+ import { createContext as createContext2, useContext as useContext2, useState as useState14, useCallback as useCallback7 } from "react";
19948
20445
  import { jsx as jsx25 } from "react/jsx-runtime";
19949
20446
  var fallbackContext = {
19950
20447
  openApp: (appName) => {
@@ -19960,10 +20457,10 @@ var fallbackContext = {
19960
20457
  var AppDetailContext = createContext2(fallbackContext);
19961
20458
  var AppDetailProvider = ({ children: children2 }) => {
19962
20459
  const [currentAppName, setCurrentAppName] = useState14(null);
19963
- const openApp = useCallback6((appName) => {
20460
+ const openApp = useCallback7((appName) => {
19964
20461
  setCurrentAppName(appName);
19965
20462
  }, []);
19966
- const closeApp = useCallback6(() => {
20463
+ const closeApp = useCallback7(() => {
19967
20464
  setCurrentAppName(null);
19968
20465
  }, []);
19969
20466
  return /* @__PURE__ */ jsx25(AppDetailContext.Provider, { value: { openApp, closeApp, currentAppName, isOpen: currentAppName !== null }, children: children2 });
@@ -20029,7 +20526,7 @@ var IntegrationStatus = ({ collapsed, filterApps, onAddClick, iconSize = 26, onD
20029
20526
  const defaultLimit = showAll ? integrations.length : collapsed ? 3 : 7;
20030
20527
  const displayLimit = showAll ? integrations.length : expanded ? integrations.length : defaultLimit;
20031
20528
  const hasMore = !showAll && integrations.length > defaultLimit;
20032
- const fetchIntegrations = useCallback7(async () => {
20529
+ const fetchIntegrations = useCallback8(async () => {
20033
20530
  setLoading(true);
20034
20531
  try {
20035
20532
  const authData = await fetchAuthenticatedApps().catch(() => []);
@@ -20098,7 +20595,7 @@ var IntegrationStatus = ({ collapsed, filterApps, onAddClick, iconSize = 26, onD
20098
20595
  setLoading(false);
20099
20596
  }
20100
20597
  }, [priorityCategory]);
20101
- const fetchOnboardingApps = useCallback7(async () => {
20598
+ const fetchOnboardingApps = useCallback8(async () => {
20102
20599
  try {
20103
20600
  const resp = await getDatastoreItem(SELECTED_TOOLS_KEY, ONBOARDING_CONFIG_CATEGORY);
20104
20601
  if (!resp?.success || !resp.item?.value) {
@@ -20433,8 +20930,8 @@ function useAppAuth() {
20433
20930
  const [authStates, setAuthStates] = useState16({});
20434
20931
  const [authenticatedApps, setAuthenticatedApps] = useState16([]);
20435
20932
  const [loading, setLoading] = useState16(true);
20436
- const hasLoadedAuthRef = useRef9(false);
20437
- const fetchAuthenticatedApps2 = useCallback8(async () => {
20933
+ const hasLoadedAuthRef = useRef10(false);
20934
+ const fetchAuthenticatedApps2 = useCallback9(async () => {
20438
20935
  if (!hasShuffleAuth()) {
20439
20936
  setLoading(false);
20440
20937
  return;
@@ -20453,7 +20950,7 @@ function useAppAuth() {
20453
20950
  useEffect14(() => {
20454
20951
  fetchAuthenticatedApps2();
20455
20952
  }, [fetchAuthenticatedApps2]);
20456
- const handleAuthChange = useCallback8((systemId, credentials) => {
20953
+ const handleAuthChange = useCallback9((systemId, credentials) => {
20457
20954
  setAuthStates((prev) => ({
20458
20955
  ...prev,
20459
20956
  [systemId]: {
@@ -20463,7 +20960,7 @@ function useAppAuth() {
20463
20960
  }
20464
20961
  }));
20465
20962
  }, []);
20466
- const handleTestConnection = useCallback8(async (systemId, authenticationId) => {
20963
+ const handleTestConnection = useCallback9(async (systemId, authenticationId) => {
20467
20964
  setAuthStates((prev) => ({
20468
20965
  ...prev,
20469
20966
  [systemId]: {
@@ -20581,7 +21078,7 @@ function useAppAuth() {
20581
21078
  }));
20582
21079
  }
20583
21080
  }, [fetchAuthenticatedApps2]);
20584
- const handleSaveAuth = useCallback8(async (appId, credentials, appName, label) => {
21081
+ const handleSaveAuth = useCallback9(async (appId, credentials, appName, label) => {
20585
21082
  const fields = Object.entries(credentials).filter(([key, value]) => key?.trim() && value?.trim()).map(([key, value]) => ({ key, value }));
20586
21083
  const payload = {
20587
21084
  label: label?.trim() || `Auth for ${(appName || appId).replace(/_/g, " ")}`,
@@ -21072,7 +21569,7 @@ var LocalLLMConfig = ({ compact, globalUrl, userdata, isLoaded, isLoggedIn, serv
21072
21569
  }
21073
21570
  });
21074
21571
  const [customUrl, setCustomUrl] = useState17("");
21075
- const activeSwitchSeqRef = useRef10(0);
21572
+ const activeSwitchSeqRef = useRef11(0);
21076
21573
  const [llmTest, setLlmTest] = useState17(null);
21077
21574
  const openaiEntries = authenticatedApps.filter(
21078
21575
  (a) => a.app?.name?.toLowerCase() === "openai" || a.app?.id === OPENAI_APP_ID
@@ -21295,8 +21792,8 @@ var LocalLLMConfig = ({ compact, globalUrl, userdata, isLoaded, isLoggedIn, serv
21295
21792
  } catch {
21296
21793
  }
21297
21794
  };
21298
- const prevOpenRef = useRef10(open);
21299
- const hasInitializedPresetRef = useRef10(false);
21795
+ const prevOpenRef = useRef11(open);
21796
+ const hasInitializedPresetRef = useRef11(false);
21300
21797
  useEffect15(() => {
21301
21798
  const justOpened = Boolean(open && !prevOpenRef.current);
21302
21799
  prevOpenRef.current = open;
@@ -21732,7 +22229,7 @@ var AgentRunDrawer = ({
21732
22229
  useSyncHostBaseUrl(globalUrl);
21733
22230
  const themeScope = useShuffleMcpTheme();
21734
22231
  const [activeTab, setActiveTab] = useState18(initialTab);
21735
- const prevOpenRef = useRef11(open);
22232
+ const prevOpenRef = useRef12(open);
21736
22233
  useEffect16(() => {
21737
22234
  if (open && !prevOpenRef.current) setActiveTab(initialTab);
21738
22235
  prevOpenRef.current = open;
@@ -21784,7 +22281,7 @@ var AgentRunDrawer = ({
21784
22281
  });
21785
22282
  const showTabs = visibleTabs.length > 1;
21786
22283
  const safeActiveTab = visibleTabs.includes(activeTab) ? activeTab : "run";
21787
- const paperRef = useRef11(null);
22284
+ const paperRef = useRef12(null);
21788
22285
  useEffect16(() => {
21789
22286
  if (!open || safeActiveTab !== "run") return;
21790
22287
  const focusInput = () => {
@@ -21975,7 +22472,7 @@ var AgentRunDrawer = ({
21975
22472
  var AgentRunDrawer_default = AgentRunDrawer;
21976
22473
 
21977
22474
  // components/AgentActivityList.tsx
21978
- import { useCallback as useCallback9, useEffect as useEffect17, useRef as useRef12, useState as useState19 } from "react";
22475
+ import { useCallback as useCallback10, useEffect as useEffect17, useRef as useRef13, useState as useState19 } from "react";
21979
22476
  import { useNavigate as useNavigate2 } from "react-router-dom";
21980
22477
  import {
21981
22478
  Avatar as Avatar6,
@@ -22890,7 +23387,7 @@ var AgentRunRow = ({ run: run2, onClick, sx, appIcons, onAppClick, apiKey, apiBa
22890
23387
  if (onAppClick) {
22891
23388
  onAppClick({ id: t.id, name: t.name });
22892
23389
  } else {
22893
- navigate(`/apps/${encodeURIComponent(slug)}`);
23390
+ navigate(`/apps/${encodeURIComponent(t.id || slug)}`);
22894
23391
  }
22895
23392
  },
22896
23393
  sx: {
@@ -22980,8 +23477,8 @@ var AgentActivityList = ({
22980
23477
  const [stopLoading, setStopLoading] = useState19(false);
22981
23478
  const [appIcons, setAppIcons] = useState19({});
22982
23479
  const [enrichedRuns, setEnrichedRuns] = useState19({});
22983
- const enrichedRunsRef = useRef12({});
22984
- const processedRunIdsRef = useRef12(/* @__PURE__ */ new Set());
23480
+ const enrichedRunsRef = useRef13({});
23481
+ const processedRunIdsRef = useRef13(/* @__PURE__ */ new Set());
22985
23482
  useEffect17(() => {
22986
23483
  enrichedRunsRef.current = enrichedRuns;
22987
23484
  }, [enrichedRuns]);
@@ -22999,9 +23496,9 @@ var AgentActivityList = ({
22999
23496
  unsubOpened();
23000
23497
  };
23001
23498
  }, []);
23002
- const debounceRef = useRef12(void 0);
23499
+ const debounceRef = useRef13(void 0);
23003
23500
  const selectedAgentWorkflow = agentWorkflows.find((w) => w.id === workflowFilter) || null;
23004
- const openEditPrompt = useCallback9(async () => {
23501
+ const openEditPrompt = useCallback10(async () => {
23005
23502
  if (!workflowFilter) return;
23006
23503
  try {
23007
23504
  const { prompt, apps } = await getAgentScheduleConfig(workflowFilter, { apiKey, apiBaseUrl, orgId });
@@ -23015,7 +23512,7 @@ var AgentActivityList = ({
23015
23512
  setError(e instanceof Error ? e.message : "Failed to load workflow");
23016
23513
  }
23017
23514
  }, [workflowFilter, selectedAgentWorkflow, apiKey, apiBaseUrl, orgId, onEditWorkflow]);
23018
- const confirmStop = useCallback9(async () => {
23515
+ const confirmStop = useCallback10(async () => {
23019
23516
  if (!workflowFilter) return;
23020
23517
  setStopLoading(true);
23021
23518
  try {
@@ -23030,7 +23527,7 @@ var AgentActivityList = ({
23030
23527
  setStopLoading(false);
23031
23528
  }
23032
23529
  }, [workflowFilter, apiKey, apiBaseUrl, orgId]);
23033
- const handleAbort = useCallback9(
23530
+ const handleAbort = useCallback10(
23034
23531
  async (run2) => {
23035
23532
  const eid = run2.execution_id;
23036
23533
  const wfId = run2.workflow_id || run2?.workflow?.id;
@@ -23075,7 +23572,7 @@ var AgentActivityList = ({
23075
23572
  },
23076
23573
  [apiKey, apiBaseUrl, orgId]
23077
23574
  );
23078
- const updateSearchQuery = useCallback9((q) => {
23575
+ const updateSearchQuery = useCallback10((q) => {
23079
23576
  setSearchQuery(q);
23080
23577
  if (debounceRef.current) clearTimeout(debounceRef.current);
23081
23578
  debounceRef.current = setTimeout(() => setDebouncedQuery(q), 350);
@@ -23083,7 +23580,7 @@ var AgentActivityList = ({
23083
23580
  useEffect17(() => () => {
23084
23581
  if (debounceRef.current) clearTimeout(debounceRef.current);
23085
23582
  }, []);
23086
- const fetchRuns = useCallback9(
23583
+ const fetchRuns = useCallback10(
23087
23584
  async (append = false, cursorParam = "") => {
23088
23585
  if (disableFetch) {
23089
23586
  if (initialRuns && !append) {
@@ -23301,7 +23798,7 @@ var AgentActivityList = ({
23301
23798
  const merged = patch2 ? { ...r, ...patch2 } : r;
23302
23799
  return r.execution_id && abortedIds.has(r.execution_id) ? { ...merged, status: "ABORTED" } : merged;
23303
23800
  });
23304
- const loadMore = useCallback9(() => {
23801
+ const loadMore = useCallback10(() => {
23305
23802
  if (cursor && !isLoading) fetchRuns(true, cursor);
23306
23803
  }, [cursor, isLoading, fetchRuns]);
23307
23804
  const activeUsecase = usecaseFilters.find((u) => u.id === usecaseFilter) || null;
@@ -23877,7 +24374,7 @@ var AgentExecutionDrawer = ({
23877
24374
  var AgentExecutionDrawer_default = AgentExecutionDrawer;
23878
24375
 
23879
24376
  // views/AgentsView.tsx
23880
- import { useCallback as useCallback10, useEffect as useEffect19, useMemo as useMemo11, useState as useState21 } from "react";
24377
+ import { useCallback as useCallback11, useEffect as useEffect19, useMemo as useMemo11, useState as useState21 } from "react";
23881
24378
  import { Box as Box23, Stack, Typography as Typography20 } from "@mui/material";
23882
24379
  import { jsx as jsx32, jsxs as jsxs25 } from "react/jsx-runtime";
23883
24380
  var APPS_TTL_MS = 24 * 60 * 60 * 1e3;
@@ -23947,7 +24444,7 @@ var AgentsView = ({
23947
24444
  key: 0
23948
24445
  });
23949
24446
  const [editing, setEditing] = useState21(null);
23950
- const handleAppsChange = useCallback10((apps) => {
24447
+ const handleAppsChange = useCallback11((apps) => {
23951
24448
  if (onAppsChange) {
23952
24449
  try {
23953
24450
  onAppsChange(apps);
@@ -23984,7 +24481,7 @@ var AgentsView = ({
23984
24481
  window.addEventListener("agent-drawer-open", handler);
23985
24482
  return () => window.removeEventListener("agent-drawer-open", handler);
23986
24483
  }, []);
23987
- const effectiveSchedule = useCallback10(
24484
+ const effectiveSchedule = useCallback11(
23988
24485
  async (info) => {
23989
24486
  if (onSchedule) return onSchedule(info);
23990
24487
  await scheduleAgentRun({ ...info, apiKey, apiBaseUrl: globalUrl, orgId });
@@ -24007,7 +24504,7 @@ var AgentsView = ({
24007
24504
  ),
24008
24505
  [localLLMSlot, builtInDrawer.open, globalUrl, userdata, isLoaded, isLoggedIn, serverside, resolvedTheme, colorMode]
24009
24506
  );
24010
- const handleChooseLLM = useCallback10(() => {
24507
+ const handleChooseLLM = useCallback11(() => {
24011
24508
  if (onChooseLLM) {
24012
24509
  onChooseLLM();
24013
24510
  return;
@@ -24024,7 +24521,7 @@ var AgentsView = ({
24024
24521
  const t = window.setTimeout(tryScroll, 150);
24025
24522
  return () => window.clearTimeout(t);
24026
24523
  }, []);
24027
- const handleEditWorkflow = useCallback10(
24524
+ const handleEditWorkflow = useCallback11(
24028
24525
  ({ workflowId, name, prompt, apps }) => {
24029
24526
  setEditing({ workflowId, name });
24030
24527
  setPrefill((prev) => ({
@@ -24036,7 +24533,7 @@ var AgentsView = ({
24036
24533
  },
24037
24534
  []
24038
24535
  );
24039
- const handleSaveEdit = useCallback10(
24536
+ const handleSaveEdit = useCallback11(
24040
24537
  async ({ input, apps }) => {
24041
24538
  if (!editing) return;
24042
24539
  try {
@@ -24318,7 +24815,7 @@ var AskAiButton = ({
24318
24815
  var AskAiButton_default = AskAiButton;
24319
24816
 
24320
24817
  // components/AskAiDrawer.tsx
24321
- import { useCallback as useCallback11, useEffect as useEffect20, useMemo as useMemo12, useState as useState22 } from "react";
24818
+ import { useCallback as useCallback12, useEffect as useEffect20, useMemo as useMemo12, useState as useState22 } from "react";
24322
24819
  import { Box as Box25, ButtonBase as ButtonBase3, Typography as Typography22 } from "@mui/material";
24323
24820
  import { jsx as jsx34, jsxs as jsxs27 } from "react/jsx-runtime";
24324
24821
  var AskAiDrawer = ({
@@ -24364,7 +24861,7 @@ var AskAiDrawer = ({
24364
24861
  useEffect20(() => {
24365
24862
  setIsOverridden(resolvedContext.isOverridden);
24366
24863
  }, [resolvedContext.isOverridden, resolvedContext.storageKey]);
24367
- const handleAppsChange = useCallback11(
24864
+ const handleAppsChange = useCallback12(
24368
24865
  (apps) => {
24369
24866
  setPageContextChoice(resolvedContext.storageKey, {
24370
24867
  apps: apps.map((a) => ({ name: a.name, id: a.id, icon: a.icon }))
@@ -24373,7 +24870,7 @@ var AskAiDrawer = ({
24373
24870
  },
24374
24871
  [resolvedContext.storageKey]
24375
24872
  );
24376
- const handleSelectPreset = useCallback11(
24873
+ const handleSelectPreset = useCallback12(
24377
24874
  (preset) => {
24378
24875
  setPageContextChoice(resolvedContext.storageKey, {
24379
24876
  presetId: preset.id
@@ -24382,7 +24879,7 @@ var AskAiDrawer = ({
24382
24879
  },
24383
24880
  [resolvedContext.storageKey]
24384
24881
  );
24385
- const handleResetToDefaults = useCallback11(() => {
24882
+ const handleResetToDefaults = useCallback12(() => {
24386
24883
  clearPageContextChoice(resolvedContext.storageKey);
24387
24884
  setIsOverridden(false);
24388
24885
  setResetKey((k) => k + 1);
@@ -24444,7 +24941,7 @@ var AskAiDrawer = ({
24444
24941
  var AskAiDrawer_default = AskAiDrawer;
24445
24942
 
24446
24943
  // components/AskAiSidePanel.tsx
24447
- import React7, { useCallback as useCallback12, useEffect as useEffect21, useMemo as useMemo13, useRef as useRef13, useState as useState23 } from "react";
24944
+ import React7, { useCallback as useCallback13, useEffect as useEffect21, useMemo as useMemo13, useRef as useRef14, useState as useState23 } from "react";
24448
24945
  import {
24449
24946
  Box as Box26,
24450
24947
  Button as Button12,
@@ -24695,7 +25192,7 @@ var AskAiSidePanel = ({
24695
25192
  const effectiveDefaultInput = controlledDefaultInput ?? defaultInput ?? agentUIProps?.defaultInput;
24696
25193
  const effectiveAutoSubmit = controlledAutoSubmit ?? agentUIProps?.autoSubmit;
24697
25194
  const isBetaRoute = context.isBeta === true || currentPathname.startsWith("/incidents") || currentPathname.startsWith("/incidents-simple") || currentPathname.startsWith("/cases") || currentPathname.startsWith("/alerts") || currentPathname.startsWith("/tickets") || currentPathname.startsWith("/docs");
24698
- const handleTabChange = useCallback12(
25195
+ const handleTabChange = useCallback13(
24699
25196
  (nextTab) => {
24700
25197
  setInternalTab(nextTab);
24701
25198
  onTabChange?.(nextTab);
@@ -24707,7 +25204,7 @@ var AskAiSidePanel = ({
24707
25204
  setInternalTab(initialTab);
24708
25205
  }
24709
25206
  }, [initialTab]);
24710
- const prevOpenRef = useRef13(open);
25207
+ const prevOpenRef = useRef14(open);
24711
25208
  useEffect21(() => {
24712
25209
  if (open && !prevOpenRef.current && initialTab) {
24713
25210
  setInternalTab(initialTab);
@@ -24779,7 +25276,7 @@ var AskAiSidePanel = ({
24779
25276
  window.removeEventListener(AGENT_DRAWER_OPEN_EVENT, onOpen);
24780
25277
  };
24781
25278
  }, [handleTabChange]);
24782
- const handleAgentRun = useCallback12(
25279
+ const handleAgentRun = useCallback13(
24783
25280
  (event) => {
24784
25281
  setLastRunInfo({
24785
25282
  input: event.input,
@@ -24821,7 +25318,7 @@ var AskAiSidePanel = ({
24821
25318
  const hasAgentRun = Boolean(
24822
25319
  lastRunInfo?.executionId || lastRunInfo?.input || activeExecutionId || urlExecutionId || runResetKey === 0 && effectiveStorageKey && getPageContextChoice(effectiveStorageKey)?.executionId
24823
25320
  );
24824
- const handleEscalateToSupport = useCallback12(() => {
25321
+ const handleEscalateToSupport = useCallback13(() => {
24825
25322
  const savedChoice = effectiveStorageKey ? getPageContextChoice(effectiveStorageKey) : null;
24826
25323
  const execId = lastRunInfo?.executionId || activeExecutionId || urlExecutionId || savedChoice?.executionId;
24827
25324
  const auth = lastRunInfo?.authorization || urlAuthorization || savedChoice?.authorization;
@@ -24873,7 +25370,7 @@ var AskAiSidePanel = ({
24873
25370
  return false;
24874
25371
  });
24875
25372
  const safeActiveTab = visibleTabs.includes(currentTab) ? currentTab : "run";
24876
- const panelRef = useRef13(null);
25373
+ const panelRef = useRef14(null);
24877
25374
  useEffect21(() => {
24878
25375
  if (!isVisible || safeActiveTab !== "run") return;
24879
25376
  const focusInput = () => {
@@ -24912,14 +25409,14 @@ var AskAiSidePanel = ({
24912
25409
  return width || 380;
24913
25410
  });
24914
25411
  const [isResizing, setIsResizing] = useState23(false);
24915
- const prevWidthPropRef = useRef13(width);
25412
+ const prevWidthPropRef = useRef14(width);
24916
25413
  useEffect21(() => {
24917
25414
  if (width !== prevWidthPropRef.current) {
24918
25415
  prevWidthPropRef.current = width;
24919
25416
  setPanelWidth(width);
24920
25417
  }
24921
25418
  }, [width]);
24922
- const handleResizeStart = useCallback12((e) => {
25419
+ const handleResizeStart = useCallback13((e) => {
24923
25420
  e.preventDefault();
24924
25421
  e.stopPropagation();
24925
25422
  setIsResizing(true);
@@ -24982,7 +25479,7 @@ var AskAiSidePanel = ({
24982
25479
  window.addEventListener("mousemove", handleMouseMove);
24983
25480
  window.addEventListener("mouseup", handleMouseUp);
24984
25481
  }, [panelWidth]);
24985
- const handleTouchResizeStart = useCallback12((e) => {
25482
+ const handleTouchResizeStart = useCallback13((e) => {
24986
25483
  if (e.touches.length !== 1) return;
24987
25484
  setIsResizing(true);
24988
25485
  const startX = e.touches[0].clientX;
@@ -25054,7 +25551,7 @@ var AskAiSidePanel = ({
25054
25551
  document.documentElement.style.setProperty("--ask-ai-panel-width", "0px");
25055
25552
  };
25056
25553
  }, [open, isAgentDisabled, effectiveWidth, effectiveSideshift]);
25057
- const handleAppsChange = useCallback12(
25554
+ const handleAppsChange = useCallback13(
25058
25555
  (nextApps) => {
25059
25556
  setPageContextChoice(context.storageKey, {
25060
25557
  apps: nextApps.map((a) => ({ name: a.name, id: a.id, icon: a.icon }))
@@ -25063,7 +25560,7 @@ var AskAiSidePanel = ({
25063
25560
  },
25064
25561
  [context.storageKey, agentUIProps]
25065
25562
  );
25066
- const handleSelectPreset = useCallback12(
25563
+ const handleSelectPreset = useCallback13(
25067
25564
  (preset) => {
25068
25565
  setPageContextChoice(context.storageKey, {
25069
25566
  presetId: preset?.id ?? null
@@ -25615,7 +26112,7 @@ var AskAiSidePanel = ({
25615
26112
  var AskAiSidePanel_default = AskAiSidePanel;
25616
26113
 
25617
26114
  // components/AskAiWidget.tsx
25618
- import { useCallback as useCallback13, useEffect as useEffect22, useMemo as useMemo14, useState as useState24 } from "react";
26115
+ import { useCallback as useCallback14, useEffect as useEffect22, useMemo as useMemo14, useState as useState24 } from "react";
25619
26116
  import { Fragment as Fragment13, jsx as jsx36, jsxs as jsxs29 } from "react/jsx-runtime";
25620
26117
  var AGENT_DRAWER_OPEN_EVENT2 = "agent-drawer-open";
25621
26118
  var AGENT_DRAWER_CLOSE_EVENT = "agent-drawer-close";
@@ -25653,7 +26150,7 @@ var AskAiWidget = ({
25653
26150
  }, [pathname, search]);
25654
26151
  const currentPath = pathname ?? browserLocation.path;
25655
26152
  const isAgentDisabled = isAgentRoute(currentPath);
25656
- const setDrawerOpen = useCallback13(
26153
+ const setDrawerOpen = useCallback14(
25657
26154
  (nextOpen) => {
25658
26155
  if (isAgentDisabled && nextOpen) return;
25659
26156
  if (controlledOpen === void 0) {
@@ -25674,7 +26171,7 @@ var AskAiWidget = ({
25674
26171
  }, [currentPath, currentSearch, rules]);
25675
26172
  const [reportedContext, setReportedContext] = useState24(null);
25676
26173
  const activeContext = reportedContext && reportedContext.path === currentPath && reportedContext.search === currentSearch ? reportedContext.ctx : resolvedContext;
25677
- const handleContextResolved = useCallback13(
26174
+ const handleContextResolved = useCallback14(
25678
26175
  (ctx) => {
25679
26176
  setReportedContext({ path: currentPath, search: currentSearch, ctx });
25680
26177
  onContextResolved?.(ctx);
@@ -25794,8 +26291,8 @@ var useContextAwareAgent = (pathname, search) => {
25794
26291
  var AskAiWidget_default = AskAiWidget;
25795
26292
 
25796
26293
  // ../Shuffle-Core/components/ApiCallViewer.tsx
25797
- import { useState as useState26, useMemo as useMemo15, useCallback as useCallback14 } from "react";
25798
- import { Box as Box27, Typography as Typography24, Button as Button13, Chip as Chip8, CircularProgress as CircularProgress6, Collapse as Collapse2, useTheme as useTheme3 } from "@mui/material";
26294
+ import { useState as useState26, useMemo as useMemo15, useCallback as useCallback15 } from "react";
26295
+ import { Box as Box27, Typography as Typography24, Button as Button13, Chip as Chip8, CircularProgress as CircularProgress6, Collapse as Collapse2, useTheme as useTheme4 } from "@mui/material";
25799
26296
 
25800
26297
  // ../Shuffle-Core/useUserApiKey.ts
25801
26298
  import { useState as useState25, useEffect as useEffect23 } from "react";
@@ -26249,7 +26746,7 @@ var ApiCallViewer = ({
26249
26746
  defaultMode = "curl",
26250
26747
  title = "API Call"
26251
26748
  }) => {
26252
- const theme = useTheme3();
26749
+ const theme = useTheme4();
26253
26750
  const isDark = theme.palette.mode === "dark";
26254
26751
  let userKeyInfo = null;
26255
26752
  try {
@@ -26356,7 +26853,7 @@ var ApiCallViewer = ({
26356
26853
  const runnableCommand = useMemo15(() => {
26357
26854
  return buildCurl(requestInfo.method, requestInfo.url, requestInfo.headers, requestInfo.body, false);
26358
26855
  }, [requestInfo]);
26359
- const handleCopy = useCallback14(async () => {
26856
+ const handleCopy = useCallback15(async () => {
26360
26857
  try {
26361
26858
  if (typeof navigator !== "undefined" && navigator.clipboard?.writeText) {
26362
26859
  await navigator.clipboard.writeText(copyableSnippet);
@@ -26368,7 +26865,7 @@ var ApiCallViewer = ({
26368
26865
  toast2.error("Copy failed");
26369
26866
  }
26370
26867
  }, [copyableSnippet]);
26371
- const handleRun = useCallback14(async () => {
26868
+ const handleRun = useCallback15(async () => {
26372
26869
  setIsRunning(true);
26373
26870
  setIsResponseOpen(true);
26374
26871
  setResponseStatus(null);
@@ -27079,7 +27576,7 @@ var AgentPromptPrefixChip = ({
27079
27576
  };
27080
27577
 
27081
27578
  // ../Shuffle-Core/useAppAuthFlow.ts
27082
- import { useState as useState28, useCallback as useCallback15 } from "react";
27579
+ import { useState as useState28, useCallback as useCallback16 } from "react";
27083
27580
  function useAppAuthFlow() {
27084
27581
  const [selectedApp, setSelectedApp] = useState28(null);
27085
27582
  const [authState, setAuthState] = useState28({
@@ -27089,7 +27586,7 @@ function useAppAuthFlow() {
27089
27586
  });
27090
27587
  const [authenticatedApps, setAuthenticatedApps] = useState28([]);
27091
27588
  const [authLoading, setAuthLoading] = useState28(false);
27092
- const fetchAuthForApp = useCallback15(async (appName, appImageUrl) => {
27589
+ const fetchAuthForApp = useCallback16(async (appName, appImageUrl) => {
27093
27590
  setAuthLoading(true);
27094
27591
  try {
27095
27592
  const authData = await fetchAuthenticatedApps();
@@ -27110,20 +27607,20 @@ function useAppAuthFlow() {
27110
27607
  setAuthLoading(false);
27111
27608
  }
27112
27609
  }, []);
27113
- const selectApp = useCallback15((app2) => {
27610
+ const selectApp = useCallback16((app2) => {
27114
27611
  setSelectedApp(app2);
27115
27612
  setAuthState({ systemId: app2.objectID, status: "pending", credentials: {} });
27116
27613
  fetchAuthForApp(app2.name, app2.image_url);
27117
27614
  }, [fetchAuthForApp]);
27118
- const clearSelection = useCallback15(() => {
27615
+ const clearSelection = useCallback16(() => {
27119
27616
  setSelectedApp(null);
27120
27617
  setAuthState({ systemId: "", status: "pending", credentials: {} });
27121
27618
  setAuthenticatedApps([]);
27122
27619
  }, []);
27123
- const handleAuthChange = useCallback15((_appId, credentials) => {
27620
+ const handleAuthChange = useCallback16((_appId, credentials) => {
27124
27621
  setAuthState((prev) => ({ ...prev, credentials }));
27125
27622
  }, []);
27126
- const handleTestConnection = useCallback15(async (systemId, authenticationId) => {
27623
+ const handleTestConnection = useCallback16(async (systemId, authenticationId) => {
27127
27624
  if (!selectedApp) return;
27128
27625
  setAuthState((prev) => ({ ...prev, status: "testing" }));
27129
27626
  try {
@@ -27164,7 +27661,7 @@ function useAppAuthFlow() {
27164
27661
  }));
27165
27662
  }
27166
27663
  }, [selectedApp, fetchAuthForApp]);
27167
- const handleSaveAuth = useCallback15(async (appId, credentials) => {
27664
+ const handleSaveAuth = useCallback16(async (appId, credentials) => {
27168
27665
  if (!selectedApp) return false;
27169
27666
  const fields = Object.entries(credentials).filter(([key, value]) => key?.trim() && value?.trim()).map(([key, value]) => ({ key, value }));
27170
27667
  const payload = {
@@ -27199,7 +27696,7 @@ function useAppAuthFlow() {
27199
27696
  return false;
27200
27697
  }
27201
27698
  }, [selectedApp, fetchAuthForApp]);
27202
- const refreshAuth = useCallback15(async () => {
27699
+ const refreshAuth = useCallback16(async () => {
27203
27700
  if (selectedApp) {
27204
27701
  await fetchAuthForApp(selectedApp.name, selectedApp.image_url);
27205
27702
  }
@@ -28215,6 +28712,7 @@ function useAppLookup(appName) {
28215
28712
  }
28216
28713
 
28217
28714
  // index.ts
28715
+ ensureShuffleMcpStyles();
28218
28716
  var _fallbackQueryClient = null;
28219
28717
  function getFallbackQueryClient() {
28220
28718
  if (!_fallbackQueryClient) _fallbackQueryClient = new QueryClient();
@@ -28260,6 +28758,7 @@ var AppAuthSection2 = withMcpTheme(AppAuthSection, "AppAuthSection");
28260
28758
  var TryMcpSection2 = withMcpTheme(TryMcpSection, "TryMcpSection");
28261
28759
  var SingulActionsPreview2 = withMcpTheme(SingulActionsPreview_default, "SingulActionsPreview");
28262
28760
  var AgentUI2 = withMcpTheme(AgentUI_default, "AgentUI");
28761
+ var AgentPresets2 = withMcpTheme(AgentPresets_default, "AgentPresets");
28263
28762
  var AgentRunDrawer2 = withMcpTheme(AgentRunDrawer_default, "AgentRunDrawer");
28264
28763
  var AskAiButton2 = withMcpTheme(AskAiButton_default, "AskAiButton");
28265
28764
  var AskAiDrawer2 = withMcpTheme(AskAiDrawer_default, "AskAiDrawer");
@@ -28283,7 +28782,7 @@ export {
28283
28782
  AgentActivityList2 as AgentActivityList,
28284
28783
  AgentExecutionDrawer2 as AgentExecutionDrawer,
28285
28784
  AgentIcon_default as AgentIcon,
28286
- AgentPresets,
28785
+ AgentPresets2 as AgentPresets,
28287
28786
  AgentPromptPrefixChip,
28288
28787
  AgentRunDiagnosisBanner2 as AgentRunDiagnosisBanner,
28289
28788
  AgentRunDrawer2 as AgentRunDrawer,
@@ -28332,10 +28831,12 @@ export {
28332
28831
  buildSupportEscalationUrl,
28333
28832
  clearPageContextChoice,
28334
28833
  copyToClipboard,
28834
+ darkTokenStyle,
28335
28835
  index_default as default,
28336
28836
  deleteDatastoreItem,
28337
28837
  deleteDatastoreItems,
28338
28838
  diagnoseOutputWarning,
28839
+ ensureShuffleMcpStyles,
28339
28840
  extractActionAppNames,
28340
28841
  extractValidatedIngestionApps,
28341
28842
  extractWorkflowActionAppNames,
@@ -28377,6 +28878,7 @@ export {
28377
28878
  isThreatIntelApp,
28378
28879
  isVulnScannerApp,
28379
28880
  isWorkflowScheduleStopped,
28881
+ lightTokenStyle,
28380
28882
  mapCloudRegionUrl,
28381
28883
  matchRoutePattern,
28382
28884
  mergeConnectedTools,