@shuffleio/shuffle-mcps 0.0.5 → 0.0.7

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
@@ -196,6 +196,9 @@ interface AppDetailDrawerProps {
196
196
  onClose: () => void;
197
197
  /** App name to load */
198
198
  appName: string | null;
199
+ /** Pre-resolved Algolia objectID — bypasses Algolia lookup when provided (e.g. when the
200
+ * caller already had the hit, like AppSearchDrawer / "Add Ingestion Source"). */
201
+ appId?: string | null;
199
202
  /** Anchor side */
200
203
  anchor?: 'left' | 'right';
201
204
  /** Width in px */
@@ -214,7 +217,7 @@ interface AppDetailDrawerProps {
214
217
  * an `Org-Id` header is injected into the Singul curl preview. */
215
218
  activeOrgId?: string | null;
216
219
  }
217
- declare function AppDetailDrawer({ open, onClose, appName, anchor, width, onRefresh, onAddToCanvas, isAuthenticated, activeOrgId, }: AppDetailDrawerProps): react_jsx_runtime.JSX.Element;
220
+ declare function AppDetailDrawer({ open, onClose, appName, appId, anchor, width, onRefresh, onAddToCanvas, isAuthenticated, activeOrgId, }: AppDetailDrawerProps): react_jsx_runtime.JSX.Element;
218
221
 
219
222
  /**
220
223
  * AppSearchDrawer — Reusable drawer for searching apps.
@@ -362,6 +365,115 @@ declare const SingulActionsPreview: ({ appName, categories, activeOrgId, }: {
362
365
  activeOrgId?: string | null;
363
366
  }) => react_jsx_runtime.JSX.Element;
364
367
 
368
+ /**
369
+ * AgentUI — Standalone "start + debug agents" surface.
370
+ *
371
+ * TypeScript port and modernization of the legacy Shuffle Core
372
+ * `AgentUI.jsx`. One component, two modes:
373
+ *
374
+ * 1. **Starter** — large hero prompt ("What do you want to do?")
375
+ * with attached MCP/app chips. Submits to `/api/v1/agent`.
376
+ * 2. **Debugger** — compact header + decision timeline driven by
377
+ * `/api/v1/streams/results`, with question/continuation forms
378
+ * and per-decision raw-JSON inspection.
379
+ *
380
+ * Mode switches automatically when an execution is started or when
381
+ * `?execution_id=...&authorization=...` is present in the URL.
382
+ *
383
+ * Self-contained: uses {@link AppSearchDrawer} for app picking,
384
+ * {@link runAgent} for the JSON-RPC call, and the library's
385
+ * {@link toast} facade for notifications.
386
+ */
387
+
388
+ interface AgentUIApp {
389
+ /** App slug, e.g. "http", "shuffle_tools", "gmail". */
390
+ name: string;
391
+ /** Algolia objectID / Shuffle app id (preferred). */
392
+ id?: string;
393
+ /** Optional preview icon URL. */
394
+ icon?: string;
395
+ }
396
+ interface AgentUIProps {
397
+ /** Controlled list of apps. When provided, overrides defaultApps and disables auto-load. */
398
+ apps?: AgentUIApp[];
399
+ /** Initial chip set under the prompt. Used only when `apps` is not provided. */
400
+ defaultApps?: AgentUIApp[];
401
+ /**
402
+ * When true (default) and neither `apps` nor `defaultApps` is provided, fetch the
403
+ * caller's authenticated apps via `/api/v1/apps/authentication` (requires an API
404
+ * token to be set on `API_CONFIG`).
405
+ */
406
+ autoLoadApps?: boolean;
407
+ /** Hero title above the prompt. */
408
+ title?: string;
409
+ /** Optional subtitle/description shown under the title. */
410
+ subtitle?: React$1.ReactNode;
411
+ /** Placeholder shown in the empty prompt. */
412
+ placeholder?: string;
413
+ /** Pre-fill the prompt with this text. */
414
+ defaultInput?: string;
415
+ /** Submit immediately on mount when `defaultInput` is provided. */
416
+ autoSubmit?: boolean;
417
+ /** Hide the centered hero icon (compact mode). */
418
+ hideHeroIcon?: boolean;
419
+ /** Replace the default AgentIcon with a custom node (e.g. brand logo). */
420
+ heroIcon?: React$1.ReactNode;
421
+ /** Pixel size of the hero icon container. Default 84. */
422
+ heroIconSize?: number;
423
+ /** Maximum width of the centered card. */
424
+ maxWidth?: number;
425
+ /** Compact mode: hides the hero icon, shrinks padding. */
426
+ compact?: boolean;
427
+ /** Hide the "Select Apps / MCPs" chip row entirely. */
428
+ hideAppPicker?: boolean;
429
+ /** Hide the paperclip image-attachment button. */
430
+ hideAttach?: boolean;
431
+ /** Label on the "Select Apps / MCPs" chip. */
432
+ appPickerLabel?: string;
433
+ /** Title on the AppSearchDrawer. */
434
+ appPickerTitle?: string;
435
+ /** Subtitle on the AppSearchDrawer. */
436
+ appPickerSubtitle?: string;
437
+ /** Tooltip on the submit button. Default: "⌘+Enter to send". */
438
+ submitTooltip?: string;
439
+ /** Custom icon for the submit button. */
440
+ submitIcon?: React$1.ReactNode;
441
+ /** Placeholder for the post-finish continuation field. */
442
+ continuationPlaceholder?: string;
443
+ /** Read `?execution_id` & `?authorization` from window URL on mount. */
444
+ readUrlParams?: boolean;
445
+ /**
446
+ * Optional explicit execution to attach to on mount. Overrides URL params
447
+ * and skips the starter — useful when embedding to monitor a known run.
448
+ */
449
+ executionId?: string;
450
+ /** Authorization token paired with `executionId`. */
451
+ authorization?: string;
452
+ /** Called whenever a run finishes (success or failure). */
453
+ onRun?: (info: {
454
+ input: string;
455
+ success: boolean;
456
+ executionId?: string;
457
+ error?: string;
458
+ }) => void;
459
+ /**
460
+ * Optional Shuffle API key. When provided, all `/api/v1/*` calls made by
461
+ * this component (agent run, polling, app autoload, icon fallback) use it
462
+ * via `Authorization: Bearer <apiKey>`. When omitted, falls back to the
463
+ * shared `API_CONFIG` (browser session / `localStorage.shuffle_api_key`).
464
+ */
465
+ apiKey?: string;
466
+ /**
467
+ * Optional Shuffle backend base URL (e.g. `https://shuffler.io`). When
468
+ * omitted, falls back to the shared `API_CONFIG.baseUrl`. Useful when
469
+ * embedding `AgentUI` inside another app that targets a different region.
470
+ */
471
+ apiBaseUrl?: string;
472
+ /** Optional Shuffle Org ID — sent as the `Org-Id` header on every call. */
473
+ orgId?: string;
474
+ }
475
+ declare const AgentUI: React$1.FC<AgentUIProps>;
476
+
365
477
  /**
366
478
  * useAppLookup — Resolve an app's display name, image, categories,
367
479
  * canonical Algolia objectID and matching auth entries from just
@@ -484,16 +596,29 @@ declare const getApiUrl: (endpoint: string) => string;
484
596
  declare const getAuthHeader: (overrideOrgId?: string | null) => Record<string, string>;
485
597
 
486
598
  /**
487
- * Tiny toast facade — library version. The host app can replace this by
488
- * setting a custom impl via setToastImpl(). Falls back to console.warn.
599
+ * Tiny toast facade — library version. Mirrors the sonner-style surface
600
+ * (`toast(...)`, `toast.success`, `toast.error`, `toast.info`, `toast.warning`)
601
+ * plus the legacy `{ title, description, variant }` shape used elsewhere in
602
+ * the host app. The host app can replace the impl via `setToastImpl()`.
489
603
  */
490
- type ToastArg = {
604
+ type Variant = 'default' | 'destructive' | 'success' | 'error' | 'info' | 'warning';
605
+ type ToastArg = string | {
491
606
  title?: string;
492
607
  description?: string;
493
- variant?: 'default' | 'destructive';
608
+ variant?: Variant;
609
+ };
610
+ type ToastOptions = {
611
+ description?: string;
612
+ [key: string]: unknown;
613
+ };
614
+ type ToastImpl = (arg: ToastArg, opts?: ToastOptions) => void;
615
+ declare function setToastImpl(fn: ToastImpl): void;
616
+ type ToastApi = ((arg: ToastArg, opts?: ToastOptions) => void) & {
617
+ success: (msg: string, opts?: ToastOptions) => void;
618
+ error: (msg: string, opts?: ToastOptions) => void;
619
+ info: (msg: string, opts?: ToastOptions) => void;
620
+ warning: (msg: string, opts?: ToastOptions) => void;
494
621
  };
495
- type ToastFn = (arg: ToastArg) => void;
496
- declare function setToastImpl(fn: ToastFn): void;
497
- declare const toast: ToastFn;
622
+ declare const toast: ToastApi;
498
623
 
499
- export { API_CONFIG, type AlgoliaSearchApp, AppAuthSection, type AppAuthSectionProps, type AppAuthentication, AppDetailDrawer, AppDetailProvider, type AppLookupResult, AppSearchDrawer, type AppSelectedEvent, AppTitleHeader, type AppTitleHeaderProps, type CustomStyles, IntegrationStatus, ShuffleMCP, type ShuffleMCPHandle, type ShuffleMCPProps, ShufflePipelinesBanner, SingulActionsPreview, TryMcpSection, type TryMcpSectionProps, ShuffleMCP as default, getApiUrl, getAuthHeader, refreshAllIntegrationStatus, setToastImpl, toast, useAppAuth, useAppDetail, useAppLookup };
624
+ export { API_CONFIG, AgentUI, type AgentUIApp, type AgentUIProps, type AlgoliaSearchApp, AppAuthSection, type AppAuthSectionProps, type AppAuthentication, AppDetailDrawer, AppDetailProvider, type AppLookupResult, AppSearchDrawer, type AppSelectedEvent, AppTitleHeader, type AppTitleHeaderProps, type CustomStyles, IntegrationStatus, ShuffleMCP, type ShuffleMCPHandle, type ShuffleMCPProps, ShufflePipelinesBanner, SingulActionsPreview, TryMcpSection, type TryMcpSectionProps, ShuffleMCP as default, getApiUrl, getAuthHeader, refreshAllIntegrationStatus, setToastImpl, toast, useAppAuth, useAppDetail, useAppLookup };
package/dist/index.d.ts CHANGED
@@ -196,6 +196,9 @@ interface AppDetailDrawerProps {
196
196
  onClose: () => void;
197
197
  /** App name to load */
198
198
  appName: string | null;
199
+ /** Pre-resolved Algolia objectID — bypasses Algolia lookup when provided (e.g. when the
200
+ * caller already had the hit, like AppSearchDrawer / "Add Ingestion Source"). */
201
+ appId?: string | null;
199
202
  /** Anchor side */
200
203
  anchor?: 'left' | 'right';
201
204
  /** Width in px */
@@ -214,7 +217,7 @@ interface AppDetailDrawerProps {
214
217
  * an `Org-Id` header is injected into the Singul curl preview. */
215
218
  activeOrgId?: string | null;
216
219
  }
217
- declare function AppDetailDrawer({ open, onClose, appName, anchor, width, onRefresh, onAddToCanvas, isAuthenticated, activeOrgId, }: AppDetailDrawerProps): react_jsx_runtime.JSX.Element;
220
+ declare function AppDetailDrawer({ open, onClose, appName, appId, anchor, width, onRefresh, onAddToCanvas, isAuthenticated, activeOrgId, }: AppDetailDrawerProps): react_jsx_runtime.JSX.Element;
218
221
 
219
222
  /**
220
223
  * AppSearchDrawer — Reusable drawer for searching apps.
@@ -362,6 +365,115 @@ declare const SingulActionsPreview: ({ appName, categories, activeOrgId, }: {
362
365
  activeOrgId?: string | null;
363
366
  }) => react_jsx_runtime.JSX.Element;
364
367
 
368
+ /**
369
+ * AgentUI — Standalone "start + debug agents" surface.
370
+ *
371
+ * TypeScript port and modernization of the legacy Shuffle Core
372
+ * `AgentUI.jsx`. One component, two modes:
373
+ *
374
+ * 1. **Starter** — large hero prompt ("What do you want to do?")
375
+ * with attached MCP/app chips. Submits to `/api/v1/agent`.
376
+ * 2. **Debugger** — compact header + decision timeline driven by
377
+ * `/api/v1/streams/results`, with question/continuation forms
378
+ * and per-decision raw-JSON inspection.
379
+ *
380
+ * Mode switches automatically when an execution is started or when
381
+ * `?execution_id=...&authorization=...` is present in the URL.
382
+ *
383
+ * Self-contained: uses {@link AppSearchDrawer} for app picking,
384
+ * {@link runAgent} for the JSON-RPC call, and the library's
385
+ * {@link toast} facade for notifications.
386
+ */
387
+
388
+ interface AgentUIApp {
389
+ /** App slug, e.g. "http", "shuffle_tools", "gmail". */
390
+ name: string;
391
+ /** Algolia objectID / Shuffle app id (preferred). */
392
+ id?: string;
393
+ /** Optional preview icon URL. */
394
+ icon?: string;
395
+ }
396
+ interface AgentUIProps {
397
+ /** Controlled list of apps. When provided, overrides defaultApps and disables auto-load. */
398
+ apps?: AgentUIApp[];
399
+ /** Initial chip set under the prompt. Used only when `apps` is not provided. */
400
+ defaultApps?: AgentUIApp[];
401
+ /**
402
+ * When true (default) and neither `apps` nor `defaultApps` is provided, fetch the
403
+ * caller's authenticated apps via `/api/v1/apps/authentication` (requires an API
404
+ * token to be set on `API_CONFIG`).
405
+ */
406
+ autoLoadApps?: boolean;
407
+ /** Hero title above the prompt. */
408
+ title?: string;
409
+ /** Optional subtitle/description shown under the title. */
410
+ subtitle?: React$1.ReactNode;
411
+ /** Placeholder shown in the empty prompt. */
412
+ placeholder?: string;
413
+ /** Pre-fill the prompt with this text. */
414
+ defaultInput?: string;
415
+ /** Submit immediately on mount when `defaultInput` is provided. */
416
+ autoSubmit?: boolean;
417
+ /** Hide the centered hero icon (compact mode). */
418
+ hideHeroIcon?: boolean;
419
+ /** Replace the default AgentIcon with a custom node (e.g. brand logo). */
420
+ heroIcon?: React$1.ReactNode;
421
+ /** Pixel size of the hero icon container. Default 84. */
422
+ heroIconSize?: number;
423
+ /** Maximum width of the centered card. */
424
+ maxWidth?: number;
425
+ /** Compact mode: hides the hero icon, shrinks padding. */
426
+ compact?: boolean;
427
+ /** Hide the "Select Apps / MCPs" chip row entirely. */
428
+ hideAppPicker?: boolean;
429
+ /** Hide the paperclip image-attachment button. */
430
+ hideAttach?: boolean;
431
+ /** Label on the "Select Apps / MCPs" chip. */
432
+ appPickerLabel?: string;
433
+ /** Title on the AppSearchDrawer. */
434
+ appPickerTitle?: string;
435
+ /** Subtitle on the AppSearchDrawer. */
436
+ appPickerSubtitle?: string;
437
+ /** Tooltip on the submit button. Default: "⌘+Enter to send". */
438
+ submitTooltip?: string;
439
+ /** Custom icon for the submit button. */
440
+ submitIcon?: React$1.ReactNode;
441
+ /** Placeholder for the post-finish continuation field. */
442
+ continuationPlaceholder?: string;
443
+ /** Read `?execution_id` & `?authorization` from window URL on mount. */
444
+ readUrlParams?: boolean;
445
+ /**
446
+ * Optional explicit execution to attach to on mount. Overrides URL params
447
+ * and skips the starter — useful when embedding to monitor a known run.
448
+ */
449
+ executionId?: string;
450
+ /** Authorization token paired with `executionId`. */
451
+ authorization?: string;
452
+ /** Called whenever a run finishes (success or failure). */
453
+ onRun?: (info: {
454
+ input: string;
455
+ success: boolean;
456
+ executionId?: string;
457
+ error?: string;
458
+ }) => void;
459
+ /**
460
+ * Optional Shuffle API key. When provided, all `/api/v1/*` calls made by
461
+ * this component (agent run, polling, app autoload, icon fallback) use it
462
+ * via `Authorization: Bearer <apiKey>`. When omitted, falls back to the
463
+ * shared `API_CONFIG` (browser session / `localStorage.shuffle_api_key`).
464
+ */
465
+ apiKey?: string;
466
+ /**
467
+ * Optional Shuffle backend base URL (e.g. `https://shuffler.io`). When
468
+ * omitted, falls back to the shared `API_CONFIG.baseUrl`. Useful when
469
+ * embedding `AgentUI` inside another app that targets a different region.
470
+ */
471
+ apiBaseUrl?: string;
472
+ /** Optional Shuffle Org ID — sent as the `Org-Id` header on every call. */
473
+ orgId?: string;
474
+ }
475
+ declare const AgentUI: React$1.FC<AgentUIProps>;
476
+
365
477
  /**
366
478
  * useAppLookup — Resolve an app's display name, image, categories,
367
479
  * canonical Algolia objectID and matching auth entries from just
@@ -484,16 +596,29 @@ declare const getApiUrl: (endpoint: string) => string;
484
596
  declare const getAuthHeader: (overrideOrgId?: string | null) => Record<string, string>;
485
597
 
486
598
  /**
487
- * Tiny toast facade — library version. The host app can replace this by
488
- * setting a custom impl via setToastImpl(). Falls back to console.warn.
599
+ * Tiny toast facade — library version. Mirrors the sonner-style surface
600
+ * (`toast(...)`, `toast.success`, `toast.error`, `toast.info`, `toast.warning`)
601
+ * plus the legacy `{ title, description, variant }` shape used elsewhere in
602
+ * the host app. The host app can replace the impl via `setToastImpl()`.
489
603
  */
490
- type ToastArg = {
604
+ type Variant = 'default' | 'destructive' | 'success' | 'error' | 'info' | 'warning';
605
+ type ToastArg = string | {
491
606
  title?: string;
492
607
  description?: string;
493
- variant?: 'default' | 'destructive';
608
+ variant?: Variant;
609
+ };
610
+ type ToastOptions = {
611
+ description?: string;
612
+ [key: string]: unknown;
613
+ };
614
+ type ToastImpl = (arg: ToastArg, opts?: ToastOptions) => void;
615
+ declare function setToastImpl(fn: ToastImpl): void;
616
+ type ToastApi = ((arg: ToastArg, opts?: ToastOptions) => void) & {
617
+ success: (msg: string, opts?: ToastOptions) => void;
618
+ error: (msg: string, opts?: ToastOptions) => void;
619
+ info: (msg: string, opts?: ToastOptions) => void;
620
+ warning: (msg: string, opts?: ToastOptions) => void;
494
621
  };
495
- type ToastFn = (arg: ToastArg) => void;
496
- declare function setToastImpl(fn: ToastFn): void;
497
- declare const toast: ToastFn;
622
+ declare const toast: ToastApi;
498
623
 
499
- export { API_CONFIG, type AlgoliaSearchApp, AppAuthSection, type AppAuthSectionProps, type AppAuthentication, AppDetailDrawer, AppDetailProvider, type AppLookupResult, AppSearchDrawer, type AppSelectedEvent, AppTitleHeader, type AppTitleHeaderProps, type CustomStyles, IntegrationStatus, ShuffleMCP, type ShuffleMCPHandle, type ShuffleMCPProps, ShufflePipelinesBanner, SingulActionsPreview, TryMcpSection, type TryMcpSectionProps, ShuffleMCP as default, getApiUrl, getAuthHeader, refreshAllIntegrationStatus, setToastImpl, toast, useAppAuth, useAppDetail, useAppLookup };
624
+ export { API_CONFIG, AgentUI, type AgentUIApp, type AgentUIProps, type AlgoliaSearchApp, AppAuthSection, type AppAuthSectionProps, type AppAuthentication, AppDetailDrawer, AppDetailProvider, type AppLookupResult, AppSearchDrawer, type AppSelectedEvent, AppTitleHeader, type AppTitleHeaderProps, type CustomStyles, IntegrationStatus, ShuffleMCP, type ShuffleMCPHandle, type ShuffleMCPProps, ShufflePipelinesBanner, SingulActionsPreview, TryMcpSection, type TryMcpSectionProps, ShuffleMCP as default, getApiUrl, getAuthHeader, refreshAllIntegrationStatus, setToastImpl, toast, useAppAuth, useAppDetail, useAppLookup };