@shuffleio/shuffle-mcps 0.0.16 → 0.0.18

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
@@ -4,16 +4,23 @@ import {
4
4
  fetchAppsViaApiConfig,
5
5
  getApiUrl,
6
6
  getAuthHeader,
7
+ getHostBaseUrl,
7
8
  getTrackedOrgId,
9
+ installFetchBreaker,
8
10
  invalidateAppsCache,
9
11
  isCloud,
10
12
  isCloudDomain,
11
13
  isOnprem,
14
+ registerProtectedOrigin,
15
+ resetRegionUrl,
16
+ setHostBaseUrl,
17
+ setRegionUrl,
12
18
  shuffleFetch
13
- } from "./chunk-FHIKSRCS.mjs";
19
+ } from "./chunk-R3YLER6P.mjs";
14
20
 
15
21
  // index.ts
16
22
  import "./shuffle-mcp-CN72CJJQ.css";
23
+ import React5 from "react";
17
24
 
18
25
  // ShuffleMcpThemeProvider.tsx
19
26
  import React from "react";
@@ -100,7 +107,7 @@ var useHtmlDarkClass = (enabled) => {
100
107
  };
101
108
  var ShuffleMcpThemeProvider = ({
102
109
  children,
103
- mode = "auto"
110
+ mode = "dark"
104
111
  }) => {
105
112
  const parent = useMuiTheme();
106
113
  const htmlIsDark = useHtmlDarkClass(mode === "auto");
@@ -120,14 +127,15 @@ var ShuffleMcpThemeProvider = ({
120
127
  [parent, effectiveDark]
121
128
  );
122
129
  const tree = /* @__PURE__ */ jsx(ThemeProvider, { theme: merged, children });
130
+ const scopeClassName = mode === "light" ? "shuffle-mcp-scope" : "shuffle-mcp-scope dark";
123
131
  if (mode === "light" || mode === "dark") {
124
- return /* @__PURE__ */ jsx("div", { className: mode === "dark" ? "dark" : "", "data-shuffle-mode": mode, children: tree });
132
+ return /* @__PURE__ */ jsx("div", { className: scopeClassName, "data-shuffle-mode": mode, "data-shuffle-mcp-root": true, children: tree });
125
133
  }
126
- return tree;
134
+ return /* @__PURE__ */ jsx("div", { className: "shuffle-mcp-scope", "data-shuffle-mode": "auto", "data-shuffle-mcp-root": true, children: tree });
127
135
  };
128
136
 
129
137
  // ShuffleMCP.tsx
130
- import React3, { useState as useState9, useEffect as useEffect7, useRef as useRef7, useCallback as useCallback7, useMemo as useMemo4, useImperativeHandle } from "react";
138
+ import React3, { useState as useState9, useEffect as useEffect8, useRef as useRef7, useCallback as useCallback7, useMemo as useMemo4, useImperativeHandle } from "react";
131
139
  import { algoliasearch } from "algoliasearch";
132
140
  import { Tooltip as Tooltip4 } from "@mui/material";
133
141
 
@@ -723,7 +731,7 @@ async function backfillAppImages(dedupedApps) {
723
731
  let missing = dedupedApps.filter((d) => !d.bestImage && !d.app.large_image);
724
732
  if (missing.length === 0) return dedupedApps;
725
733
  try {
726
- const { fetchAppsViaApiConfig: fetchAppsViaApiConfig2 } = await import("./appsCache-LOBSECTW.mjs");
734
+ const { fetchAppsViaApiConfig: fetchAppsViaApiConfig2 } = await import("./appsCache-CFCVTF7D.mjs");
727
735
  const apps = await fetchAppsViaApiConfig2().catch(() => []);
728
736
  if (Array.isArray(apps) && apps.length > 0) {
729
737
  const byName = /* @__PURE__ */ new Map();
@@ -5582,19 +5590,32 @@ import "./shuffle-mcp-CN72CJJQ.css";
5582
5590
  import * as React2 from "react";
5583
5591
  import { motion as motion7, LayoutGroup } from "framer-motion";
5584
5592
  import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
5585
- var cn = (...inputs) => inputs.filter(Boolean).join(" ");
5586
- var sizeClasses = {
5593
+ var SIZE = {
5587
5594
  sm: {
5588
- container: "p-0.5 text-[11px]",
5589
- item: "px-2.5 py-1 gap-1.5",
5590
- count: "min-w-[16px] h-[16px] px-1 text-[10px]",
5591
- divider: "h-4 mx-0.5"
5595
+ containerPadding: "2px",
5596
+ fontSize: "11px",
5597
+ itemPaddingY: "4px",
5598
+ itemPaddingX: "10px",
5599
+ itemGap: "6px",
5600
+ countMin: "16px",
5601
+ countH: "16px",
5602
+ countPx: "4px",
5603
+ countFs: "10px",
5604
+ dividerH: "16px",
5605
+ dividerMx: "2px"
5592
5606
  },
5593
5607
  md: {
5594
- container: "p-1 text-xs",
5595
- item: "px-3 py-1.5 gap-1.5",
5596
- count: "min-w-[18px] h-[18px] px-1.5 text-[10px]",
5597
- divider: "h-5 mx-1"
5608
+ containerPadding: "4px",
5609
+ fontSize: "12px",
5610
+ itemPaddingY: "6px",
5611
+ itemPaddingX: "12px",
5612
+ itemGap: "6px",
5613
+ countMin: "18px",
5614
+ countH: "18px",
5615
+ countPx: "6px",
5616
+ countFs: "10px",
5617
+ dividerH: "20px",
5618
+ dividerMx: "4px"
5598
5619
  }
5599
5620
  };
5600
5621
  var uid = 0;
@@ -5618,25 +5639,36 @@ function SegmentedControl({
5618
5639
  }) {
5619
5640
  const autoId = useUniqueId("segmented");
5620
5641
  const groupId = layoutId ?? autoId;
5621
- const s = sizeClasses[size];
5642
+ const s = SIZE[size];
5622
5643
  return /* @__PURE__ */ jsx13(LayoutGroup, { id: groupId, children: /* @__PURE__ */ jsx13(
5623
5644
  "div",
5624
5645
  {
5625
5646
  role: "tablist",
5626
5647
  "aria-label": ariaLabel,
5627
- className: cn(
5628
- "inline-flex items-center gap-0.5 rounded-full",
5629
- variant === "outline" ? "border border-border bg-transparent" : "border border-transparent bg-muted/40",
5630
- s.container,
5631
- className
5632
- ),
5648
+ className,
5649
+ style: {
5650
+ display: "inline-flex",
5651
+ alignItems: "center",
5652
+ gap: "2px",
5653
+ borderRadius: 9999,
5654
+ padding: s.containerPadding,
5655
+ fontSize: s.fontSize,
5656
+ border: variant === "outline" ? "1px solid hsl(var(--border))" : "1px solid transparent",
5657
+ background: variant === "outline" ? "transparent" : "hsl(var(--muted) / 0.4)"
5658
+ },
5633
5659
  children: options.map((opt, i) => {
5634
5660
  if (opt.type === "divider") {
5635
5661
  return /* @__PURE__ */ jsx13(
5636
5662
  "span",
5637
5663
  {
5638
5664
  "aria-hidden": true,
5639
- className: cn("w-px bg-border self-center", s.divider)
5665
+ style: {
5666
+ width: 1,
5667
+ height: s.dividerH,
5668
+ margin: `0 ${s.dividerMx}`,
5669
+ background: "hsl(var(--border))",
5670
+ alignSelf: "center"
5671
+ }
5640
5672
  },
5641
5673
  opt.key ?? `divider-${i}`
5642
5674
  );
@@ -5658,20 +5690,46 @@ function SegmentedControl({
5658
5690
  if (isAction) opt.onClick();
5659
5691
  else onChange(opt.value);
5660
5692
  },
5661
- className: cn(
5662
- "relative inline-flex items-center rounded-full font-medium",
5663
- "transition-colors duration-300",
5664
- "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
5665
- s.item,
5666
- active ? "text-foreground" : "text-muted-foreground hover:text-foreground",
5667
- opt.disabled && "opacity-50 cursor-not-allowed"
5668
- ),
5693
+ style: {
5694
+ position: "relative",
5695
+ display: "inline-flex",
5696
+ alignItems: "center",
5697
+ gap: s.itemGap,
5698
+ padding: `${s.itemPaddingY} ${s.itemPaddingX}`,
5699
+ borderRadius: 9999,
5700
+ fontWeight: 500,
5701
+ fontSize: s.fontSize,
5702
+ background: "transparent",
5703
+ border: "none",
5704
+ cursor: opt.disabled ? "not-allowed" : "pointer",
5705
+ color: active ? "hsl(var(--foreground))" : "hsl(var(--muted-foreground))",
5706
+ opacity: opt.disabled ? 0.5 : 1,
5707
+ transition: "color 200ms ease",
5708
+ outline: "none",
5709
+ fontFamily: "inherit"
5710
+ },
5711
+ onMouseEnter: (e) => {
5712
+ if (!active && !opt.disabled) {
5713
+ e.currentTarget.style.color = "hsl(var(--foreground))";
5714
+ }
5715
+ },
5716
+ onMouseLeave: (e) => {
5717
+ if (!active && !opt.disabled) {
5718
+ e.currentTarget.style.color = "hsl(var(--muted-foreground))";
5719
+ }
5720
+ },
5669
5721
  children: [
5670
5722
  active && /* @__PURE__ */ jsx13(
5671
5723
  motion7.span,
5672
5724
  {
5673
5725
  layoutId: `${groupId}-pill`,
5674
- className: "absolute inset-0 rounded-full bg-muted border border-border",
5726
+ style: {
5727
+ position: "absolute",
5728
+ inset: 0,
5729
+ borderRadius: 9999,
5730
+ background: "hsl(var(--muted))",
5731
+ border: "1px solid hsl(var(--border))"
5732
+ },
5675
5733
  initial: false,
5676
5734
  transition: {
5677
5735
  type: "spring",
@@ -5680,15 +5738,39 @@ function SegmentedControl({
5680
5738
  }
5681
5739
  }
5682
5740
  ),
5683
- /* @__PURE__ */ jsx13("span", { className: "relative z-10 inline-flex items-center gap-1.5", children: opt.label }),
5741
+ /* @__PURE__ */ jsx13(
5742
+ "span",
5743
+ {
5744
+ style: {
5745
+ position: "relative",
5746
+ zIndex: 1,
5747
+ display: "inline-flex",
5748
+ alignItems: "center",
5749
+ gap: s.itemGap
5750
+ },
5751
+ children: opt.label
5752
+ }
5753
+ ),
5684
5754
  !isAction && typeof opt.count === "number" && /* @__PURE__ */ jsx13(
5685
5755
  "span",
5686
5756
  {
5687
- className: cn(
5688
- "relative z-10 inline-flex items-center justify-center rounded-md font-semibold tabular-nums border border-border/60",
5689
- s.count,
5690
- active ? "bg-transparent text-foreground" : "bg-transparent text-muted-foreground"
5691
- ),
5757
+ style: {
5758
+ position: "relative",
5759
+ zIndex: 1,
5760
+ display: "inline-flex",
5761
+ alignItems: "center",
5762
+ justifyContent: "center",
5763
+ minWidth: s.countMin,
5764
+ height: s.countH,
5765
+ padding: `0 ${s.countPx}`,
5766
+ fontSize: s.countFs,
5767
+ fontWeight: 600,
5768
+ fontVariantNumeric: "tabular-nums",
5769
+ borderRadius: 6,
5770
+ border: "1px solid hsl(var(--border) / 0.6)",
5771
+ color: active ? "hsl(var(--foreground))" : "hsl(var(--muted-foreground))",
5772
+ background: "transparent"
5773
+ },
5692
5774
  children: opt.count
5693
5775
  }
5694
5776
  )
@@ -5701,6 +5783,15 @@ function SegmentedControl({
5701
5783
  ) });
5702
5784
  }
5703
5785
 
5786
+ // useSyncHostBaseUrl.ts
5787
+ import { useEffect as useEffect7 } from "react";
5788
+ var useSyncHostBaseUrl = (globalUrl) => {
5789
+ useEffect7(() => {
5790
+ if (!globalUrl) return;
5791
+ setHostBaseUrl(globalUrl);
5792
+ }, [globalUrl]);
5793
+ };
5794
+
5704
5795
  // ShuffleMCP.tsx
5705
5796
  import { Fragment as Fragment5, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
5706
5797
  var DEFAULT_ALGOLIA_APP_ID = "JNSS5CFDZZ";
@@ -5744,8 +5835,10 @@ var ShuffleMCP = React3.forwardRef(({
5744
5835
  renderLoadingState,
5745
5836
  onAppSelected,
5746
5837
  onSelectionChange,
5747
- onSearchChange
5838
+ onSearchChange,
5839
+ globalUrl
5748
5840
  }, ref) => {
5841
+ useSyncHostBaseUrl(globalUrl);
5749
5842
  const [query, setQuery] = useState9(initialQuery);
5750
5843
  const [results, setResults] = useState9([]);
5751
5844
  const [privateApps, setPrivateApps] = useState9([]);
@@ -5782,10 +5875,10 @@ var ShuffleMCP = React3.forwardRef(({
5782
5875
  console.error("Failed to fetch authenticated apps:", error);
5783
5876
  }
5784
5877
  }, [apiKey, apiBaseUrl, authPath, orgId]);
5785
- useEffect7(() => {
5878
+ useEffect8(() => {
5786
5879
  fetchAuthenticatedApps2();
5787
5880
  }, [fetchAuthenticatedApps2]);
5788
- useEffect7(() => {
5881
+ useEffect8(() => {
5789
5882
  if (disablePrivateApps) {
5790
5883
  setPrivateApps([]);
5791
5884
  return;
@@ -5825,7 +5918,7 @@ var ShuffleMCP = React3.forwardRef(({
5825
5918
  };
5826
5919
  fetchPrivateApps();
5827
5920
  }, [apiKey, apiBaseUrl, privateAppsPath, disablePrivateApps, orgId]);
5828
- useEffect7(() => {
5921
+ useEffect8(() => {
5829
5922
  if (authenticatedApps.length > 0 && results.length > 0) {
5830
5923
  const validatedApps = authenticatedApps.filter((auth) => auth.validation?.valid);
5831
5924
  const appsToAutoSelect = results.filter(
@@ -5845,12 +5938,12 @@ var ShuffleMCP = React3.forwardRef(({
5845
5938
  }
5846
5939
  }
5847
5940
  }, [authenticatedApps, results]);
5848
- useEffect7(() => {
5941
+ useEffect8(() => {
5849
5942
  if (externalAuthenticatedApps) {
5850
5943
  setAuthenticatedApps(externalAuthenticatedApps);
5851
5944
  }
5852
5945
  }, [externalAuthenticatedApps]);
5853
- useEffect7(() => {
5946
+ useEffect8(() => {
5854
5947
  searchClient.current = algoliasearch(algoliaAppId, algoliaApiKey);
5855
5948
  if (!hasInitialized.current) {
5856
5949
  hasInitialized.current = true;
@@ -5863,10 +5956,10 @@ var ShuffleMCP = React3.forwardRef(({
5863
5956
  }, 100);
5864
5957
  }
5865
5958
  }, []);
5866
- useEffect7(() => {
5959
+ useEffect8(() => {
5867
5960
  setInternalSelectedApps(selectedApps);
5868
5961
  }, [selectedApps]);
5869
- useEffect7(() => {
5962
+ useEffect8(() => {
5870
5963
  const handleClickOutside = (event) => {
5871
5964
  if (containerRef.current && !containerRef.current.contains(event.target)) {
5872
5965
  setIsOpen(false);
@@ -6237,10 +6330,9 @@ var ShuffleMCP = React3.forwardRef(({
6237
6330
  );
6238
6331
  });
6239
6332
  ShuffleMCP.displayName = "ShuffleMCP";
6240
- var ShuffleMCP_default = ShuffleMCP;
6241
6333
 
6242
6334
  // AppSearchDrawer.tsx
6243
- import { useState as useState10, useEffect as useEffect8 } from "react";
6335
+ import { useState as useState10, useEffect as useEffect9 } from "react";
6244
6336
  import {
6245
6337
  X as CloseIcon3
6246
6338
  } from "lucide-react";
@@ -6349,7 +6441,7 @@ function AppSearchDrawer({
6349
6441
  const [detailAppName, setDetailAppName] = useState10(null);
6350
6442
  const [detailAppId, setDetailAppId] = useState10(null);
6351
6443
  const [highlightActive, setHighlightActive] = useState10(false);
6352
- useEffect8(() => {
6444
+ useEffect9(() => {
6353
6445
  setHighlightActive(false);
6354
6446
  if (!open || !highlightAppName) return;
6355
6447
  const t = setTimeout(() => setHighlightActive(true), highlightDelayMs);
@@ -6581,7 +6673,7 @@ function AppSearchDrawer({
6581
6673
  transition: { duration: 0.2 },
6582
6674
  style: { height: "100%", minHeight: 0 },
6583
6675
  children: /* @__PURE__ */ jsx15(
6584
- ShuffleMCP,
6676
+ ShuffleMCP2,
6585
6677
  {
6586
6678
  apiKey: API_CONFIG.apiKey || void 0,
6587
6679
  apiBaseUrl: API_CONFIG.baseUrl,
@@ -6630,7 +6722,7 @@ function AppSearchDrawer({
6630
6722
  }
6631
6723
  ),
6632
6724
  /* @__PURE__ */ jsx15(
6633
- AppDetailDrawer,
6725
+ AppDetailDrawer2,
6634
6726
  {
6635
6727
  open: open && detailAppName !== null,
6636
6728
  onClose: () => {
@@ -6911,7 +7003,7 @@ function ShufflePipelinesBanner() {
6911
7003
  var ShufflePipelinesBanner_default = ShufflePipelinesBanner;
6912
7004
 
6913
7005
  // AgentUI.tsx
6914
- import { useCallback as useCallback8, useEffect as useEffect10, useMemo as useMemo6, useRef as useRef8, useState as useState12 } from "react";
7006
+ import { useCallback as useCallback8, useEffect as useEffect11, useMemo as useMemo6, useRef as useRef8, useState as useState12 } from "react";
6915
7007
  import {
6916
7008
  Plus as AddIcon3,
6917
7009
  Paperclip as AttachFileIcon,
@@ -7587,7 +7679,7 @@ var AgentDiagnosisCtas = ({ diagnosis, compact = false, tone = "medium" }) => {
7587
7679
  var AgentDiagnosisCtas_default = AgentDiagnosisCtas;
7588
7680
 
7589
7681
  // AgentRunDiagnosisBanner.tsx
7590
- import { useEffect as useEffect9, useMemo as useMemo5, useState as useState11 } from "react";
7682
+ import { useEffect as useEffect10, useMemo as useMemo5, useState as useState11 } from "react";
7591
7683
 
7592
7684
  // agentDiagnosis.ts
7593
7685
  var deepParseJsonStrings2 = (obj, depth = 0) => {
@@ -7970,7 +8062,7 @@ var AgentRunDiagnosisBanner = ({ run, sx, onJumpToEvidence, executionId }) => {
7970
8062
  return typeof fromRun === "string" && fromRun ? fromRun : null;
7971
8063
  }, [executionId, run]);
7972
8064
  const [dismissed, setDismissed] = useState11(() => readDismissed(dismissKey));
7973
- useEffect9(() => {
8065
+ useEffect10(() => {
7974
8066
  setDismissed(readDismissed(dismissKey));
7975
8067
  }, [dismissKey]);
7976
8068
  if (!run || dismissed) return null;
@@ -8662,6 +8754,8 @@ var AgentUI = ({
8662
8754
  appPickerLabel = "Select Apps",
8663
8755
  appPickerTitle = "Select Apps",
8664
8756
  appPickerSubtitle = "Pick the tools the agent is allowed to use for this run",
8757
+ onChooseLLM,
8758
+ hideChooseLLM = false,
8665
8759
  submitTooltip = "\u2318+Enter to send",
8666
8760
  submitIcon,
8667
8761
  submitOverride,
@@ -8764,14 +8858,14 @@ var AgentUI = ({
8764
8858
  stateRef.current.continuationText = continuationText;
8765
8859
  stateRef.current.localRunStart = localRunStart;
8766
8860
  stateRef.current.showStarter = showStarter;
8767
- useEffect10(() => {
8861
+ useEffect11(() => {
8768
8862
  if (execution?.execution_id || agentRequestLoading) {
8769
8863
  setLocalRunStart((prev) => prev ?? Math.floor(Date.now() / 1e3));
8770
8864
  } else {
8771
8865
  setLocalRunStart(null);
8772
8866
  }
8773
8867
  }, [execution?.execution_id, agentRequestLoading]);
8774
- useEffect10(() => {
8868
+ useEffect11(() => {
8775
8869
  const status = (execution?.status || agentData?.status || "").toUpperCase();
8776
8870
  const TERMINAL = ["FINISHED", "FAILURE", "ABORTED", "CANCELLED", "CANCELED"];
8777
8871
  if (TERMINAL.includes(status)) return;
@@ -8844,10 +8938,10 @@ var AgentUI = ({
8844
8938
  }
8845
8939
  return out;
8846
8940
  }, [agentData, appsById, isAppAuthenticated]);
8847
- useEffect10(() => {
8941
+ useEffect11(() => {
8848
8942
  if (apps) setChosenApps(apps);
8849
8943
  }, [apps]);
8850
- useEffect10(() => {
8944
+ useEffect11(() => {
8851
8945
  const decisions = agentData?.decisions || [];
8852
8946
  if (!Array.isArray(decisions) || decisions.length === 0) return;
8853
8947
  const norm4 = (s) => s.toLowerCase().replace(/[\s-]+/g, "_");
@@ -8895,7 +8989,7 @@ var AgentUI = ({
8895
8989
  cancelled = true;
8896
8990
  };
8897
8991
  }, [JSON.stringify(agentData?.decisions?.map((d) => [d?.details?.tool || d?.tool, extractAuthRequest(d)?.appName]) || []), appsById]);
8898
- useEffect10(() => {
8992
+ useEffect11(() => {
8899
8993
  const missing = chosenApps.filter((a) => !a.icon && a.name);
8900
8994
  if (missing.length === 0) return;
8901
8995
  let cancelled = false;
@@ -8953,7 +9047,7 @@ var AgentUI = ({
8953
9047
  cancelled = true;
8954
9048
  };
8955
9049
  }, [chosenApps, availableApps, resolveUrl2, resolveHeaders2]);
8956
- useEffect10(() => {
9050
+ useEffect11(() => {
8957
9051
  if (!autoLoadApps) return;
8958
9052
  if (apps || defaultApps) return;
8959
9053
  if (!hasApiKey) return;
@@ -8992,7 +9086,7 @@ var AgentUI = ({
8992
9086
  cancelled = true;
8993
9087
  };
8994
9088
  }, [autoLoadApps, apps, defaultApps, hasApiKey, resolveUrl2, resolveHeaders2]);
8995
- useEffect10(() => {
9089
+ useEffect11(() => {
8996
9090
  const raw = agentData?.allowed_actions;
8997
9091
  if (!Array.isArray(raw) || raw.length === 0) {
8998
9092
  setExecutionApps([]);
@@ -9136,7 +9230,7 @@ var AgentUI = ({
9136
9230
  setError(err instanceof Error ? err.message : "Network error.");
9137
9231
  }
9138
9232
  }, []);
9139
- useEffect10(() => {
9233
+ useEffect11(() => {
9140
9234
  let eid = null;
9141
9235
  let auth = null;
9142
9236
  if (executionId && authorization) {
@@ -9154,7 +9248,7 @@ var AgentUI = ({
9154
9248
  getExecution(eid, auth);
9155
9249
  }
9156
9250
  }, [readUrlParams, executionId, authorization, getExecution]);
9157
- useEffect10(() => {
9251
+ useEffect11(() => {
9158
9252
  if (!initialExecution || !initialExecution.execution_id) return;
9159
9253
  if (!userPickedStartRef.current) setShowStarter(false);
9160
9254
  activeExecutionIdRef.current = initialExecution.execution_id;
@@ -9187,7 +9281,7 @@ var AgentUI = ({
9187
9281
  getExecution(initialExecution.execution_id, initialExecution.authorization);
9188
9282
  }
9189
9283
  }, [initialExecution?.execution_id]);
9190
- useEffect10(() => {
9284
+ useEffect11(() => {
9191
9285
  if (!execution?.execution_id || !execution?.authorization) return;
9192
9286
  const status = (execution.status || "").toUpperCase();
9193
9287
  const TERMINAL = ["FINISHED", "FAILURE", "ABORTED", "CANCELLED", "CANCELED"];
@@ -9334,7 +9428,7 @@ var AgentUI = ({
9334
9428
  }
9335
9429
  }, [chosenApps, getExecution, onRun, attachedImages, readUrlParams, viewMode]);
9336
9430
  const autoSubmittedRef = useRef8(false);
9337
- useEffect10(() => {
9431
+ useEffect11(() => {
9338
9432
  if (autoSubmit && defaultInput && !autoSubmittedRef.current && !executionId) {
9339
9433
  autoSubmittedRef.current = true;
9340
9434
  submitInput(defaultInput);
@@ -9658,7 +9752,7 @@ var AgentUI = ({
9658
9752
  const activeTab = showStarter ? "start" : viewMode;
9659
9753
  const hasExecution = !!execution?.execution_id;
9660
9754
  const showRunSwitcher = hasExecution || agentRequestLoading;
9661
- useEffect10(() => {
9755
+ useEffect11(() => {
9662
9756
  onViewChange?.(activeTab);
9663
9757
  }, [activeTab, onViewChange]);
9664
9758
  const goToTab = (t) => {
@@ -9764,14 +9858,14 @@ var AgentUI = ({
9764
9858
  }, [agentData, execution?.status, showStarter]);
9765
9859
  const scheduleHint = useMemo6(() => parseScheduleHint(actionInput), [actionInput]);
9766
9860
  const lastAppliedHintRef = useRef8(null);
9767
- useEffect10(() => {
9861
+ useEffect11(() => {
9768
9862
  if (!scheduleHint) return;
9769
9863
  if (scheduleAnchor) return;
9770
9864
  if (lastAppliedHintRef.current === scheduleHint.cron) return;
9771
9865
  setScheduleCron(scheduleHint.cron);
9772
9866
  lastAppliedHintRef.current = scheduleHint.cron;
9773
9867
  }, [scheduleHint, scheduleAnchor]);
9774
- useEffect10(() => {
9868
+ useEffect11(() => {
9775
9869
  if (cronManualOverrideRef.current) return;
9776
9870
  const m = Math.max(0, Math.min(59, schedMinute));
9777
9871
  const h = Math.max(0, Math.min(23, schedHour));
@@ -10514,15 +10608,25 @@ var AgentUI = ({
10514
10608
  bgcolor: "hsl(var(--card))",
10515
10609
  maxWidth: "100%"
10516
10610
  }, children: [
10517
- /* @__PURE__ */ jsx20(Tooltip9, { title: "Configure the local LLM used for this agent", children: /* @__PURE__ */ jsxs16(
10611
+ !hideChooseLLM && /* @__PURE__ */ jsx20(Tooltip9, { title: "Configure the local LLM used for this agent", children: /* @__PURE__ */ jsxs16(
10518
10612
  Box14,
10519
10613
  {
10520
10614
  component: "button",
10521
10615
  type: "button",
10522
10616
  onClick: () => {
10523
- if (typeof window !== "undefined") {
10524
- window.dispatchEvent(
10525
- new CustomEvent("agent-drawer-open", { detail: { tab: "localLLM" } })
10617
+ if (onChooseLLM) {
10618
+ onChooseLLM();
10619
+ return;
10620
+ }
10621
+ if (typeof window === "undefined") return;
10622
+ const evt = new CustomEvent("agent-drawer-open", {
10623
+ detail: { tab: "localLLM" },
10624
+ cancelable: true
10625
+ });
10626
+ const handled = window.dispatchEvent(evt);
10627
+ if (handled && !window.__shuffleAgentDrawerMounted) {
10628
+ console.warn(
10629
+ '[AgentUI] "Choose LLM" was clicked but no host handler is wired. Pass an `onChooseLLM` prop, mount the bundled `AgentRunDrawer`, or set `hideChooseLLM` to remove the chip.'
10526
10630
  );
10527
10631
  }
10528
10632
  },
@@ -11253,7 +11357,7 @@ var AgentUI = ({
11253
11357
  var AgentUI_default = AgentUI;
11254
11358
 
11255
11359
  // AgentRunDrawer.tsx
11256
- import { useEffect as useEffect11, useRef as useRef9, useState as useState13 } from "react";
11360
+ import { useEffect as useEffect12, useRef as useRef9, useState as useState13 } from "react";
11257
11361
  import {
11258
11362
  Box as Box15,
11259
11363
  Drawer as Drawer3,
@@ -11288,14 +11392,23 @@ var AgentRunDrawer = ({
11288
11392
  paperSx,
11289
11393
  headerSx,
11290
11394
  tabsSx,
11291
- bodySx
11395
+ bodySx,
11396
+ globalUrl
11292
11397
  }) => {
11398
+ useSyncHostBaseUrl(globalUrl);
11293
11399
  const [activeTab, setActiveTab] = useState13(initialTab);
11294
11400
  const prevOpenRef = useRef9(open);
11295
- useEffect11(() => {
11401
+ useEffect12(() => {
11296
11402
  if (open && !prevOpenRef.current) setActiveTab(initialTab);
11297
11403
  prevOpenRef.current = open;
11298
11404
  }, [open, initialTab]);
11405
+ useEffect12(() => {
11406
+ if (typeof window === "undefined") return;
11407
+ window.__shuffleAgentDrawerMounted = (window.__shuffleAgentDrawerMounted || 0) + 1;
11408
+ return () => {
11409
+ window.__shuffleAgentDrawerMounted = Math.max(0, (window.__shuffleAgentDrawerMounted || 1) - 1);
11410
+ };
11411
+ }, []);
11299
11412
  const visibleTabs = TAB_ORDER.filter((t) => {
11300
11413
  if (t === "run") return true;
11301
11414
  if (t === "permissions") return !!permissionsSlot;
@@ -11435,6 +11548,7 @@ var AgentRunDrawer = ({
11435
11548
  hideHeroIcon: true,
11436
11549
  title: "",
11437
11550
  subtitle: null,
11551
+ apiBaseUrl: globalUrl,
11438
11552
  ...agentUIProps
11439
11553
  }
11440
11554
  ) }),
@@ -11448,7 +11562,7 @@ var AgentRunDrawer = ({
11448
11562
  var AgentRunDrawer_default = AgentRunDrawer;
11449
11563
 
11450
11564
  // AgentActivityList.tsx
11451
- import { useCallback as useCallback9, useEffect as useEffect12, useRef as useRef10, useState as useState14 } from "react";
11565
+ import { useCallback as useCallback9, useEffect as useEffect13, useRef as useRef10, useState as useState14 } from "react";
11452
11566
  import {
11453
11567
  Box as Box16,
11454
11568
  Button as Button9,
@@ -11943,7 +12057,7 @@ var AgentActivityList = ({
11943
12057
  if (debounceRef.current) clearTimeout(debounceRef.current);
11944
12058
  debounceRef.current = setTimeout(() => setDebouncedQuery(q), 350);
11945
12059
  }, []);
11946
- useEffect12(() => () => {
12060
+ useEffect13(() => () => {
11947
12061
  if (debounceRef.current) clearTimeout(debounceRef.current);
11948
12062
  }, []);
11949
12063
  const fetchRuns = useCallback9(
@@ -11975,10 +12089,10 @@ var AgentActivityList = ({
11975
12089
  },
11976
12090
  [statusFilter, limit, apiKey, apiBaseUrl, orgId, workflowFilter]
11977
12091
  );
11978
- useEffect12(() => {
12092
+ useEffect13(() => {
11979
12093
  fetchRuns(false, "");
11980
12094
  }, [statusFilter, apiKey, apiBaseUrl, orgId, workflowFilter]);
11981
- useEffect12(() => {
12095
+ useEffect13(() => {
11982
12096
  let cancelled = false;
11983
12097
  listAgentScheduleWorkflows({ apiKey, apiBaseUrl, orgId }).then((items) => {
11984
12098
  if (!cancelled) setAgentWorkflows(items);
@@ -12428,7 +12542,8 @@ var AgentExecutionDrawer_default = AgentExecutionDrawer;
12428
12542
  import { useCallback as useCallback10, useState as useState15 } from "react";
12429
12543
  import { Box as Box18, Stack, Typography as Typography17 } from "@mui/material";
12430
12544
  import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
12431
- var AgentsView = ({ onSchedule, maxWidth = 820 }) => {
12545
+ var AgentsView = ({ onSchedule, maxWidth = 820, onChooseLLM, hideChooseLLM, globalUrl, isLoaded, isLoggedIn, userdata, serverside }) => {
12546
+ useSyncHostBaseUrl(globalUrl);
12432
12547
  const [selectedRun, setSelectedRun] = useState15(null);
12433
12548
  const [agentView, setAgentView] = useState15("start");
12434
12549
  const [prefill, setPrefill] = useState15({
@@ -12469,8 +12584,8 @@ var AgentsView = ({ onSchedule, maxWidth = 820 }) => {
12469
12584
  },
12470
12585
  [editing]
12471
12586
  );
12472
- return /* @__PURE__ */ jsxs20(Box18, { sx: { minHeight: "100vh", width: "100%", px: { xs: 2, md: 4 }, pt: "5vh", pb: 6 }, children: [
12473
- /* @__PURE__ */ jsxs20(Stack, { spacing: 6, sx: { maxWidth, mx: "auto" }, children: [
12587
+ return /* @__PURE__ */ jsxs20(Box18, { sx: { minHeight: "100%", width: "100%", px: { xs: 2, md: 4 }, pt: { xs: 3, md: "5vh" }, pb: 6, boxSizing: "border-box" }, children: [
12588
+ /* @__PURE__ */ jsxs20(Stack, { spacing: 6, sx: { maxWidth, mx: "auto", width: "100%" }, children: [
12474
12589
  editing && /* @__PURE__ */ jsxs20(
12475
12590
  Box18,
12476
12591
  {
@@ -12514,8 +12629,11 @@ var AgentsView = ({ onSchedule, maxWidth = 820 }) => {
12514
12629
  AgentUI_default,
12515
12630
  {
12516
12631
  maxWidth,
12632
+ apiBaseUrl: globalUrl,
12517
12633
  onViewChange: setAgentView,
12518
12634
  onSchedule,
12635
+ onChooseLLM,
12636
+ hideChooseLLM,
12519
12637
  defaultInput: prefill.input,
12520
12638
  defaultApps: prefill.apps.length > 0 ? prefill.apps : void 0,
12521
12639
  submitOverride: editing ? handleSaveEdit : void 0,
@@ -12526,9 +12644,10 @@ var AgentsView = ({ onSchedule, maxWidth = 820 }) => {
12526
12644
  },
12527
12645
  prefill.key
12528
12646
  ),
12529
- agentView === "start" && /* @__PURE__ */ jsx24(Box18, { sx: { pt: "12vh" }, children: /* @__PURE__ */ jsx24(
12647
+ agentView === "start" && /* @__PURE__ */ jsx24(Box18, { sx: { pt: { xs: 4, md: "8vh" } }, children: /* @__PURE__ */ jsx24(
12530
12648
  AgentActivityList_default,
12531
12649
  {
12650
+ apiBaseUrl: globalUrl,
12532
12651
  onRunClick: setSelectedRun,
12533
12652
  onEditWorkflow: handleEditWorkflow
12534
12653
  }
@@ -12540,6 +12659,7 @@ var AgentsView = ({ onSchedule, maxWidth = 820 }) => {
12540
12659
  open: selectedRun !== null,
12541
12660
  onClose: () => setSelectedRun(null),
12542
12661
  run: selectedRun,
12662
+ apiBaseUrl: globalUrl,
12543
12663
  onSchedule
12544
12664
  }
12545
12665
  )
@@ -12548,7 +12668,7 @@ var AgentsView = ({ onSchedule, maxWidth = 820 }) => {
12548
12668
  var AgentsView_default = AgentsView;
12549
12669
 
12550
12670
  // useAppLookup.ts
12551
- import { useEffect as useEffect13, useMemo as useMemo7, useState as useState16 } from "react";
12671
+ import { useEffect as useEffect14, useMemo as useMemo7, useState as useState16 } from "react";
12552
12672
  var norm3 = (s) => s.toLowerCase().replace(/[\s_\-]+/g, "_");
12553
12673
  function useAppLookup(appName) {
12554
12674
  const [loading, setLoading] = useState16(false);
@@ -12562,7 +12682,7 @@ function useAppLookup(appName) {
12562
12682
  handleSaveAuth,
12563
12683
  refreshAuth
12564
12684
  } = useAppAuth();
12565
- useEffect13(() => {
12685
+ useEffect14(() => {
12566
12686
  if (!appName) {
12567
12687
  setInfo(null);
12568
12688
  setAlgoliaId(null);
@@ -12765,23 +12885,61 @@ var UsageBar = ({
12765
12885
  ) })
12766
12886
  ] }) });
12767
12887
  };
12888
+
12889
+ // index.ts
12890
+ var withMcpTheme = (Inner, displayName) => {
12891
+ const Wrapped = ({ colorMode, ...rest }) => React5.createElement(
12892
+ ShuffleMcpThemeProvider,
12893
+ { mode: colorMode },
12894
+ React5.createElement(Inner, { ...rest })
12895
+ );
12896
+ Wrapped.displayName = `ShuffleMCPs(${displayName})`;
12897
+ return Wrapped;
12898
+ };
12899
+ var withMcpThemeRef = (Inner, displayName) => {
12900
+ const Wrapped = React5.forwardRef(
12901
+ ({ colorMode, ...rest }, ref) => React5.createElement(
12902
+ ShuffleMcpThemeProvider,
12903
+ { mode: colorMode },
12904
+ React5.createElement(Inner, { ...rest, ref })
12905
+ )
12906
+ );
12907
+ Wrapped.displayName = `ShuffleMCPs(${displayName})`;
12908
+ return Wrapped;
12909
+ };
12910
+ var ShuffleMCP2 = withMcpThemeRef(ShuffleMCP, "ShuffleMCP");
12911
+ var index_default = ShuffleMCP2;
12912
+ var AppDetailDrawer2 = withMcpTheme(AppDetailDrawer, "AppDetailDrawer");
12913
+ var AppSearchDrawer2 = withMcpTheme(AppSearchDrawer, "AppSearchDrawer");
12914
+ var AiAgentPromptsEditor2 = withMcpTheme(AiAgentPromptsEditor_default, "AiAgentPromptsEditor");
12915
+ var ShufflePipelinesBanner2 = withMcpTheme(ShufflePipelinesBanner_default, "ShufflePipelinesBanner");
12916
+ var AppTitleHeader2 = withMcpTheme(AppTitleHeader, "AppTitleHeader");
12917
+ var AppAuthSection2 = withMcpTheme(AppAuthSection, "AppAuthSection");
12918
+ var TryMcpSection2 = withMcpTheme(TryMcpSection, "TryMcpSection");
12919
+ var SingulActionsPreview2 = withMcpTheme(SingulActionsPreview_default, "SingulActionsPreview");
12920
+ var AgentUI2 = withMcpTheme(AgentUI_default, "AgentUI");
12921
+ var AgentRunDrawer2 = withMcpTheme(AgentRunDrawer_default, "AgentRunDrawer");
12922
+ var AgentActivityList2 = withMcpTheme(AgentActivityList_default, "AgentActivityList");
12923
+ var AgentExecutionDrawer2 = withMcpTheme(AgentExecutionDrawer_default, "AgentExecutionDrawer");
12924
+ var AgentsView2 = withMcpTheme(AgentsView_default, "AgentsView");
12925
+ var AgentRunDiagnosisBanner2 = withMcpTheme(AgentRunDiagnosisBanner_default, "AgentRunDiagnosisBanner");
12768
12926
  export {
12769
12927
  API_CONFIG,
12770
- AgentActivityList_default as AgentActivityList,
12771
- AgentExecutionDrawer_default as AgentExecutionDrawer,
12928
+ AgentActivityList2 as AgentActivityList,
12929
+ AgentExecutionDrawer2 as AgentExecutionDrawer,
12772
12930
  AgentIcon_default as AgentIcon,
12773
- AgentRunDiagnosisBanner_default as AgentRunDiagnosisBanner,
12774
- AgentRunDrawer_default as AgentRunDrawer,
12775
- AgentUI_default as AgentUI,
12776
- AgentsView_default as AgentsView,
12777
- AiAgentPromptsEditor_default as AiAgentPromptsEditor,
12931
+ AgentRunDiagnosisBanner2 as AgentRunDiagnosisBanner,
12932
+ AgentRunDrawer2 as AgentRunDrawer,
12933
+ AgentUI2 as AgentUI,
12934
+ AgentsView2 as AgentsView,
12935
+ AiAgentPromptsEditor2 as AiAgentPromptsEditor,
12778
12936
  AppAuthCard,
12779
12937
  AppAuthConfig,
12780
- AppAuthSection,
12781
- AppDetailDrawer,
12938
+ AppAuthSection2 as AppAuthSection,
12939
+ AppDetailDrawer2 as AppDetailDrawer,
12782
12940
  AppDetailProvider,
12783
- AppSearchDrawer,
12784
- AppTitleHeader,
12941
+ AppSearchDrawer2 as AppSearchDrawer,
12942
+ AppTitleHeader2 as AppTitleHeader,
12785
12943
  CASES_PATTERNS,
12786
12944
  COMMUNICATION_PATTERNS_NAMES,
12787
12945
  DATASTORE_CATEGORIES,
@@ -12791,15 +12949,15 @@ export {
12791
12949
  INGEST_TICKETS_WORKFLOW_NAME,
12792
12950
  IntegrationStatus,
12793
12951
  SIEM_PATTERNS,
12794
- ShuffleMCP,
12952
+ ShuffleMCP2 as ShuffleMCP,
12795
12953
  ShuffleMcpThemeProvider,
12796
- ShufflePipelinesBanner_default as ShufflePipelinesBanner,
12797
- SingulActionsPreview_default as SingulActionsPreview,
12954
+ ShufflePipelinesBanner2 as ShufflePipelinesBanner,
12955
+ SingulActionsPreview2 as SingulActionsPreview,
12798
12956
  THREAT_INTEL_PATTERNS,
12799
- TryMcpSection,
12957
+ TryMcpSection2 as TryMcpSection,
12800
12958
  UsageBar,
12801
12959
  VULN_SCANNER_PATTERNS,
12802
- ShuffleMCP_default as default,
12960
+ index_default as default,
12803
12961
  deleteDatastoreItem,
12804
12962
  deleteDatastoreItems,
12805
12963
  diagnoseOutputWarning,
@@ -12815,8 +12973,10 @@ export {
12815
12973
  getDatastoreItem,
12816
12974
  getDatastoreItemPublic,
12817
12975
  getFailureInfo,
12976
+ getHostBaseUrl,
12818
12977
  getIngestionCategory,
12819
12978
  hasOutputWarning,
12979
+ installFetchBreaker,
12820
12980
  invalidateAppsCache,
12821
12981
  invalidateResolvedApps,
12822
12982
  isCloud,
@@ -12830,12 +12990,16 @@ export {
12830
12990
  normalizeAppName,
12831
12991
  parseRunResult,
12832
12992
  refreshAllIntegrationStatus,
12993
+ registerProtectedOrigin,
12994
+ resetRegionUrl,
12833
12995
  resolveApp,
12834
12996
  resolveApps,
12835
12997
  searchAgentActivity,
12836
12998
  seedResolvedApp,
12837
12999
  setDatastoreItem,
12838
13000
  setDatastoreItems,
13001
+ setHostBaseUrl,
13002
+ setRegionUrl,
12839
13003
  setRuntimeOrgId,
12840
13004
  setToastImpl,
12841
13005
  shuffleFetch,
@@ -12843,5 +13007,6 @@ export {
12843
13007
  useAppAuth,
12844
13008
  useAppDetail,
12845
13009
  useAppDetailOptional,
12846
- useAppLookup
13010
+ useAppLookup,
13011
+ useSyncHostBaseUrl
12847
13012
  };