@shuffleio/shuffle-mcps 0.0.34 → 0.0.35

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.
@@ -2,7 +2,7 @@ import {
2
2
  fetchApps,
3
3
  fetchAppsViaApiConfig,
4
4
  invalidateAppsCache
5
- } from "./chunk-B4JFC2JU.mjs";
5
+ } from "./chunk-5B3Q2RHS.mjs";
6
6
  export {
7
7
  fetchApps,
8
8
  fetchAppsViaApiConfig,
@@ -1,7 +1,9 @@
1
1
  // fetchBreaker.ts
2
2
  var FAIL_THRESHOLD = 12;
3
3
  var ROLLING_WINDOW_MS = 5e3;
4
- var COOLDOWN_MS = 3e4;
4
+ var COOLDOWN_MS = 1e4;
5
+ var PROBE_AFTER_MS = 1500;
6
+ var MAX_PROBE_BACKOFF_MS = 5e3;
5
7
  var HARD_BURST_THRESHOLD = 30;
6
8
  var HARD_BURST_WINDOW_MS = 1e3;
7
9
  var state = /* @__PURE__ */ new Map();
@@ -10,11 +12,24 @@ var allowedOrigins = /* @__PURE__ */ new Set();
10
12
  var getEntry = (key) => {
11
13
  let entry = state.get(key);
12
14
  if (!entry) {
13
- entry = { failures: [], attempts: [], blockedUntil: 0, warned: false };
15
+ entry = { failures: [], attempts: [], blockedUntil: 0, probeAfter: 0, probing: false, warned: false };
14
16
  state.set(key, entry);
15
17
  }
16
18
  return entry;
17
19
  };
20
+ var trip = (entry, now, cooldownMs = COOLDOWN_MS) => {
21
+ entry.blockedUntil = now + cooldownMs;
22
+ entry.probeAfter = now + PROBE_AFTER_MS;
23
+ entry.probing = false;
24
+ };
25
+ var reset = (entry) => {
26
+ entry.failures.length = 0;
27
+ entry.attempts.length = 0;
28
+ entry.blockedUntil = 0;
29
+ entry.probeAfter = 0;
30
+ entry.probing = false;
31
+ entry.warned = false;
32
+ };
18
33
  var prune = (arr, now, windowMs) => {
19
34
  const cutoff = now - windowMs;
20
35
  while (arr.length && arr[0] < cutoff) arr.shift();
@@ -64,21 +79,35 @@ var installFetchBreaker = () => {
64
79
  if (!key) return original(input, init);
65
80
  const entry = getEntry(key);
66
81
  const now = Date.now();
82
+ let isProbe = false;
67
83
  if (entry.blockedUntil > now) {
68
- return synthetic503(key, entry.blockedUntil - now);
84
+ if (!entry.probing && now >= entry.probeAfter) {
85
+ entry.probing = true;
86
+ isProbe = true;
87
+ } else {
88
+ return synthetic503(key, entry.blockedUntil - now);
89
+ }
69
90
  }
70
- entry.attempts.push(now);
71
- prune(entry.attempts, now, HARD_BURST_WINDOW_MS);
72
- if (entry.attempts.length > HARD_BURST_THRESHOLD) {
73
- entry.blockedUntil = now + COOLDOWN_MS;
74
- if (!entry.warned) {
75
- entry.warned = true;
76
- console.error(
77
- `[fetchBreaker] Burst detected on ${key} (${entry.attempts.length} calls / ${HARD_BURST_WINDOW_MS}ms). Blocking for ${COOLDOWN_MS / 1e3}s. Fix the caller \u2014 this is almost always a missing useEffect dep or a render loop.`
78
- );
91
+ if (!isProbe) {
92
+ entry.attempts.push(now);
93
+ prune(entry.attempts, now, HARD_BURST_WINDOW_MS);
94
+ if (entry.attempts.length > HARD_BURST_THRESHOLD) {
95
+ trip(entry, now);
96
+ if (!entry.warned) {
97
+ entry.warned = true;
98
+ console.error(
99
+ `[fetchBreaker] Burst detected on ${key} (${entry.attempts.length} calls / ${HARD_BURST_WINDOW_MS}ms). Blocking for up to ${COOLDOWN_MS / 1e3}s (probing again in ${PROBE_AFTER_MS / 1e3}s). Fix the caller \u2014 this is almost always a missing useEffect dep or a render loop.`
100
+ );
101
+ }
102
+ return synthetic503(key, COOLDOWN_MS);
79
103
  }
80
- return synthetic503(key, COOLDOWN_MS);
81
104
  }
105
+ const onProbeFailure = (ts) => {
106
+ if (!isProbe) return;
107
+ entry.probing = false;
108
+ entry.probeAfter = ts + Math.min(MAX_PROBE_BACKOFF_MS, PROBE_AFTER_MS * 2);
109
+ entry.blockedUntil = Math.max(entry.blockedUntil, ts + PROBE_AFTER_MS);
110
+ };
82
111
  let response;
83
112
  try {
84
113
  response = await original(input, init);
@@ -86,12 +115,13 @@ var installFetchBreaker = () => {
86
115
  const ts = Date.now();
87
116
  entry.failures.push(ts);
88
117
  prune(entry.failures, ts, ROLLING_WINDOW_MS);
89
- if (entry.failures.length >= FAIL_THRESHOLD) {
90
- entry.blockedUntil = ts + COOLDOWN_MS;
118
+ onProbeFailure(ts);
119
+ if (!isProbe && entry.failures.length >= FAIL_THRESHOLD) {
120
+ trip(entry, ts);
91
121
  if (!entry.warned) {
92
122
  entry.warned = true;
93
123
  console.error(
94
- `[fetchBreaker] ${entry.failures.length} network errors on ${key} in ${ROLLING_WINDOW_MS / 1e3}s. Blocking for ${COOLDOWN_MS / 1e3}s.`
124
+ `[fetchBreaker] ${entry.failures.length} network errors on ${key} in ${ROLLING_WINDOW_MS / 1e3}s. Blocking for up to ${COOLDOWN_MS / 1e3}s.`
95
125
  );
96
126
  }
97
127
  }
@@ -101,18 +131,20 @@ var installFetchBreaker = () => {
101
131
  const ts = Date.now();
102
132
  entry.failures.push(ts);
103
133
  prune(entry.failures, ts, ROLLING_WINDOW_MS);
104
- if (entry.failures.length >= FAIL_THRESHOLD) {
105
- entry.blockedUntil = ts + COOLDOWN_MS;
134
+ onProbeFailure(ts);
135
+ if (!isProbe && entry.failures.length >= FAIL_THRESHOLD) {
136
+ trip(entry, ts);
106
137
  if (!entry.warned) {
107
138
  entry.warned = true;
108
139
  console.error(
109
- `[fetchBreaker] ${entry.failures.length} ${response.status}s on ${key} in ${ROLLING_WINDOW_MS / 1e3}s. Blocking for ${COOLDOWN_MS / 1e3}s.`
140
+ `[fetchBreaker] ${entry.failures.length} ${response.status}s on ${key} in ${ROLLING_WINDOW_MS / 1e3}s. Blocking for up to ${COOLDOWN_MS / 1e3}s.`
110
141
  );
111
142
  }
112
143
  }
113
144
  } else if (response.status < 400) {
114
- entry.failures.length = 0;
115
- entry.warned = false;
145
+ reset(entry);
146
+ } else {
147
+ if (isProbe) reset(entry);
116
148
  }
117
149
  return response;
118
150
  });
@@ -134,7 +166,7 @@ var getEnvVar = (key) => {
134
166
  var isDevEnvironment = () => {
135
167
  if (getEnvVar("VITE_SHUFFLE_API_URL")) return false;
136
168
  const hostname = typeof window !== "undefined" ? window.location.hostname : "";
137
- return hostname.includes("lovableproject.com") || hostname.includes("id-preview--");
169
+ return hostname.includes("lovableproject.com") || hostname.includes("id-preview--") || hostname.endsWith(".lovable.app") || hostname.endsWith(".lovable.dev");
138
170
  };
139
171
  var isCloudDomain = () => {
140
172
  const hostname = typeof window !== "undefined" ? window.location.hostname : "";
@@ -244,13 +276,6 @@ var API_CONFIG = {
244
276
  var getApiUrl = (endpoint) => {
245
277
  return `${API_CONFIG.baseUrl}${endpoint}`;
246
278
  };
247
- var getShuffleCoreFormUrl = (refUrl) => {
248
- if (!refUrl) return refUrl;
249
- if (/^https?:\/\//i.test(refUrl)) return refUrl;
250
- const path = refUrl.startsWith("/") ? refUrl : `/${refUrl}`;
251
- if (isCloud()) return `https://shuffler.io${path}`;
252
- return `${API_CONFIG.baseUrl}${path}`;
253
- };
254
279
  var shuffleFetch = (url, init) => {
255
280
  const { headers: extraHeaders, ...rest } = init || {};
256
281
  return fetch(url, {
@@ -340,7 +365,6 @@ export {
340
365
  getTrackedOrgId,
341
366
  API_CONFIG,
342
367
  getApiUrl,
343
- getShuffleCoreFormUrl,
344
368
  shuffleFetch,
345
369
  getAuthHeader,
346
370
  fetchApps,
package/dist/index.d.mts CHANGED
@@ -131,7 +131,7 @@ interface CustomStyles {
131
131
  checkbox?: React.CSSProperties;
132
132
  checkboxChecked?: React.CSSProperties;
133
133
  }
134
- interface AppAuthentication {
134
+ interface AppAuthentication$1 {
135
135
  app: {
136
136
  id: string;
137
137
  name: string;
@@ -212,7 +212,7 @@ interface ShuffleMCPProps extends ShuffleHostProps {
212
212
  /** Base URL for Singul API calls (default: https://singul.io) */
213
213
  singulBaseUrl?: string;
214
214
  /** Manually provided authenticated apps (used when apiKey is not provided) */
215
- authenticatedApps?: AppAuthentication[];
215
+ authenticatedApps?: AppAuthentication$1[];
216
216
  /** Hide the auth status chips (Configured/Not configured, Tested/Not tested) */
217
217
  hideAuthStatus?: boolean;
218
218
  /** Apps to pin at the top of the results (prepended, deduped by name). */
@@ -604,8 +604,9 @@ interface AgentPromptPrefixChipProps {
604
604
  declare const AgentPromptPrefixChip: ({ label, userId, value, onChange, onRemove, defaultPrompt, dialogTitle, readOnly, }: AgentPromptPrefixChipProps) => React$1.JSX.Element;
605
605
 
606
606
  declare const AGENT_PROMPT_PREFIX_CATEGORY = "agent-prompt-prefix";
607
- /** Default seed used until the user saves their own prefix. */
608
- declare const DEFAULT_AGENT_PROMPT_PREFIX = "You are the Shuffle Tools agent. Use the connected Shuffle tools to help me with the request that follows.";
607
+ /** Default seed used until the user saves their own prefix.
608
+ * Empty by default — the backend system prompt handles agent identity. */
609
+ declare const DEFAULT_AGENT_PROMPT_PREFIX = "";
609
610
  interface UseAgentPromptPrefixOptions {
610
611
  /** Storage key — typically the current user id. Falls back to `"default"`. */
611
612
  userId?: string;
@@ -641,7 +642,7 @@ interface AgentRunDrawerProps extends ShuffleHostProps {
641
642
  permissionsDisabledTooltip?: string;
642
643
  /** Forwarded to the embedded AgentUI (apiKey, apiBaseUrl, orgId, etc.). */
643
644
  agentUIProps?: Partial<AgentUIProps>;
644
- /** Drawer width override (default: 480 px on >=sm, full-width on xs). */
645
+ /** Drawer width override (default: 595 px on >=sm, full-width on xs). */
645
646
  width?: number;
646
647
  /** Header title. Default: "Agent". */
647
648
  title?: string;
@@ -807,6 +808,18 @@ declare const scheduleAgentRun: ({ cron, input, apps, onStep, apiKey, apiBaseUrl
807
808
  cron: string;
808
809
  }>;
809
810
 
811
+ /**
812
+ * A usecase-backed agent "type" surfaced in the run filter dropdown.
813
+ * Hosts supply only the usecases that are actually enabled for the tenant.
814
+ */
815
+ interface AgentUsecaseFilter {
816
+ /** Unique id (used as the menu value). */
817
+ id: string;
818
+ /** Menu label, e.g. "Incident Response Agent". */
819
+ label: string;
820
+ /** Case-insensitive substrings matched against run source/workflow metadata. */
821
+ matchTokens: string[];
822
+ }
810
823
  interface AgentActivityListProps extends ShuffleHostProps {
811
824
  /** Optional Shuffle API key. Falls back to the shared API_CONFIG. */
812
825
  apiKey?: string;
@@ -844,6 +857,8 @@ interface AgentActivityListProps extends ShuffleHostProps {
844
857
  toolbarSx?: SxProps<Theme>;
845
858
  /** Style overrides for each individual run row. */
846
859
  rowSx?: SxProps<Theme>;
860
+ /** Usecase-backed agent types shown in the run filter dropdown. */
861
+ usecaseFilters?: AgentUsecaseFilter[];
847
862
  }
848
863
 
849
864
  interface AgentExecutionDrawerProps extends ShuffleHostProps {
@@ -914,6 +929,8 @@ interface AgentsViewProps extends ShuffleHostProps {
914
929
  disableAppsPersistence?: boolean;
915
930
  /** Storage key for internal chip-row persistence. Defaults to `shuffle-agents-selected-apps`. */
916
931
  appsStorageKey?: string;
932
+ /** Usecase-backed agent types shown in the activity list filter dropdown. */
933
+ usecaseFilters?: AgentUsecaseFilter[];
917
934
  }
918
935
 
919
936
  interface AgentLocalModel {
@@ -964,6 +981,30 @@ interface AppAuthState {
964
981
  executionId?: string;
965
982
  errorCode?: number;
966
983
  }
984
+ interface AuthParameter {
985
+ description: string;
986
+ example: string;
987
+ id: string;
988
+ name: string;
989
+ required: boolean;
990
+ schema: {
991
+ type: string;
992
+ };
993
+ }
994
+ interface AppAuthentication {
995
+ type: string;
996
+ description?: string;
997
+ redirect_uri?: string;
998
+ token_uri?: string;
999
+ refresh_uri?: string;
1000
+ authorization_url?: string;
1001
+ auth_uri?: string;
1002
+ authorize_url?: string;
1003
+ scope?: string[];
1004
+ client_id?: string;
1005
+ client_secret?: string;
1006
+ parameters?: AuthParameter[];
1007
+ }
967
1008
  interface ApiAuthEntry {
968
1009
  id?: string;
969
1010
  label?: string;
@@ -1023,6 +1064,12 @@ interface AppAuthCardProps extends ShuffleHostProps {
1023
1064
  * credentials form (with the small "Test Authentication" CTA) is always
1024
1065
  * visible so users can edit & retest in one place. */
1025
1066
  compactAuthForm?: boolean;
1067
+ /** Always render the "Select authentication" dropdown, even when there are no
1068
+ * saved entries yet, so the UI does not switch between two different shapes. */
1069
+ alwaysShowAuthSelector?: boolean;
1070
+ /** Suppress the "Authentication saved" success toast (embedded flows that
1071
+ * already give their own feedback, e.g. the LLM provider config). */
1072
+ suppressSaveToast?: boolean;
1026
1073
  /** Render additional fields inside the expanded body, above the credential
1027
1074
  * inputs. The slot receives the live `localCredentials` and a `setField`
1028
1075
  * helper so its values are persisted as part of the auth on Save. */
@@ -1030,8 +1077,11 @@ interface AppAuthCardProps extends ShuffleHostProps {
1030
1077
  credentials: Record<string, string>;
1031
1078
  setField: (key: string, value: string) => void;
1032
1079
  }) => React.ReactNode;
1080
+ /** Known-ahead-of-time auth schema. When provided the fields render
1081
+ * instantly and no app-config request is made (no "Loading configuration"). */
1082
+ initialAuthConfig?: AppAuthentication;
1033
1083
  }
1034
- declare const AppAuthCard: ({ app, authState, isExpanded, onToggle, onAuthChange, onTestConnection, onSaveAuth, apiAuthEntries, onSelectAuth, onRefreshAuth, disableUrlPrefill, hideHeader, hideStatusChips, hideDocsLink, hideUrlFields, borderless, compactAuthForm, extraFieldsSlot, globalUrl, userdata, isLoaded, isLoggedIn, serverside, }: AppAuthCardProps) => React$1.JSX.Element;
1084
+ declare const AppAuthCard: ({ app, authState, isExpanded, onToggle, onAuthChange, onTestConnection, onSaveAuth, apiAuthEntries, onSelectAuth, onRefreshAuth, disableUrlPrefill, hideHeader, hideStatusChips, hideDocsLink, hideUrlFields, borderless, compactAuthForm, alwaysShowAuthSelector, suppressSaveToast, extraFieldsSlot, initialAuthConfig, globalUrl, userdata, isLoaded, isLoggedIn, serverside, }: AppAuthCardProps) => React$1.JSX.Element;
1035
1085
  declare const AppAuthConfig: ({ apps, authStates, authenticatedApps, onAuthChange, onTestConnection, onSaveAuth, onSelectAuth, onRefreshAuth, globalUrl, userdata, isLoaded, isLoggedIn, serverside, }: AppAuthConfigProps) => React$1.JSX.Element;
1036
1086
 
1037
1087
  /**
@@ -1221,7 +1271,7 @@ declare function useAppAuth(): {
1221
1271
  loading: boolean;
1222
1272
  handleAuthChange: (systemId: string, credentials: Record<string, string>) => void;
1223
1273
  handleTestConnection: (systemId: string, authenticationId?: string) => Promise<void>;
1224
- handleSaveAuth: (appId: string, credentials: Record<string, string>, appName?: string) => Promise<boolean>;
1274
+ handleSaveAuth: (appId: string, credentials: Record<string, string>, appName?: string, label?: string) => Promise<boolean>;
1225
1275
  refreshAuth: () => Promise<void>;
1226
1276
  };
1227
1277
 
@@ -1248,6 +1298,10 @@ declare const useSyncHostBaseUrl: (globalUrl: string | undefined | null) => void
1248
1298
  * scoped to a Shuffle backend origin) fails repeatedly inside a short window,
1249
1299
  * subsequent calls fail-fast with a synthetic 503 for a cooldown period.
1250
1300
  *
1301
+ * The breaker is "half-open": shortly after tripping it lets a single probe
1302
+ * request through. If that probe succeeds the endpoint is restored immediately
1303
+ * instead of staying blocked for the full cooldown.
1304
+ *
1251
1305
  * This is a safety net — components and hooks should still throttle / cache
1252
1306
  * their own requests. The breaker only kicks in when something has gone wrong
1253
1307
  * (a useEffect missing deps, a render loop, an unreachable backend).
@@ -1400,6 +1454,13 @@ declare const getDatastoreItem: (key: string, category: string, overrideOrgId?:
1400
1454
  declare const getDatastoreItemPublic: (key: string, orgId: string, authorization: string) => Promise<DatastoreResponse & {
1401
1455
  item?: DatastoreItem;
1402
1456
  }>;
1457
+ /**
1458
+ /**
1459
+ * Page size used for a category. Exported so callers that follow cursors can
1460
+ * tell a full page (more data may exist) from a short page (definitively the
1461
+ * last one) — the backend returns a cursor even on the final page.
1462
+ */
1463
+ declare const getDatastorePageSize: (category: string, limit?: number) => number;
1403
1464
  /**
1404
1465
  * Get all items in a category with optional cursor-based pagination
1405
1466
  */
@@ -1598,4 +1659,4 @@ declare const LocalLLMConfig: React__default.ComponentType<any>;
1598
1659
 
1599
1660
  declare const AddAppModal: React__default.ComponentType<any>;
1600
1661
 
1601
- export { AGENT_PRESETS, AGENT_PROMPT_PREFIX_CATEGORY, API_CONFIG, AddAppModal, type AddAppModalProps, AgentActivityList, type AgentActivityListProps, type AgentActivityParams, type AgentActivityResponse, type AgentDecision, AgentExecutionDrawer, type AgentExecutionDrawerProps, AgentIcon, type AgentLocalModel, type AgentPreset, AgentPresets, type AgentPresetsProps, AgentPromptPrefixChip, type AgentPromptPrefixChipProps, type AgentRun, AgentRunDiagnosisBanner, AgentRunDrawer, type AgentRunDrawerProps, type AgentRunDrawerTab, type AgentRunResult, AgentUI, type AgentUIApp, type AgentUIProps, AgentsView, type AgentsViewProps, AiAgentPromptsEditor, type AiAgentPromptsEditorProps, type AlgoliaSearchApp, type ApiAuthEntry, AppAuthCard, type AppAuthCardProps, AppAuthConfig, AppAuthSection, type AppAuthSectionProps, type AppAuthState, type AppAuthentication, AppDetailDrawer, AppDetailProvider, type AppLookupResult, AppSearchDrawer, type AppSelectedEvent, AppTitleHeader, type AppTitleHeaderProps, type AuthStatus, CASES_PATTERNS, COMMUNICATION_PATTERNS_NAMES, type CategoryAutomation, type CategoryConfig, type CustomStyles, DATASTORE_CATEGORIES, DEFAULT_AGENT_PROMPT_PREFIX, type DatastoreDiagnostics, type DatastoreItem, type DatastoreResponse, type DiagnosableRun, type DiagnosisEvidence, EDR_PATTERNS, EMAIL_APP_PATTERNS, FORWARD_TICKETS_WORKFLOW_NAME, type FetchAppsOptions, INGEST_TICKETS_WORKFLOW_NAME, type IngestionCategory, IntegrationStatus, LocalLLMConfig, type LocalLLMConfigProps, type LocalLLMTestResult, type OutputDiagnosis, type ResolvedApp, SIEM_PATTERNS, type ShuffleHostProps, ShuffleMCP, type ShuffleMCPHandle, type ShuffleMCPProps, type ShuffleMcpColorMode, ShuffleMcpThemeProvider, type ShuffleMcpThemeProviderProps, ShufflePipelinesBanner, type ShuffleTheme, SingulActionsPreview, THREAT_INTEL_PATTERNS, TryMcpSection, type TryMcpSectionProps, UsageBar, type UsageBarProps, type UseAgentPromptPrefixOptions, VULN_SCANNER_PATTERNS, type ValidatedIngestionApp, ShuffleMCP as default, deleteDatastoreItem, deleteDatastoreItems, diagnoseOutputWarning, extractActionAppNames, extractValidatedIngestionApps, extractWorkflowActionAppNames, extractWorkflowAppNames, fetchApps, fetchAppsViaApiConfig, findForwardTicketsWorkflow, findIngestTicketsWorkflow, getApiUrl, getAuthHeader, getDatastoreByCategory, getDatastoreItem, getDatastoreItemPublic, getFailureInfo, getHostBaseUrl, getIngestionCategory, hasOutputWarning, installFetchBreaker, invalidateAppsCache, invalidateResolvedApps, isCloud, isCloudDomain, isEmailApp, isIngestionApp, isOnprem, isThreatIntelApp, isVulnScannerApp, isWorkflowScheduleStopped, normalizeAppName, parseRunResult, refreshAllIntegrationStatus, registerProtectedOrigin, resetRegionUrl, resolveApp, resolveApps, scheduleAgentRun, searchAgentActivity, seedResolvedApp, setDatastoreItem, setDatastoreItems, setHostBaseUrl, setRegionUrl, setRuntimeOrgId, setToastImpl, shuffleFetch, toast, useAgentPromptPrefix, useAppAuth, useAppAuthFlow, useAppDetail, useAppDetailOptional, useAppLookup, useSyncHostBaseUrl };
1662
+ export { AGENT_PRESETS, AGENT_PROMPT_PREFIX_CATEGORY, API_CONFIG, AddAppModal, type AddAppModalProps, AgentActivityList, type AgentActivityListProps, type AgentActivityParams, type AgentActivityResponse, type AgentDecision, AgentExecutionDrawer, type AgentExecutionDrawerProps, AgentIcon, type AgentLocalModel, type AgentPreset, AgentPresets, type AgentPresetsProps, AgentPromptPrefixChip, type AgentPromptPrefixChipProps, type AgentRun, AgentRunDiagnosisBanner, AgentRunDrawer, type AgentRunDrawerProps, type AgentRunDrawerTab, type AgentRunResult, AgentUI, type AgentUIApp, type AgentUIProps, AgentsView, type AgentsViewProps, AiAgentPromptsEditor, type AiAgentPromptsEditorProps, type AlgoliaSearchApp, type ApiAuthEntry, AppAuthCard, type AppAuthCardProps, AppAuthConfig, AppAuthSection, type AppAuthSectionProps, type AppAuthState, type AppAuthentication$1 as AppAuthentication, AppDetailDrawer, AppDetailProvider, type AppLookupResult, AppSearchDrawer, type AppSelectedEvent, AppTitleHeader, type AppTitleHeaderProps, type AuthStatus, CASES_PATTERNS, COMMUNICATION_PATTERNS_NAMES, type CategoryAutomation, type CategoryConfig, type CustomStyles, DATASTORE_CATEGORIES, DEFAULT_AGENT_PROMPT_PREFIX, type DatastoreDiagnostics, type DatastoreItem, type DatastoreResponse, type DiagnosableRun, type DiagnosisEvidence, EDR_PATTERNS, EMAIL_APP_PATTERNS, FORWARD_TICKETS_WORKFLOW_NAME, type FetchAppsOptions, INGEST_TICKETS_WORKFLOW_NAME, type IngestionCategory, IntegrationStatus, LocalLLMConfig, type LocalLLMConfigProps, type LocalLLMTestResult, type OutputDiagnosis, type ResolvedApp, SIEM_PATTERNS, type ShuffleHostProps, ShuffleMCP, type ShuffleMCPHandle, type ShuffleMCPProps, type ShuffleMcpColorMode, ShuffleMcpThemeProvider, type ShuffleMcpThemeProviderProps, ShufflePipelinesBanner, type ShuffleTheme, SingulActionsPreview, THREAT_INTEL_PATTERNS, TryMcpSection, type TryMcpSectionProps, UsageBar, type UsageBarProps, type UseAgentPromptPrefixOptions, VULN_SCANNER_PATTERNS, type ValidatedIngestionApp, ShuffleMCP as default, deleteDatastoreItem, deleteDatastoreItems, diagnoseOutputWarning, extractActionAppNames, extractValidatedIngestionApps, extractWorkflowActionAppNames, extractWorkflowAppNames, fetchApps, fetchAppsViaApiConfig, findForwardTicketsWorkflow, findIngestTicketsWorkflow, getApiUrl, getAuthHeader, getDatastoreByCategory, getDatastoreItem, getDatastoreItemPublic, getDatastorePageSize, getFailureInfo, getHostBaseUrl, getIngestionCategory, hasOutputWarning, installFetchBreaker, invalidateAppsCache, invalidateResolvedApps, isCloud, isCloudDomain, isEmailApp, isIngestionApp, isOnprem, isThreatIntelApp, isVulnScannerApp, isWorkflowScheduleStopped, normalizeAppName, parseRunResult, refreshAllIntegrationStatus, registerProtectedOrigin, resetRegionUrl, resolveApp, resolveApps, scheduleAgentRun, searchAgentActivity, seedResolvedApp, setDatastoreItem, setDatastoreItems, setHostBaseUrl, setRegionUrl, setRuntimeOrgId, setToastImpl, shuffleFetch, toast, useAgentPromptPrefix, useAppAuth, useAppAuthFlow, useAppDetail, useAppDetailOptional, useAppLookup, useSyncHostBaseUrl };
package/dist/index.d.ts CHANGED
@@ -131,7 +131,7 @@ interface CustomStyles {
131
131
  checkbox?: React.CSSProperties;
132
132
  checkboxChecked?: React.CSSProperties;
133
133
  }
134
- interface AppAuthentication {
134
+ interface AppAuthentication$1 {
135
135
  app: {
136
136
  id: string;
137
137
  name: string;
@@ -212,7 +212,7 @@ interface ShuffleMCPProps extends ShuffleHostProps {
212
212
  /** Base URL for Singul API calls (default: https://singul.io) */
213
213
  singulBaseUrl?: string;
214
214
  /** Manually provided authenticated apps (used when apiKey is not provided) */
215
- authenticatedApps?: AppAuthentication[];
215
+ authenticatedApps?: AppAuthentication$1[];
216
216
  /** Hide the auth status chips (Configured/Not configured, Tested/Not tested) */
217
217
  hideAuthStatus?: boolean;
218
218
  /** Apps to pin at the top of the results (prepended, deduped by name). */
@@ -604,8 +604,9 @@ interface AgentPromptPrefixChipProps {
604
604
  declare const AgentPromptPrefixChip: ({ label, userId, value, onChange, onRemove, defaultPrompt, dialogTitle, readOnly, }: AgentPromptPrefixChipProps) => React$1.JSX.Element;
605
605
 
606
606
  declare const AGENT_PROMPT_PREFIX_CATEGORY = "agent-prompt-prefix";
607
- /** Default seed used until the user saves their own prefix. */
608
- declare const DEFAULT_AGENT_PROMPT_PREFIX = "You are the Shuffle Tools agent. Use the connected Shuffle tools to help me with the request that follows.";
607
+ /** Default seed used until the user saves their own prefix.
608
+ * Empty by default — the backend system prompt handles agent identity. */
609
+ declare const DEFAULT_AGENT_PROMPT_PREFIX = "";
609
610
  interface UseAgentPromptPrefixOptions {
610
611
  /** Storage key — typically the current user id. Falls back to `"default"`. */
611
612
  userId?: string;
@@ -641,7 +642,7 @@ interface AgentRunDrawerProps extends ShuffleHostProps {
641
642
  permissionsDisabledTooltip?: string;
642
643
  /** Forwarded to the embedded AgentUI (apiKey, apiBaseUrl, orgId, etc.). */
643
644
  agentUIProps?: Partial<AgentUIProps>;
644
- /** Drawer width override (default: 480 px on >=sm, full-width on xs). */
645
+ /** Drawer width override (default: 595 px on >=sm, full-width on xs). */
645
646
  width?: number;
646
647
  /** Header title. Default: "Agent". */
647
648
  title?: string;
@@ -807,6 +808,18 @@ declare const scheduleAgentRun: ({ cron, input, apps, onStep, apiKey, apiBaseUrl
807
808
  cron: string;
808
809
  }>;
809
810
 
811
+ /**
812
+ * A usecase-backed agent "type" surfaced in the run filter dropdown.
813
+ * Hosts supply only the usecases that are actually enabled for the tenant.
814
+ */
815
+ interface AgentUsecaseFilter {
816
+ /** Unique id (used as the menu value). */
817
+ id: string;
818
+ /** Menu label, e.g. "Incident Response Agent". */
819
+ label: string;
820
+ /** Case-insensitive substrings matched against run source/workflow metadata. */
821
+ matchTokens: string[];
822
+ }
810
823
  interface AgentActivityListProps extends ShuffleHostProps {
811
824
  /** Optional Shuffle API key. Falls back to the shared API_CONFIG. */
812
825
  apiKey?: string;
@@ -844,6 +857,8 @@ interface AgentActivityListProps extends ShuffleHostProps {
844
857
  toolbarSx?: SxProps<Theme>;
845
858
  /** Style overrides for each individual run row. */
846
859
  rowSx?: SxProps<Theme>;
860
+ /** Usecase-backed agent types shown in the run filter dropdown. */
861
+ usecaseFilters?: AgentUsecaseFilter[];
847
862
  }
848
863
 
849
864
  interface AgentExecutionDrawerProps extends ShuffleHostProps {
@@ -914,6 +929,8 @@ interface AgentsViewProps extends ShuffleHostProps {
914
929
  disableAppsPersistence?: boolean;
915
930
  /** Storage key for internal chip-row persistence. Defaults to `shuffle-agents-selected-apps`. */
916
931
  appsStorageKey?: string;
932
+ /** Usecase-backed agent types shown in the activity list filter dropdown. */
933
+ usecaseFilters?: AgentUsecaseFilter[];
917
934
  }
918
935
 
919
936
  interface AgentLocalModel {
@@ -964,6 +981,30 @@ interface AppAuthState {
964
981
  executionId?: string;
965
982
  errorCode?: number;
966
983
  }
984
+ interface AuthParameter {
985
+ description: string;
986
+ example: string;
987
+ id: string;
988
+ name: string;
989
+ required: boolean;
990
+ schema: {
991
+ type: string;
992
+ };
993
+ }
994
+ interface AppAuthentication {
995
+ type: string;
996
+ description?: string;
997
+ redirect_uri?: string;
998
+ token_uri?: string;
999
+ refresh_uri?: string;
1000
+ authorization_url?: string;
1001
+ auth_uri?: string;
1002
+ authorize_url?: string;
1003
+ scope?: string[];
1004
+ client_id?: string;
1005
+ client_secret?: string;
1006
+ parameters?: AuthParameter[];
1007
+ }
967
1008
  interface ApiAuthEntry {
968
1009
  id?: string;
969
1010
  label?: string;
@@ -1023,6 +1064,12 @@ interface AppAuthCardProps extends ShuffleHostProps {
1023
1064
  * credentials form (with the small "Test Authentication" CTA) is always
1024
1065
  * visible so users can edit & retest in one place. */
1025
1066
  compactAuthForm?: boolean;
1067
+ /** Always render the "Select authentication" dropdown, even when there are no
1068
+ * saved entries yet, so the UI does not switch between two different shapes. */
1069
+ alwaysShowAuthSelector?: boolean;
1070
+ /** Suppress the "Authentication saved" success toast (embedded flows that
1071
+ * already give their own feedback, e.g. the LLM provider config). */
1072
+ suppressSaveToast?: boolean;
1026
1073
  /** Render additional fields inside the expanded body, above the credential
1027
1074
  * inputs. The slot receives the live `localCredentials` and a `setField`
1028
1075
  * helper so its values are persisted as part of the auth on Save. */
@@ -1030,8 +1077,11 @@ interface AppAuthCardProps extends ShuffleHostProps {
1030
1077
  credentials: Record<string, string>;
1031
1078
  setField: (key: string, value: string) => void;
1032
1079
  }) => React.ReactNode;
1080
+ /** Known-ahead-of-time auth schema. When provided the fields render
1081
+ * instantly and no app-config request is made (no "Loading configuration"). */
1082
+ initialAuthConfig?: AppAuthentication;
1033
1083
  }
1034
- declare const AppAuthCard: ({ app, authState, isExpanded, onToggle, onAuthChange, onTestConnection, onSaveAuth, apiAuthEntries, onSelectAuth, onRefreshAuth, disableUrlPrefill, hideHeader, hideStatusChips, hideDocsLink, hideUrlFields, borderless, compactAuthForm, extraFieldsSlot, globalUrl, userdata, isLoaded, isLoggedIn, serverside, }: AppAuthCardProps) => React$1.JSX.Element;
1084
+ declare const AppAuthCard: ({ app, authState, isExpanded, onToggle, onAuthChange, onTestConnection, onSaveAuth, apiAuthEntries, onSelectAuth, onRefreshAuth, disableUrlPrefill, hideHeader, hideStatusChips, hideDocsLink, hideUrlFields, borderless, compactAuthForm, alwaysShowAuthSelector, suppressSaveToast, extraFieldsSlot, initialAuthConfig, globalUrl, userdata, isLoaded, isLoggedIn, serverside, }: AppAuthCardProps) => React$1.JSX.Element;
1035
1085
  declare const AppAuthConfig: ({ apps, authStates, authenticatedApps, onAuthChange, onTestConnection, onSaveAuth, onSelectAuth, onRefreshAuth, globalUrl, userdata, isLoaded, isLoggedIn, serverside, }: AppAuthConfigProps) => React$1.JSX.Element;
1036
1086
 
1037
1087
  /**
@@ -1221,7 +1271,7 @@ declare function useAppAuth(): {
1221
1271
  loading: boolean;
1222
1272
  handleAuthChange: (systemId: string, credentials: Record<string, string>) => void;
1223
1273
  handleTestConnection: (systemId: string, authenticationId?: string) => Promise<void>;
1224
- handleSaveAuth: (appId: string, credentials: Record<string, string>, appName?: string) => Promise<boolean>;
1274
+ handleSaveAuth: (appId: string, credentials: Record<string, string>, appName?: string, label?: string) => Promise<boolean>;
1225
1275
  refreshAuth: () => Promise<void>;
1226
1276
  };
1227
1277
 
@@ -1248,6 +1298,10 @@ declare const useSyncHostBaseUrl: (globalUrl: string | undefined | null) => void
1248
1298
  * scoped to a Shuffle backend origin) fails repeatedly inside a short window,
1249
1299
  * subsequent calls fail-fast with a synthetic 503 for a cooldown period.
1250
1300
  *
1301
+ * The breaker is "half-open": shortly after tripping it lets a single probe
1302
+ * request through. If that probe succeeds the endpoint is restored immediately
1303
+ * instead of staying blocked for the full cooldown.
1304
+ *
1251
1305
  * This is a safety net — components and hooks should still throttle / cache
1252
1306
  * their own requests. The breaker only kicks in when something has gone wrong
1253
1307
  * (a useEffect missing deps, a render loop, an unreachable backend).
@@ -1400,6 +1454,13 @@ declare const getDatastoreItem: (key: string, category: string, overrideOrgId?:
1400
1454
  declare const getDatastoreItemPublic: (key: string, orgId: string, authorization: string) => Promise<DatastoreResponse & {
1401
1455
  item?: DatastoreItem;
1402
1456
  }>;
1457
+ /**
1458
+ /**
1459
+ * Page size used for a category. Exported so callers that follow cursors can
1460
+ * tell a full page (more data may exist) from a short page (definitively the
1461
+ * last one) — the backend returns a cursor even on the final page.
1462
+ */
1463
+ declare const getDatastorePageSize: (category: string, limit?: number) => number;
1403
1464
  /**
1404
1465
  * Get all items in a category with optional cursor-based pagination
1405
1466
  */
@@ -1598,4 +1659,4 @@ declare const LocalLLMConfig: React__default.ComponentType<any>;
1598
1659
 
1599
1660
  declare const AddAppModal: React__default.ComponentType<any>;
1600
1661
 
1601
- export { AGENT_PRESETS, AGENT_PROMPT_PREFIX_CATEGORY, API_CONFIG, AddAppModal, type AddAppModalProps, AgentActivityList, type AgentActivityListProps, type AgentActivityParams, type AgentActivityResponse, type AgentDecision, AgentExecutionDrawer, type AgentExecutionDrawerProps, AgentIcon, type AgentLocalModel, type AgentPreset, AgentPresets, type AgentPresetsProps, AgentPromptPrefixChip, type AgentPromptPrefixChipProps, type AgentRun, AgentRunDiagnosisBanner, AgentRunDrawer, type AgentRunDrawerProps, type AgentRunDrawerTab, type AgentRunResult, AgentUI, type AgentUIApp, type AgentUIProps, AgentsView, type AgentsViewProps, AiAgentPromptsEditor, type AiAgentPromptsEditorProps, type AlgoliaSearchApp, type ApiAuthEntry, AppAuthCard, type AppAuthCardProps, AppAuthConfig, AppAuthSection, type AppAuthSectionProps, type AppAuthState, type AppAuthentication, AppDetailDrawer, AppDetailProvider, type AppLookupResult, AppSearchDrawer, type AppSelectedEvent, AppTitleHeader, type AppTitleHeaderProps, type AuthStatus, CASES_PATTERNS, COMMUNICATION_PATTERNS_NAMES, type CategoryAutomation, type CategoryConfig, type CustomStyles, DATASTORE_CATEGORIES, DEFAULT_AGENT_PROMPT_PREFIX, type DatastoreDiagnostics, type DatastoreItem, type DatastoreResponse, type DiagnosableRun, type DiagnosisEvidence, EDR_PATTERNS, EMAIL_APP_PATTERNS, FORWARD_TICKETS_WORKFLOW_NAME, type FetchAppsOptions, INGEST_TICKETS_WORKFLOW_NAME, type IngestionCategory, IntegrationStatus, LocalLLMConfig, type LocalLLMConfigProps, type LocalLLMTestResult, type OutputDiagnosis, type ResolvedApp, SIEM_PATTERNS, type ShuffleHostProps, ShuffleMCP, type ShuffleMCPHandle, type ShuffleMCPProps, type ShuffleMcpColorMode, ShuffleMcpThemeProvider, type ShuffleMcpThemeProviderProps, ShufflePipelinesBanner, type ShuffleTheme, SingulActionsPreview, THREAT_INTEL_PATTERNS, TryMcpSection, type TryMcpSectionProps, UsageBar, type UsageBarProps, type UseAgentPromptPrefixOptions, VULN_SCANNER_PATTERNS, type ValidatedIngestionApp, ShuffleMCP as default, deleteDatastoreItem, deleteDatastoreItems, diagnoseOutputWarning, extractActionAppNames, extractValidatedIngestionApps, extractWorkflowActionAppNames, extractWorkflowAppNames, fetchApps, fetchAppsViaApiConfig, findForwardTicketsWorkflow, findIngestTicketsWorkflow, getApiUrl, getAuthHeader, getDatastoreByCategory, getDatastoreItem, getDatastoreItemPublic, getFailureInfo, getHostBaseUrl, getIngestionCategory, hasOutputWarning, installFetchBreaker, invalidateAppsCache, invalidateResolvedApps, isCloud, isCloudDomain, isEmailApp, isIngestionApp, isOnprem, isThreatIntelApp, isVulnScannerApp, isWorkflowScheduleStopped, normalizeAppName, parseRunResult, refreshAllIntegrationStatus, registerProtectedOrigin, resetRegionUrl, resolveApp, resolveApps, scheduleAgentRun, searchAgentActivity, seedResolvedApp, setDatastoreItem, setDatastoreItems, setHostBaseUrl, setRegionUrl, setRuntimeOrgId, setToastImpl, shuffleFetch, toast, useAgentPromptPrefix, useAppAuth, useAppAuthFlow, useAppDetail, useAppDetailOptional, useAppLookup, useSyncHostBaseUrl };
1662
+ export { AGENT_PRESETS, AGENT_PROMPT_PREFIX_CATEGORY, API_CONFIG, AddAppModal, type AddAppModalProps, AgentActivityList, type AgentActivityListProps, type AgentActivityParams, type AgentActivityResponse, type AgentDecision, AgentExecutionDrawer, type AgentExecutionDrawerProps, AgentIcon, type AgentLocalModel, type AgentPreset, AgentPresets, type AgentPresetsProps, AgentPromptPrefixChip, type AgentPromptPrefixChipProps, type AgentRun, AgentRunDiagnosisBanner, AgentRunDrawer, type AgentRunDrawerProps, type AgentRunDrawerTab, type AgentRunResult, AgentUI, type AgentUIApp, type AgentUIProps, AgentsView, type AgentsViewProps, AiAgentPromptsEditor, type AiAgentPromptsEditorProps, type AlgoliaSearchApp, type ApiAuthEntry, AppAuthCard, type AppAuthCardProps, AppAuthConfig, AppAuthSection, type AppAuthSectionProps, type AppAuthState, type AppAuthentication$1 as AppAuthentication, AppDetailDrawer, AppDetailProvider, type AppLookupResult, AppSearchDrawer, type AppSelectedEvent, AppTitleHeader, type AppTitleHeaderProps, type AuthStatus, CASES_PATTERNS, COMMUNICATION_PATTERNS_NAMES, type CategoryAutomation, type CategoryConfig, type CustomStyles, DATASTORE_CATEGORIES, DEFAULT_AGENT_PROMPT_PREFIX, type DatastoreDiagnostics, type DatastoreItem, type DatastoreResponse, type DiagnosableRun, type DiagnosisEvidence, EDR_PATTERNS, EMAIL_APP_PATTERNS, FORWARD_TICKETS_WORKFLOW_NAME, type FetchAppsOptions, INGEST_TICKETS_WORKFLOW_NAME, type IngestionCategory, IntegrationStatus, LocalLLMConfig, type LocalLLMConfigProps, type LocalLLMTestResult, type OutputDiagnosis, type ResolvedApp, SIEM_PATTERNS, type ShuffleHostProps, ShuffleMCP, type ShuffleMCPHandle, type ShuffleMCPProps, type ShuffleMcpColorMode, ShuffleMcpThemeProvider, type ShuffleMcpThemeProviderProps, ShufflePipelinesBanner, type ShuffleTheme, SingulActionsPreview, THREAT_INTEL_PATTERNS, TryMcpSection, type TryMcpSectionProps, UsageBar, type UsageBarProps, type UseAgentPromptPrefixOptions, VULN_SCANNER_PATTERNS, type ValidatedIngestionApp, ShuffleMCP as default, deleteDatastoreItem, deleteDatastoreItems, diagnoseOutputWarning, extractActionAppNames, extractValidatedIngestionApps, extractWorkflowActionAppNames, extractWorkflowAppNames, fetchApps, fetchAppsViaApiConfig, findForwardTicketsWorkflow, findIngestTicketsWorkflow, getApiUrl, getAuthHeader, getDatastoreByCategory, getDatastoreItem, getDatastoreItemPublic, getDatastorePageSize, getFailureInfo, getHostBaseUrl, getIngestionCategory, hasOutputWarning, installFetchBreaker, invalidateAppsCache, invalidateResolvedApps, isCloud, isCloudDomain, isEmailApp, isIngestionApp, isOnprem, isThreatIntelApp, isVulnScannerApp, isWorkflowScheduleStopped, normalizeAppName, parseRunResult, refreshAllIntegrationStatus, registerProtectedOrigin, resetRegionUrl, resolveApp, resolveApps, scheduleAgentRun, searchAgentActivity, seedResolvedApp, setDatastoreItem, setDatastoreItems, setHostBaseUrl, setRegionUrl, setRuntimeOrgId, setToastImpl, shuffleFetch, toast, useAgentPromptPrefix, useAppAuth, useAppAuthFlow, useAppDetail, useAppDetailOptional, useAppLookup, useSyncHostBaseUrl };