@shuffleio/shuffle-mcps 0.0.10 → 0.0.12

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.d.cts CHANGED
@@ -599,6 +599,20 @@ interface AgentRunDrawerProps {
599
599
  }
600
600
  declare const AgentRunDrawer: ({ open, onClose, initialTab, permissionsSlot, localLLMSlot, localLLMTabBadge, permissionsDisabled, permissionsDisabledTooltip, agentUIProps, width, title, subtitle, className, paperSx, headerSx, tabsSx, bodySx, }: AgentRunDrawerProps) => react_jsx_runtime.JSX.Element;
601
601
 
602
+ /** Check if running on a known Shuffle Cloud domain */
603
+ declare const isCloudDomain: () => boolean;
604
+ /**
605
+ * True when running on Shuffle Cloud (a known *.shuffler.io / shutdown.no domain).
606
+ * Use this to gate cloud-only features like Google Analytics (ReactGA).
607
+ *
608
+ * isCloud() → cloud deployment, GA allowed, telemetry OK
609
+ * !isCloud() → either Lovable preview (dev) OR self-hosted onprem; do NOT call GA
610
+ */
611
+ declare const isCloud: () => boolean;
612
+ /**
613
+ * True when running self-hosted (onprem) — i.e. NOT in Lovable preview AND NOT on a known cloud domain.
614
+ */
615
+ declare const isOnprem: () => boolean;
602
616
  declare const API_CONFIG: {
603
617
  readonly baseUrl: string;
604
618
  version: string;
@@ -775,11 +789,12 @@ declare const AgentExecutionDrawer: ({ open, onClose, run, width, apiKey, apiBas
775
789
  * AgentUI's internal ExecutionData. */
776
790
  interface DiagnosableRun {
777
791
  status?: string;
792
+ result?: string;
778
793
  results?: Array<{
779
794
  result?: string;
780
795
  } | any> | null;
781
796
  }
782
- /** Try to parse the result JSON from results[0].result, unwrapping AGENT-type executions. */
797
+ /** Try to parse the agent result JSON, unwrapping AGENT-type executions. */
783
798
  declare const parseRunResult: (run: DiagnosableRun) => {
784
799
  raw: string | null;
785
800
  parsed: any | null;
@@ -800,7 +815,7 @@ type DiagnosisEvidence = {
800
815
  value: string;
801
816
  };
802
817
  type OutputDiagnosis = {
803
- kind: 'auth' | 'permission' | 'not_found' | 'rate_limit' | 'network' | 'validation' | 'generic';
818
+ kind: 'auth' | 'permission' | 'not_found' | 'rate_limit' | 'token_limit' | 'network' | 'validation' | 'generic';
804
819
  status?: number;
805
820
  title: string;
806
821
  explanation: string;
@@ -922,10 +937,16 @@ interface IntegrationStatusProps {
922
937
  hideHeader?: boolean;
923
938
  /** When set, apps matching this category are sorted to the top */
924
939
  priorityCategory?: string;
940
+ /** Extra apps to merge in (e.g. apps selected in onboarding but not yet activated). Merged by name (case-insensitive) — not duplicated if already present. */
941
+ extraApps?: {
942
+ id: string;
943
+ name: string;
944
+ icon?: string;
945
+ }[];
925
946
  }
926
947
  /** Fire this event from anywhere to make all IntegrationStatus instances re-fetch. */
927
948
  declare const refreshAllIntegrationStatus: () => void;
928
- declare const IntegrationStatus: ({ collapsed, filterApps, onAddClick, iconSize, onDisable, disabledApps, showAll, hideAddButton, hideHeader, priorityCategory }: IntegrationStatusProps) => react_jsx_runtime.JSX.Element;
949
+ declare const IntegrationStatus: ({ collapsed, filterApps, onAddClick, iconSize, onDisable, disabledApps, showAll, hideAddButton, hideHeader, priorityCategory, extraApps }: IntegrationStatusProps) => react_jsx_runtime.JSX.Element;
929
950
 
930
951
  type AuthStatus = 'pending' | 'testing' | 'connected' | 'error';
931
952
  interface AppAuthState {
@@ -956,6 +977,39 @@ interface ApiAuthEntry {
956
977
  last_valid?: number;
957
978
  };
958
979
  }
980
+ interface AppAuthConfigProps {
981
+ apps: AlgoliaSearchApp[];
982
+ authStates: Record<string, AppAuthState>;
983
+ authenticatedApps?: ApiAuthEntry[];
984
+ onAuthChange: (appId: string, credentials: Record<string, string>) => void;
985
+ onTestConnection: (appId: string, authenticationId?: string) => void;
986
+ onSaveAuth: (appId: string, credentials: Record<string, string>) => Promise<boolean>;
987
+ onSelectAuth?: (appId: string, authId: string) => void;
988
+ onRefreshAuth?: () => Promise<void> | void;
989
+ }
990
+ interface AppAuthCardProps {
991
+ app: AlgoliaSearchApp;
992
+ authState: AppAuthState;
993
+ isExpanded: boolean;
994
+ onToggle: () => void;
995
+ onAuthChange: (appId: string, credentials: Record<string, string>) => void;
996
+ onTestConnection: (appId: string, authenticationId?: string) => void;
997
+ onSaveAuth: (appId: string, credentials: Record<string, string>) => Promise<boolean>;
998
+ apiAuthEntries: ApiAuthEntry[];
999
+ onSelectAuth?: (appId: string, authId: string) => void;
1000
+ /** Called to refresh auth entries (e.g. after OAuth popup closes) */
1001
+ onRefreshAuth?: () => Promise<void> | void;
1002
+ /** When true, do NOT auto-fill URL fields with the param.example value. */
1003
+ disableUrlPrefill?: boolean;
1004
+ /** Hide the entire card header row (app icon, name, description, chips, docs, expand). Body stays expanded. */
1005
+ hideHeader?: boolean;
1006
+ /** Hide the "Configured / Not configured" and "Tested / Not tested" chips. */
1007
+ hideStatusChips?: boolean;
1008
+ /** Hide the documentation (book icon) link. */
1009
+ hideDocsLink?: boolean;
1010
+ }
1011
+ declare const AppAuthCard: ({ app, authState, isExpanded, onToggle, onAuthChange, onTestConnection, onSaveAuth, apiAuthEntries, onSelectAuth, onRefreshAuth, disableUrlPrefill, hideHeader, hideStatusChips, hideDocsLink, }: AppAuthCardProps) => react_jsx_runtime.JSX.Element;
1012
+ declare const AppAuthConfig: ({ apps, authStates, authenticatedApps, onAuthChange, onTestConnection, onSaveAuth, onSelectAuth, onRefreshAuth, }: AppAuthConfigProps) => react_jsx_runtime.JSX.Element;
959
1013
 
960
1014
  declare function useAppAuth(): {
961
1015
  authStates: Record<string, AppAuthState>;
@@ -977,6 +1031,8 @@ declare const AppDetailProvider: ({ children }: {
977
1031
  children: ReactNode;
978
1032
  }) => react_jsx_runtime.JSX.Element;
979
1033
  declare const useAppDetail: () => AppDetailContextType;
1034
+ /** Safe variant: returns null if no provider is mounted. Useful for components used both inside and outside the dashboard. */
1035
+ declare const useAppDetailOptional: () => AppDetailContextType;
980
1036
 
981
1037
  /**
982
1038
  * Tiny toast facade — library version. Mirrors the sonner-style surface
@@ -1004,4 +1060,235 @@ type ToastApi = ((arg: ToastArg, opts?: ToastOptions) => void) & {
1004
1060
  };
1005
1061
  declare const toast: ToastApi;
1006
1062
 
1007
- export { API_CONFIG, AgentActivityList, type AgentActivityListProps, type AgentActivityParams, type AgentActivityResponse, type AgentDecision, AgentExecutionDrawer, type AgentExecutionDrawerProps, type AgentRun, AgentRunDiagnosisBanner, AgentRunDrawer, type AgentRunDrawerProps, type AgentRunDrawerTab, type AgentRunResult, AgentUI, type AgentUIApp, type AgentUIProps, type AlgoliaSearchApp, AppAuthSection, type AppAuthSectionProps, type AppAuthentication, AppDetailDrawer, AppDetailProvider, type AppLookupResult, AppSearchDrawer, type AppSelectedEvent, AppTitleHeader, type AppTitleHeaderProps, type CustomStyles, type DiagnosableRun, type DiagnosisEvidence, IntegrationStatus, type OutputDiagnosis, type ResolvedApp, ShuffleMCP, type ShuffleMCPHandle, type ShuffleMCPProps, ShufflePipelinesBanner, SingulActionsPreview, TryMcpSection, type TryMcpSectionProps, ShuffleMCP as default, diagnoseOutputWarning, getApiUrl, getAuthHeader, getFailureInfo, hasOutputWarning, invalidateResolvedApps, parseRunResult, refreshAllIntegrationStatus, resolveApp, resolveApps, searchAgentActivity, seedResolvedApp, setToastImpl, toast, useAppAuth, useAppDetail, useAppLookup };
1063
+ interface AgentIconProps {
1064
+ size?: number;
1065
+ className?: string;
1066
+ style?: React.CSSProperties;
1067
+ }
1068
+ /**
1069
+ * Renders the Singul agent icon — use this everywhere instead of 🤖.
1070
+ */
1071
+ declare const AgentIcon: ({ size, className, style }: AgentIconProps) => react_jsx_runtime.JSX.Element;
1072
+
1073
+ /**
1074
+ * Shuffle Datastore Service
1075
+ *
1076
+ * Provides reusable functions for interacting with the Shuffle datastore API.
1077
+ * Uses the correct Shuffle cache API endpoints.
1078
+ */
1079
+ interface DatastoreItem {
1080
+ key: string;
1081
+ value: string;
1082
+ category: string;
1083
+ created?: number;
1084
+ edited?: number;
1085
+ public_authorization?: string;
1086
+ enrichments?: Array<{
1087
+ type: string;
1088
+ value?: string;
1089
+ data?: string;
1090
+ }>;
1091
+ }
1092
+ interface CategoryAutomation {
1093
+ id?: string;
1094
+ name: string;
1095
+ type?: 'workflow' | 'webhook' | 'ai_agent' | 'enrich' | 'send_message' | 'security_rules';
1096
+ trigger?: 'on_create' | 'on_edit' | 'on_delete';
1097
+ workflow_id?: string;
1098
+ webhook_url?: string;
1099
+ enabled: boolean;
1100
+ description?: string;
1101
+ options?: {
1102
+ key: string;
1103
+ value: string;
1104
+ }[];
1105
+ }
1106
+ interface CategoryConfig {
1107
+ id: string;
1108
+ org_id: string;
1109
+ category: string;
1110
+ automations: CategoryAutomation[] | null;
1111
+ settings: {
1112
+ timeout: number;
1113
+ public: boolean;
1114
+ };
1115
+ }
1116
+ interface DatastoreResponse {
1117
+ success: boolean;
1118
+ data?: DatastoreItem[];
1119
+ categoryConfig?: CategoryConfig;
1120
+ cursor?: string;
1121
+ totalAmount?: number;
1122
+ error?: string;
1123
+ diagnostics?: DatastoreDiagnostics;
1124
+ }
1125
+ interface DatastoreDiagnostics {
1126
+ operation: string;
1127
+ category?: string;
1128
+ orgId?: string | null;
1129
+ url?: string;
1130
+ cursor?: string;
1131
+ status?: number;
1132
+ statusText?: string;
1133
+ contentType?: string | null;
1134
+ responseShape?: 'array' | 'keys' | 'data' | 'unknown';
1135
+ itemCount?: number;
1136
+ totalAmount?: number | null;
1137
+ bodyPreview?: string;
1138
+ errorStage?: 'request' | 'response' | 'parse' | 'unknown';
1139
+ timestamp: string;
1140
+ }
1141
+ declare const setRuntimeOrgId: (orgId: string | null) => void;
1142
+ /**
1143
+ * Set a single item in the datastore
1144
+ */
1145
+ declare const setDatastoreItem: (key: string, value: string | object, category: string, overrideOrgId?: string) => Promise<DatastoreResponse>;
1146
+ /**
1147
+ * Set multiple items in the datastore (bulk create) using v2 API
1148
+ */
1149
+ declare const setDatastoreItems: (items: {
1150
+ key: string;
1151
+ value: string | object;
1152
+ }[], category: string) => Promise<DatastoreResponse>;
1153
+ /**
1154
+ * Get a single item from the datastore
1155
+ */
1156
+ declare const getDatastoreItem: (key: string, category: string, overrideOrgId?: string) => Promise<DatastoreResponse & {
1157
+ item?: DatastoreItem;
1158
+ }>;
1159
+ /**
1160
+ * Get a single item from the datastore using public authorization (no login required)
1161
+ */
1162
+ declare const getDatastoreItemPublic: (key: string, orgId: string, authorization: string) => Promise<DatastoreResponse & {
1163
+ item?: DatastoreItem;
1164
+ }>;
1165
+ /**
1166
+ * Get all items in a category with optional cursor-based pagination
1167
+ */
1168
+ declare const getDatastoreByCategory: (category: string, cursor?: string, limit?: number) => Promise<DatastoreResponse>;
1169
+ /**
1170
+ * Delete a single item from the datastore
1171
+ */
1172
+ declare const deleteDatastoreItem: (key: string, category: string, overrideOrgId?: string) => Promise<DatastoreResponse>;
1173
+ /**
1174
+ * Delete multiple items from the datastore (bulk delete)
1175
+ */
1176
+ declare const deleteDatastoreItems: (keys: string[], category: string) => Promise<{
1177
+ success: boolean;
1178
+ deleted: number;
1179
+ failed: string[];
1180
+ error?: string;
1181
+ }>;
1182
+ declare const DATASTORE_CATEGORIES: {
1183
+ readonly INCIDENTS: "shuffle-security_incidents";
1184
+ readonly ASSETS: "shuffle-security_assets";
1185
+ readonly TEMPLATES: "shuffle-security_templates";
1186
+ readonly CONFIGURATION: "shuffle-security_configuration";
1187
+ readonly IOCS: "shuffle-security_ioc-config";
1188
+ readonly CUSTOM_FIELDS: "shuffle-security_custom-fields";
1189
+ readonly THREAT_FEEDS: "shuffle-security_threat-feeds";
1190
+ readonly INFRASTRUCTURE: "shuffle-security_infrastructure";
1191
+ readonly USERS: "shuffle-security_users";
1192
+ readonly REPORTS: "shuffle-security_reports";
1193
+ readonly LEGACY_ALERTS: "shuffle-security_alerts";
1194
+ readonly LEGACY_CASES: "shuffle-security_cases";
1195
+ };
1196
+
1197
+ /**
1198
+ * Shared app category detection utilities.
1199
+ * Used by onboarding (AutomationConfig) and incident automations (CategoryAutomationsDialog).
1200
+ */
1201
+ declare const EMAIL_APP_PATTERNS: string[];
1202
+ declare const CASES_PATTERNS: string[];
1203
+ declare const EDR_PATTERNS: string[];
1204
+ declare const SIEM_PATTERNS: string[];
1205
+ declare const THREAT_INTEL_PATTERNS: string[];
1206
+ declare const COMMUNICATION_PATTERNS_NAMES: string[];
1207
+ declare const VULN_SCANNER_PATTERNS: string[];
1208
+ declare const isEmailApp: (appName: string) => boolean;
1209
+ declare const isThreatIntelApp: (appName: string) => boolean;
1210
+ declare const isVulnScannerApp: (appName: string) => boolean;
1211
+ declare const isIngestionApp: (appName: string) => boolean;
1212
+ type IngestionCategory = 'email' | 'cases' | 'edr' | 'siem' | 'other';
1213
+ declare const normalizeAppName: (name: string) => string;
1214
+ declare const getIngestionCategory: (appName: string, appCategories?: string[]) => IngestionCategory | null;
1215
+ /** Name of the workflow that powers automatic ingestion */
1216
+ declare const INGEST_TICKETS_WORKFLOW_NAME = "Ingest Tickets";
1217
+ /** Name of the workflow that powers forward tickets */
1218
+ declare const FORWARD_TICKETS_WORKFLOW_NAME = "Forward Tickets";
1219
+ /**
1220
+ * Extract normalized app names from a workflow's actions.
1221
+ * Returns a Set of normalized app names found in the workflow.
1222
+ */
1223
+ declare function extractWorkflowAppNames(workflow: any): Set<string>;
1224
+ /**
1225
+ * Find the 'Ingest Tickets' workflow from a list of workflows.
1226
+ * Returns the workflow object or null.
1227
+ */
1228
+ declare function findIngestTicketsWorkflow(workflows: any[]): any | null;
1229
+ /**
1230
+ * Check if a workflow's schedule/trigger is stopped.
1231
+ * Returns true if all triggers are stopped or the workflow has no triggers.
1232
+ */
1233
+ declare function isWorkflowScheduleStopped(workflow: any): boolean;
1234
+ /**
1235
+ * Find the 'Forward Tickets' workflow from a list of workflows.
1236
+ * Returns the workflow object or null.
1237
+ */
1238
+ declare function findForwardTicketsWorkflow(workflows: any[]): any | null;
1239
+ interface ValidatedIngestionApp {
1240
+ id: string;
1241
+ name: string;
1242
+ image?: string;
1243
+ validated: boolean;
1244
+ enabled: boolean;
1245
+ category: IngestionCategory;
1246
+ }
1247
+ /**
1248
+ * Extract validated apps from the raw /api/v1/apps/authentication response.
1249
+ * Returns deduplicated apps that have valid authentication.
1250
+ *
1251
+ * Enablement is determined by whether the app appears in the
1252
+ * 'Ingest Tickets' workflow's actions (workflows are the source of truth).
1253
+ *
1254
+ * @param authApiResponse - Raw response from /api/v1/apps/authentication
1255
+ * @param workflowAppNames - Set of normalized app names from the Ingest Tickets workflow actions
1256
+ */
1257
+ declare function extractValidatedIngestionApps(authApiResponse: any[], workflowAppNames?: Set<string>): ValidatedIngestionApp[];
1258
+
1259
+ /**
1260
+ * Shared, request-coalescing fetcher for `/api/v1/apps`.
1261
+ *
1262
+ * The demo page (and the real app) renders many components that each need
1263
+ * the user's apps list — `ShuffleMCP`, `AgentUI`, `AppDetailDrawer`,
1264
+ * `useAppLookup`, `IntegrationStatus`. Without coordination they fire 5+
1265
+ * identical `/api/v1/apps` requests on mount.
1266
+ *
1267
+ * This module mirrors `authenticatedApps.ts`:
1268
+ * 1. Coalesces concurrent in-flight calls into a single Promise.
1269
+ * 2. Caches the resolved JSON for a short TTL.
1270
+ * 3. Exposes `invalidateAppsCache()` for callers that mutate apps.
1271
+ *
1272
+ * The cache key includes baseUrl + path + apiKey + orgId so multi-tenant /
1273
+ * multi-region setups stay isolated.
1274
+ */
1275
+ interface FetchAppsOptions {
1276
+ baseUrl: string;
1277
+ path?: string;
1278
+ apiKey?: string | null;
1279
+ orgId?: string | null;
1280
+ }
1281
+ /**
1282
+ * Get the apps list. Returns the cached value if it is still within the
1283
+ * TTL; otherwise fires (or joins) a single network request.
1284
+ */
1285
+ declare const fetchApps: (opts: FetchAppsOptions) => Promise<any[]>;
1286
+ /** Invalidate the cached entry for one (or all) keys. */
1287
+ declare const invalidateAppsCache: (opts?: FetchAppsOptions) => void;
1288
+ /**
1289
+ * Convenience wrapper for callers that already use API_CONFIG / getAuthHeader.
1290
+ * Coalesces against the same cache as `fetchApps`.
1291
+ */
1292
+ declare const fetchAppsViaApiConfig: () => Promise<any[]>;
1293
+
1294
+ export { API_CONFIG, AgentActivityList, type AgentActivityListProps, type AgentActivityParams, type AgentActivityResponse, type AgentDecision, AgentExecutionDrawer, type AgentExecutionDrawerProps, AgentIcon, type AgentRun, AgentRunDiagnosisBanner, AgentRunDrawer, type AgentRunDrawerProps, type AgentRunDrawerTab, type AgentRunResult, AgentUI, type AgentUIApp, type AgentUIProps, 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, 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, type OutputDiagnosis, type ResolvedApp, SIEM_PATTERNS, ShuffleMCP, type ShuffleMCPHandle, type ShuffleMCPProps, ShufflePipelinesBanner, SingulActionsPreview, THREAT_INTEL_PATTERNS, TryMcpSection, type TryMcpSectionProps, VULN_SCANNER_PATTERNS, type ValidatedIngestionApp, ShuffleMCP as default, deleteDatastoreItem, deleteDatastoreItems, diagnoseOutputWarning, extractValidatedIngestionApps, extractWorkflowAppNames, fetchApps, fetchAppsViaApiConfig, findForwardTicketsWorkflow, findIngestTicketsWorkflow, getApiUrl, getAuthHeader, getDatastoreByCategory, getDatastoreItem, getDatastoreItemPublic, getFailureInfo, getIngestionCategory, hasOutputWarning, invalidateAppsCache, invalidateResolvedApps, isCloud, isCloudDomain, isEmailApp, isIngestionApp, isOnprem, isThreatIntelApp, isVulnScannerApp, isWorkflowScheduleStopped, normalizeAppName, parseRunResult, refreshAllIntegrationStatus, resolveApp, resolveApps, searchAgentActivity, seedResolvedApp, setDatastoreItem, setDatastoreItems, setRuntimeOrgId, setToastImpl, toast, useAppAuth, useAppDetail, useAppDetailOptional, useAppLookup };