@mcp-b/embedded-agent 0.0.4 → 0.0.6

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.ts CHANGED
@@ -2,48 +2,33 @@ import { AssistantRuntime, ThreadMessageLike, ToolCallMessagePartComponent } fro
2
2
  import { UIDataTypes, UIMessage, UITools } from "ai";
3
3
  import * as react0 from "react";
4
4
  import { ComponentPropsWithRef, FC, HTMLAttributes, ReactNode } from "react";
5
+ import { Client } from "@modelcontextprotocol/sdk/client/index.js";
6
+ import { Tool } from "@modelcontextprotocol/sdk/types.js";
7
+ import * as react_jsx_runtime19 from "react/jsx-runtime";
5
8
  import { ClassValue } from "clsx";
6
- import * as react_jsx_runtime0 from "react/jsx-runtime";
9
+ import { VariantProps } from "class-variance-authority";
10
+ import * as TooltipPrimitive from "@radix-ui/react-tooltip";
7
11
  import * as AvatarPrimitive from "@radix-ui/react-avatar";
8
12
  import * as DialogPrimitive from "@radix-ui/react-dialog";
9
- import * as TooltipPrimitive from "@radix-ui/react-tooltip";
10
- import { VariantProps } from "class-variance-authority";
11
- import { Client } from "@modelcontextprotocol/sdk/client/index.js";
12
- import { Tool } from "@modelcontextprotocol/sdk/types.js";
13
13
  import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
14
14
  import * as SeparatorPrimitive from "@radix-ui/react-separator";
15
- import * as class_variance_authority_types0 from "class-variance-authority/types";
16
15
  import { CallToolResult, GetPromptResult, MCPConnectionState, MCPSource, MCPSourceConfig, Prompt, ReadResourceResult, Resource, ResourceTemplate, SamplingHandler, Tool as Tool$1, ToolWithSource } from "@mcp-b/cloud-mirror-types";
16
+ import * as class_variance_authority_types0 from "class-variance-authority/types";
17
17
  import { AgentChatState, PendingTool } from "@mcp-b/agents";
18
18
  import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
19
19
 
20
- //#region src/web-component.d.ts
20
+ //#region src/core/providers/AgentProvider.d.ts
21
21
 
22
- /** View mode for the agent UI */
23
- type AgentViewMode = 'pill' | 'modal';
24
- /**
25
- * Props for the EmbeddedAgent React component
26
- *
27
- * These props map to HTML attributes in kebab-case when used as a web component:
28
- * - appId -> app-id
29
- * - apiBase -> api-base
30
- * - tokenEndpoint -> token-endpoint
31
- * - autoConnectLocal -> auto-connect-local
32
- * - viewMode -> view-mode
33
- */
34
- interface EmbeddedAgentProps {
35
- /** Your app/workspace ID */
36
- appId: string;
22
+ interface AgentProviderProps {
23
+ children: ReactNode;
37
24
  /** API base URL for your WebMCP worker */
38
25
  apiBase?: string;
39
26
  /** Voice mode token endpoint (defaults to {apiBase}/api/realtime/session) */
40
27
  tokenEndpoint?: string;
41
28
  /** Auto-connect to local MCP source (default: true) */
42
29
  autoConnectLocal?: boolean;
43
- /** UI view mode: 'pill' (action-first) or 'modal' (traditional chat) */
44
- viewMode?: AgentViewMode;
45
- /** Callback when tools are updated */
46
- onToolsChange?: (tools: unknown[]) => void;
30
+ /** Callback when MCP tools change */
31
+ onToolsChange?: (tools: ToolWithSource[]) => void;
47
32
  /** Callback when voice mode errors */
48
33
  onVoiceError?: (error: string) => void;
49
34
  /** Callback when voice mode connects */
@@ -52,370 +37,136 @@ interface EmbeddedAgentProps {
52
37
  onVoiceDisconnect?: (duration: number) => void;
53
38
  }
54
39
  /**
55
- * EmbeddedAgent React Component
56
- *
57
- * A fully self-contained chat widget with MCP tool support and optional voice mode.
58
- * Supports two view modes:
59
- * - 'pill': Action-first compact UI (default)
60
- * - 'modal': Traditional chat modal
61
- *
62
- * Can be used as a React component or converted to a web component.
63
- */
64
- declare const EmbeddedAgent: FC<EmbeddedAgentProps>;
65
- /**
66
- * Web Component Definition
40
+ * Unified provider for all agent capabilities.
67
41
  *
68
- * Converts EmbeddedAgent to a custom element that can be used in any HTML page.
69
- * Attributes are automatically converted from kebab-case to camelCase props.
70
- */
71
- declare const WebMCPAgentElement: CustomElementConstructor;
72
- /**
73
- * Register the custom element
42
+ * Provides:
43
+ * - MCP tool registry and execution
44
+ * - Chat runtime (via @assistant-ui/react)
45
+ * - Voice mode (if tokenEndpoint is configured)
74
46
  *
75
- * Call this function to register the <webmcp-agent> custom element.
76
- * This is automatically called when importing the web-component entry point.
77
- * Styles are automatically injected into the document head.
47
+ * Use the `useAgent` hook to access agent state and capabilities.
78
48
  */
79
- declare function registerWebMCPAgent(tagName?: string): void;
80
- //#endregion
81
- //#region src/components/assistant-modal.d.ts
82
- declare const AssistantModal: FC;
83
- //#endregion
84
- //#region src/components/thread-with-voice.d.ts
85
- declare const ThreadWithVoice: FC;
49
+ declare const AgentProvider: FC<AgentProviderProps>;
86
50
  //#endregion
87
- //#region src/components/Thread.d.ts
88
- declare const Thread: FC;
89
- //#endregion
90
- //#region src/components/pill/AgentPill.d.ts
91
- interface AgentPillProps {
92
- /** Position of the pill on screen */
93
- position?: 'bottom-center' | 'bottom-right';
94
- /** Callback when history button is clicked */
95
- onOpenHistory?: () => void;
96
- /** Show voice button in composer */
97
- showVoiceButton?: boolean;
98
- /** Voice mode active state */
99
- isVoiceActive?: boolean;
100
- /** Voice toggle callback */
101
- onVoiceToggle?: () => void;
102
- /** Auto-collapse after inactivity (default: true) */
103
- autoCollapse?: boolean;
104
- /** Additional class name */
105
- className?: string;
106
- }
51
+ //#region src/providers/MCPToolsProvider.d.ts
52
+ /** Well-known source IDs */
53
+ declare const SOURCE_LOCAL = "local";
54
+ declare const SOURCE_REMOTE = "remote";
107
55
  /**
108
- * Action-first agent pill UI.
109
- *
110
- * A compact, morphing interface that shows:
111
- * - Current activity when agent is working
112
- * - Action list (collapsible)
113
- * - Summary when complete
114
- * - Input composer
115
- *
116
- * Uses assistant-ui primitives for data binding.
56
+ * MCP Tools Context Value
117
57
  */
118
- declare const AgentPill: FC<AgentPillProps>;
119
- //#endregion
120
- //#region src/components/pill/PillContainer.d.ts
121
- type PillMode = 'collapsed' | 'hovered' | 'composing' | 'active' | 'expanded';
122
- interface PillContainerProps {
123
- mode: PillMode;
58
+ interface MCPToolsContextValue {
59
+ /** All tools from all sources, tagged with _sourceId */
60
+ tools: ToolWithSource[];
61
+ /** All sources and their states */
62
+ sources: Map<string, MCPSource>;
63
+ /** Add a new source */
64
+ addSource: (id: string, config: MCPSourceConfig) => Promise<void>;
65
+ /** Remove a source */
66
+ removeSource: (id: string) => Promise<void>;
67
+ /** Get a specific source */
68
+ getSource: (id: string) => MCPSource | undefined;
69
+ /** Check if a source is connected */
70
+ isConnected: (id: string) => boolean;
71
+ /** Call a tool (auto-routes based on tool name lookup) */
72
+ callTool: (name: string, args: Record<string, unknown>) => Promise<CallToolResult>;
73
+ /** Call a tool on a specific source */
74
+ callToolOnSource: (sourceId: string, name: string, args: Record<string, unknown>) => Promise<CallToolResult>;
75
+ }
76
+ interface MCPToolsProviderProps {
124
77
  children: ReactNode;
125
- onModeChange?: (mode: PillMode) => void;
126
- className?: string;
78
+ /** Auto-connect to same-tab source on mount (default: true) */
79
+ autoConnectLocal?: boolean;
80
+ /** Callback when tools change */
81
+ onToolsChange?: (tools: ToolWithSource[]) => void;
127
82
  }
83
+ declare function MCPToolsProvider({
84
+ children,
85
+ autoConnectLocal,
86
+ onToolsChange
87
+ }: MCPToolsProviderProps): react_jsx_runtime19.JSX.Element;
128
88
  /**
129
- * Morphing container that changes size and shape based on state.
130
- * Uses spring animations for smooth, natural transitions.
131
- *
132
- * States:
133
- * - collapsed: Tiny 4px tall bar (ambient)
134
- * - hovered: Medium pill with prompt
135
- * - composing: User is typing
136
- * - active: Agent is working
137
- * - expanded: Full panel with summary/forms
89
+ * Hook to access MCP Tools context
138
90
  */
139
- declare const PillContainer: FC<PillContainerProps>;
140
- //#endregion
141
- //#region src/components/pill/ToolStatusBorder.d.ts
142
- type ToolBorderStatus = 'idle' | 'calling' | 'success' | 'error';
143
- interface ToolStatusBorderProps {
144
- status: ToolBorderStatus;
145
- children: ReactNode;
146
- className?: string;
147
- borderRadius?: string;
148
- }
91
+ declare function useMCPTools(): MCPToolsContextValue;
149
92
  /**
150
- * Minimal animated border for tool execution status.
151
- *
152
- * - idle/success: clean, no border (success is the default state)
153
- * - calling: subtle animated gradient
154
- * - error: brief red flash with shake
93
+ * Hook to optionally access MCP Tools context
155
94
  */
156
- declare const ToolStatusBorder: FC<ToolStatusBorderProps>;
95
+ declare function useOptionalMCPTools(): MCPToolsContextValue | null;
157
96
  //#endregion
158
- //#region src/hooks/useActions.d.ts
97
+ //#region src/services/realtime/types.d.ts
159
98
  /**
160
- * Represents a single action derived from a tool call
99
+ * Types for OpenAI Realtime API integration
161
100
  */
162
- interface Action {
163
- id: string;
164
- label: string;
101
+ interface RealtimeConfig {
102
+ model?: string;
103
+ voice?: string;
104
+ apiUrl?: string;
105
+ tokenEndpoint?: string;
106
+ }
107
+ interface RealtimeSession {
108
+ pc: RTCPeerConnection;
109
+ dataChannel: RTCDataChannel;
110
+ audioElement: HTMLAudioElement;
111
+ localStream: MediaStream | null;
112
+ remoteStream: MediaStream | null;
113
+ cleanup: () => void;
114
+ }
115
+ type EventCallback = (data: unknown) => void;
116
+ interface AudioLevelData {
117
+ micLevel: number;
118
+ micFrequency: number[];
119
+ speakerLevel: number;
120
+ speakerFrequency: number[];
121
+ }
122
+ interface TranscriptData {
123
+ type: 'user' | 'assistant';
124
+ text: string;
125
+ isDone: boolean;
126
+ }
127
+ interface ToolCallData {
128
+ status: 'started' | 'completed';
165
129
  toolName: string;
166
- status: 'queued' | 'running' | 'success' | 'error';
167
- args?: unknown;
168
- result?: unknown;
169
130
  error?: string;
170
- startedAt?: number;
171
- duration?: number;
131
+ }
132
+ interface VoiceModeState {
133
+ isActive: boolean;
134
+ isConnecting: boolean;
135
+ isMuted: boolean;
136
+ isError: boolean;
137
+ connectionState: string;
138
+ audioLevel?: AudioLevelData;
139
+ transcript?: TranscriptData;
140
+ toolCall?: ToolCallData;
141
+ error?: string;
172
142
  }
173
143
  /**
174
- * Humanize a tool name for display
175
- * e.g., "search_files" -> "Searching files"
176
- * e.g., "readFile" -> "Reading file"
177
- */
178
- declare function humanizeToolName(toolName: string, isRunning?: boolean): string;
179
- /**
180
- * Hook to derive actions from the current thread's tool calls
181
- *
182
- * Actions are a view of tool calls - not separate state.
183
- * This maintains compatibility with assistant-ui's data model.
144
+ * Session state event data from the realtime service
184
145
  */
185
- declare function useActions(): Action[];
146
+ interface SessionStateEventData {
147
+ state: 'connecting' | 'connected' | 'disconnected' | 'error';
148
+ isActive: boolean;
149
+ isMuted: boolean;
150
+ durationSeconds?: number;
151
+ }
186
152
  /**
187
- * Hook to get the current running action (if any)
153
+ * User transcript event data
188
154
  */
189
- declare function useCurrentAction(): Action | null;
155
+ interface UserTranscriptEventData {
156
+ text: string;
157
+ }
190
158
  /**
191
- * Hook to get recently completed actions
159
+ * Assistant transcript streaming event data
192
160
  */
193
- declare function useRecentActions(limit?: number): Action[];
161
+ interface AssistantTranscriptEventData {
162
+ delta?: string;
163
+ transcript?: string;
164
+ }
194
165
  /**
195
- * Hook to get action summary stats
166
+ * Tool call started event data
196
167
  */
197
- declare function useActionStats(): {
198
- total: number;
199
- completed: number;
200
- running: number;
201
- failed: number;
202
- };
203
- //#endregion
204
- //#region src/components/pill/CurrentActivity.d.ts
205
- interface CurrentActivityProps {
206
- currentAction: Action | null;
207
- recentActions?: Action[];
208
- showRecent?: boolean;
209
- className?: string;
210
- }
211
- /**
212
- * Displays the current action the agent is performing,
213
- * with optional recent completed steps shown below.
214
- */
215
- declare const CurrentActivity: FC<CurrentActivityProps>;
216
- type ActionStatus = 'queued' | 'running' | 'success' | 'error';
217
- interface ActionStatusIconProps {
218
- status: ActionStatus;
219
- size?: 'sm' | 'md';
220
- className?: string;
221
- }
222
- /**
223
- * Icon component for action status
224
- */
225
- declare const ActionStatusIcon: FC<ActionStatusIconProps>;
226
- /**
227
- * Idle state indicator when no actions are running
228
- */
229
- declare const IdleIndicator: FC<{
230
- className?: string;
231
- }>;
232
- //#endregion
233
- //#region src/components/pill/ActionList.d.ts
234
- interface ActionListProps {
235
- actions: Action[];
236
- defaultCollapsed?: boolean;
237
- className?: string;
238
- }
239
- /**
240
- * Collapsible list of all actions (tool calls) in the current conversation.
241
- * Shows count in header, expands to show full list with status icons.
242
- */
243
- declare const ActionList: FC<ActionListProps>;
244
- /**
245
- * Compact inline action summary (for collapsed pill states)
246
- */
247
- declare const ActionSummary: FC<{
248
- actions: Action[];
249
- className?: string;
250
- }>;
251
- //#endregion
252
- //#region src/components/pill/PillComposer.d.ts
253
- interface PillComposerProps {
254
- placeholder?: string;
255
- showVoiceButton?: boolean;
256
- isVoiceActive?: boolean;
257
- onVoiceToggle?: () => void;
258
- showCharCount?: boolean;
259
- className?: string;
260
- }
261
- /**
262
- * Compact composer for the pill UI.
263
- * Uses assistant-ui primitives for data binding.
264
- * Features auto-growing textarea and character count.
265
- */
266
- declare const PillComposer: FC<PillComposerProps>;
267
- /**
268
- * Minimal composer for collapsed/hovered states
269
- * Just shows a clickable prompt
270
- */
271
- declare const MinimalComposer: FC<{
272
- onClick: () => void;
273
- className?: string;
274
- }>;
275
- //#endregion
276
- //#region src/components/pill/SummaryBlock.d.ts
277
- interface SummaryBlockProps {
278
- summary: string;
279
- isSuccess?: boolean;
280
- isError?: boolean;
281
- actions?: QuickAction[];
282
- className?: string;
283
- }
284
- interface QuickAction {
285
- label: string;
286
- onClick: () => void;
287
- variant?: 'primary' | 'secondary';
288
- }
289
- /**
290
- * Summary block showing the agent's synthesized output.
291
- * Displayed after task completion instead of token streaming.
292
- */
293
- declare const SummaryBlock: FC<SummaryBlockProps>;
294
- /**
295
- * Welcome message for empty state
296
- */
297
- declare const WelcomeMessage: FC<{
298
- className?: string;
299
- }>;
300
- //#endregion
301
- //#region src/components/pill/HistorySidebar.d.ts
302
- /**
303
- * Represents a conversation in history
304
- */
305
- interface Conversation {
306
- id: string;
307
- title: string;
308
- preview: string;
309
- timestamp: Date;
310
- messageCount: number;
311
- }
312
- interface HistorySidebarProps {
313
- isOpen: boolean;
314
- onClose: () => void;
315
- conversations?: Conversation[];
316
- selectedId?: string | null;
317
- onSelectConversation?: (id: string) => void;
318
- className?: string;
319
- }
320
- /**
321
- * Sidebar panel showing conversation history and full thread view.
322
- * Opens from the right side of the screen.
323
- */
324
- declare const HistorySidebar: FC<HistorySidebarProps>;
325
- //#endregion
326
- //#region src/components/AssistantMessage.d.ts
327
- declare const AssistantMessage: FC;
328
- //#endregion
329
- //#region src/components/UserMessage.d.ts
330
- declare const UserMessage: FC;
331
- //#endregion
332
- //#region src/components/Composer.d.ts
333
- declare const Composer: FC;
334
- //#endregion
335
- //#region src/components/markdown-text.d.ts
336
- declare const MarkdownText: react0.MemoExoticComponent<() => react_jsx_runtime0.JSX.Element>;
337
- //#endregion
338
- //#region src/components/tool-fallback.d.ts
339
- declare const ToolFallback: ToolCallMessagePartComponent;
340
- //#endregion
341
- //#region src/components/attachment.d.ts
342
- declare const UserMessageAttachments: FC;
343
- declare const ComposerAttachments: FC;
344
- declare const ComposerAddAttachment: FC;
345
- //#endregion
346
- //#region src/services/realtime/types.d.ts
347
- /**
348
- * Types for OpenAI Realtime API integration
349
- */
350
- interface RealtimeConfig {
351
- model?: string;
352
- voice?: string;
353
- apiUrl?: string;
354
- tokenEndpoint?: string;
355
- }
356
- interface RealtimeSession {
357
- pc: RTCPeerConnection;
358
- dataChannel: RTCDataChannel;
359
- audioElement: HTMLAudioElement;
360
- localStream: MediaStream | null;
361
- remoteStream: MediaStream | null;
362
- cleanup: () => void;
363
- }
364
- type EventCallback = (data: unknown) => void;
365
- interface AudioLevelData {
366
- micLevel: number;
367
- micFrequency: number[];
368
- speakerLevel: number;
369
- speakerFrequency: number[];
370
- }
371
- interface TranscriptData {
372
- type: 'user' | 'assistant';
373
- text: string;
374
- isDone: boolean;
375
- }
376
- interface ToolCallData {
377
- status: 'started' | 'completed';
378
- toolName: string;
379
- error?: string;
380
- }
381
- interface VoiceModeState {
382
- isActive: boolean;
383
- isConnecting: boolean;
384
- isMuted: boolean;
385
- isError: boolean;
386
- connectionState: string;
387
- audioLevel?: AudioLevelData;
388
- transcript?: TranscriptData;
389
- toolCall?: ToolCallData;
390
- error?: string;
391
- }
392
- /**
393
- * Session state event data from the realtime service
394
- */
395
- interface SessionStateEventData {
396
- state: 'connecting' | 'connected' | 'disconnected' | 'error';
397
- isActive: boolean;
398
- isMuted: boolean;
399
- durationSeconds?: number;
400
- }
401
- /**
402
- * User transcript event data
403
- */
404
- interface UserTranscriptEventData {
405
- text: string;
406
- }
407
- /**
408
- * Assistant transcript streaming event data
409
- */
410
- interface AssistantTranscriptEventData {
411
- delta?: string;
412
- transcript?: string;
413
- }
414
- /**
415
- * Tool call started event data
416
- */
417
- interface ToolCallStartedEventData {
418
- name: string;
168
+ interface ToolCallStartedEventData {
169
+ name: string;
419
170
  }
420
171
  /**
421
172
  * Tool call completed event data
@@ -555,29 +306,536 @@ declare class OpenAIRealtimeService {
555
306
  private emitSessionState;
556
307
  }
557
308
  //#endregion
558
- //#region src/components/voice-indicator.d.ts
559
- interface VoiceIndicatorProps {
560
- isActive: boolean;
561
- isConnecting: boolean;
562
- isMuted: boolean;
563
- audioLevel?: AudioLevelData;
564
- toolCall?: ToolCallData;
565
- onStart: () => void;
566
- onStop: () => void;
567
- onToggleMute: () => void;
309
+ //#region src/hooks/useVoiceMode.d.ts
310
+ interface UseVoiceModeOptions {
311
+ /** Endpoint to get ephemeral tokens from */
312
+ tokenEndpoint: string;
313
+ /** Tools available for the voice session */
314
+ tools?: RegisteredTool[];
315
+ /** Tool executor function */
316
+ toolExecutor?: ToolExecutor;
317
+ /** Callback when session connects */
318
+ onConnect?: () => void;
319
+ /** Callback when session disconnects */
320
+ onDisconnect?: (durationSeconds: number) => void;
321
+ /** Callback when error occurs */
322
+ onError?: (error: string) => void;
323
+ /** Callback when user transcript is complete */
324
+ onUserTranscript?: (text: string) => void;
325
+ /** Callback when assistant transcript is complete */
326
+ onAssistantTranscript?: (text: string) => void;
327
+ }
328
+ interface UseVoiceModeReturn extends VoiceModeState {
329
+ /** Start voice session */
330
+ startSession: (config?: RealtimeConfig) => Promise<void>;
331
+ /** Stop voice session */
332
+ stopSession: () => void;
333
+ /** Toggle microphone mute */
334
+ toggleMute: (muted?: boolean) => void;
335
+ /** Send text message while in voice mode */
336
+ sendMessage: (text: string) => void;
337
+ }
338
+ declare function useVoiceMode(options: UseVoiceModeOptions): UseVoiceModeReturn;
339
+ //#endregion
340
+ //#region src/providers/VoiceModeProvider.d.ts
341
+ /**
342
+ * Voice Mode Provider
343
+ *
344
+ * Provides voice mode state and controls to the component tree.
345
+ */
346
+ interface VoiceModeContextValue extends UseVoiceModeReturn {
347
+ isSupported: boolean;
348
+ }
349
+ interface VoiceModeProviderProps {
350
+ children: ReactNode;
351
+ /** Backend endpoint for ephemeral tokens */
352
+ tokenEndpoint: string;
353
+ /** Tools available for voice mode */
354
+ tools?: RegisteredTool[];
355
+ /** Tool executor function */
356
+ toolExecutor?: ToolExecutor;
357
+ /** Callback when session connects */
358
+ onConnect?: () => void;
359
+ /** Callback when session disconnects */
360
+ onDisconnect?: (durationSeconds: number) => void;
361
+ /** Callback when error occurs */
362
+ onError?: (error: string) => void;
363
+ /** Callback when user transcript is complete */
364
+ onUserTranscript?: (text: string) => void;
365
+ /** Callback when assistant transcript is complete */
366
+ onAssistantTranscript?: (text: string) => void;
367
+ }
368
+ declare function VoiceModeProvider({
369
+ children,
370
+ tokenEndpoint,
371
+ tools,
372
+ toolExecutor,
373
+ onConnect,
374
+ onDisconnect,
375
+ onError,
376
+ onUserTranscript,
377
+ onAssistantTranscript
378
+ }: VoiceModeProviderProps): react_jsx_runtime19.JSX.Element;
379
+ /**
380
+ * Hook to access voice mode context
381
+ */
382
+ declare function useVoiceModeContext(): VoiceModeContextValue;
383
+ /**
384
+ * Hook to optionally access voice mode context (returns null if not in provider)
385
+ */
386
+ declare function useOptionalVoiceModeContext(): VoiceModeContextValue | null;
387
+ //#endregion
388
+ //#region src/hooks/useActions.d.ts
389
+ /**
390
+ * Represents a single action derived from a tool call
391
+ */
392
+ interface Action {
393
+ id: string;
394
+ label: string;
395
+ toolName: string;
396
+ status: 'queued' | 'running' | 'success' | 'error';
397
+ args?: unknown;
398
+ result?: unknown;
399
+ error?: string;
400
+ startedAt?: number;
401
+ duration?: number;
402
+ }
403
+ /**
404
+ * Humanize a tool name for display
405
+ * e.g., "search_files" -> "Searching files"
406
+ * e.g., "readFile" -> "Reading file"
407
+ */
408
+ declare function humanizeToolName(toolName: string, isRunning?: boolean): string;
409
+ /**
410
+ * Hook to derive actions from the current thread's tool calls
411
+ *
412
+ * Actions are a view of tool calls - not separate state.
413
+ * This maintains compatibility with assistant-ui's data model.
414
+ */
415
+ declare function useActions(): Action[];
416
+ /**
417
+ * Hook to get the current running action (if any)
418
+ */
419
+ declare function useCurrentAction(): Action | null;
420
+ /**
421
+ * Hook to get recently completed actions
422
+ */
423
+ declare function useRecentActions(limit?: number): Action[];
424
+ /**
425
+ * Hook to get action summary stats
426
+ */
427
+ declare function useActionStats(): {
428
+ total: number;
429
+ completed: number;
430
+ running: number;
431
+ failed: number;
432
+ };
433
+ //#endregion
434
+ //#region src/hooks/useVoiceSummary.d.ts
435
+ /**
436
+ * Voice Summary Hook
437
+ *
438
+ * Tracks the last assistant response from voice mode for display as a summary.
439
+ * Maintains the summary for a short time after the voice session ends.
440
+ */
441
+ interface VoiceSummary {
442
+ text: string;
443
+ timestamp: number;
444
+ }
445
+ /**
446
+ * Hook to get the latest voice session summary
447
+ * Returns the last assistant transcript from the voice session
448
+ */
449
+ declare function useVoiceSummary(): VoiceSummary | null;
450
+ /**
451
+ * Hook to check if there's a recent voice summary to display
452
+ */
453
+ declare function useHasVoiceSummary(): boolean;
454
+ //#endregion
455
+ //#region src/core/hooks/useAgent.d.ts
456
+ /**
457
+ * Voice mode state and controls
458
+ */
459
+ interface AgentVoice {
460
+ /** Whether voice session is active */
461
+ isActive: boolean;
462
+ /** Whether voice is connecting */
463
+ isConnecting: boolean;
464
+ /** Whether there's an error */
465
+ isError: boolean;
466
+ /** Whether microphone is muted */
467
+ isMuted: boolean;
468
+ /** Current error message */
469
+ error?: string;
470
+ /** Real-time audio levels (mic and speaker) */
471
+ audioLevel?: AudioLevelData;
472
+ /** Current transcript (user or assistant) */
473
+ transcript?: TranscriptData;
474
+ /** Current tool call being executed */
475
+ toolCall?: ToolCallData;
476
+ /** Start voice session */
477
+ start: () => Promise<void>;
478
+ /** Stop voice session */
479
+ stop: () => void;
480
+ /** Toggle microphone mute */
481
+ toggleMute: (muted?: boolean) => void;
482
+ /** Send text message while in voice mode */
483
+ sendMessage: (text: string) => void;
484
+ }
485
+ /**
486
+ * MCP tools state and controls
487
+ */
488
+ interface AgentTools {
489
+ /** All available tools */
490
+ list: ToolWithSource[];
491
+ /** Call a tool by name */
492
+ call: (name: string, args: Record<string, unknown>) => Promise<CallToolResult>;
493
+ }
494
+ /**
495
+ * Agent state and controls returned by useAgent
496
+ */
497
+ interface AgentState {
498
+ /** All messages in the thread */
499
+ messages: ReadonlyArray<{
500
+ id: string;
501
+ role: 'user' | 'assistant' | 'system';
502
+ content: readonly unknown[];
503
+ status?: {
504
+ type: string;
505
+ };
506
+ }>;
507
+ /** Whether the agent is currently processing */
508
+ isRunning: boolean;
509
+ /** Whether thread has any messages */
510
+ hasMessages: boolean;
511
+ /** All actions derived from tool calls */
512
+ actions: Action[];
513
+ /** Currently running action (if any) */
514
+ currentAction: Action | null;
515
+ /** Recently completed actions */
516
+ recentActions: Action[];
517
+ /** Actions from voice mode (when voice is active) */
518
+ voiceActions: Action[];
519
+ /** Active actions - voice actions when voice is active, otherwise text actions */
520
+ activeActions: Action[];
521
+ /** Latest assistant summary (from text or voice) */
522
+ summary: string | null;
523
+ /** Voice summary (after voice session ends) */
524
+ voiceSummary: VoiceSummary | null;
525
+ voice: AgentVoice | null;
526
+ tools: AgentTools | null;
527
+ /** Whether voice mode is currently active */
528
+ isVoiceActive: boolean;
529
+ }
530
+ /**
531
+ * Main agent hook - provides unified access to all agent capabilities
532
+ */
533
+ declare function useAgent(): AgentState;
534
+ /**
535
+ * Hook to check if agent is available (inside AgentProvider)
536
+ */
537
+ declare function useIsAgentAvailable(): boolean;
538
+ //#endregion
539
+ //#region src/hooks/useVoiceActions.d.ts
540
+ declare function useVoiceActions(): Action[];
541
+ /**
542
+ * Hook to get the current running voice action (if any)
543
+ */
544
+ declare function useCurrentVoiceAction(): Action | null;
545
+ /**
546
+ * Hook to get recently completed voice actions
547
+ */
548
+ declare function useRecentVoiceActions(limit?: number): Action[];
549
+ //#endregion
550
+ //#region src/lib/constants.d.ts
551
+ /**
552
+ * Shared Constants
553
+ *
554
+ * Centralized location for all magic numbers, timeouts, and configuration values.
555
+ * Having these in one place makes the codebase more maintainable and easier to tune.
556
+ */
557
+ /** Maximum number of reconnection attempts before giving up */
558
+ declare const MCP_MAX_RECONNECT_ATTEMPTS = 5;
559
+ /** Base delay in milliseconds for exponential backoff reconnection */
560
+ declare const MCP_BASE_RECONNECT_DELAY_MS = 1000;
561
+ /** Maximum reconnect delay in milliseconds (caps exponential backoff) */
562
+ declare const MCP_MAX_RECONNECT_DELAY_MS = 30000;
563
+ /** Delay before auto-connecting to tab-based MCP sources (allows server initialization) */
564
+ declare const MCP_TAB_CONNECT_DELAY_MS = 100;
565
+ /** Number of frequency bins for audio visualization */
566
+ declare const AUDIO_FREQUENCY_BINS = 32;
567
+ /** Default OpenAI Realtime model */
568
+ declare const REALTIME_DEFAULT_MODEL = "gpt-4o-realtime-preview-2024-12-17";
569
+ /** Default voice for OpenAI Realtime */
570
+ declare const REALTIME_DEFAULT_VOICE = "verse";
571
+ /** Default OpenAI Realtime API URL */
572
+ declare const REALTIME_DEFAULT_API_URL = "https://api.openai.com/v1/realtime";
573
+ /** Duration to retain voice actions after session ends (for display) */
574
+ declare const VOICE_ACTIONS_RETENTION_MS = 3000;
575
+ /** Duration to retain voice summary after session ends */
576
+ declare const VOICE_SUMMARY_RETENTION_MS = 30000;
577
+ /**
578
+ * Enable debug logging for development.
579
+ * Can be enabled by setting window.__WEBMCP_DEBUG__ = true in the browser console.
580
+ * In production builds, this defaults to false.
581
+ */
582
+ declare const DEBUG_LOGGING_ENABLED: boolean;
583
+ /**
584
+ * Conditional debug logger that only logs when DEBUG_LOGGING_ENABLED is true.
585
+ * Can be enabled at runtime by setting window.__WEBMCP_DEBUG__ = true
586
+ *
587
+ * @param component - The component or service name for the log prefix
588
+ * @param message - The log message
589
+ * @param data - Optional data to include in the log
590
+ */
591
+ declare function debugLog(component: string, message: string, data?: unknown): void;
592
+ //#endregion
593
+ //#region src/components/pill/AgentPill.d.ts
594
+ /** Position of the pill on screen */
595
+ type PillPosition = 'bottom-center' | 'bottom-right';
596
+ interface AgentPillProps {
597
+ /** Position of the pill on screen */
598
+ position?: PillPosition;
599
+ /** Callback when history button is clicked */
600
+ onOpenHistory?: () => void;
601
+ /** Show voice button in composer */
602
+ showVoiceButton?: boolean;
603
+ /** Voice mode active state */
604
+ isVoiceActive?: boolean;
605
+ /** Voice toggle callback */
606
+ onVoiceToggle?: () => void;
607
+ /** Auto-collapse after inactivity (default: true) */
608
+ autoCollapse?: boolean;
609
+ /** Additional class name */
610
+ className?: string;
611
+ }
612
+ /**
613
+ * Action-first agent pill UI.
614
+ *
615
+ * A compact, morphing interface that shows:
616
+ * - Current activity when agent is working
617
+ * - Action list (collapsible)
618
+ * - Summary when complete
619
+ * - Input composer
620
+ *
621
+ * Uses assistant-ui primitives for data binding.
622
+ */
623
+ declare const AgentPill: FC<AgentPillProps>;
624
+ //#endregion
625
+ //#region src/components/pill/PillContainer.d.ts
626
+ type PillMode = 'collapsed' | 'hovered' | 'composing' | 'active' | 'expanded';
627
+ interface PillContainerProps {
628
+ mode: PillMode;
629
+ children: ReactNode;
630
+ onModeChange?: (mode: PillMode) => void;
631
+ className?: string;
632
+ }
633
+ /**
634
+ * Morphing container that changes size and shape based on state.
635
+ * Uses spring animations for smooth, natural transitions.
636
+ *
637
+ * States:
638
+ * - collapsed: Tiny 4px tall bar (ambient)
639
+ * - hovered: Medium pill with prompt
640
+ * - composing: User is typing
641
+ * - active: Agent is working
642
+ * - expanded: Full panel with summary/forms
643
+ */
644
+ declare const PillContainer: FC<PillContainerProps>;
645
+ //#endregion
646
+ //#region src/components/pill/PillComposer.d.ts
647
+ interface PillComposerProps {
648
+ placeholder?: string;
649
+ showVoiceButton?: boolean;
650
+ isVoiceActive?: boolean;
651
+ onVoiceToggle?: () => void;
652
+ showCharCount?: boolean;
653
+ className?: string;
654
+ }
655
+ /**
656
+ * Compact composer for the pill UI.
657
+ * Uses assistant-ui primitives for data binding.
658
+ * Features auto-growing textarea and character count.
659
+ */
660
+ declare const PillComposer: FC<PillComposerProps>;
661
+ /**
662
+ * Minimal composer for collapsed/hovered states
663
+ * Just shows a clickable prompt
664
+ */
665
+ declare const MinimalComposer: FC<{
666
+ onClick: () => void;
667
+ className?: string;
668
+ }>;
669
+ //#endregion
670
+ //#region src/components/pill/ToolStatusBorder.d.ts
671
+ type ToolBorderStatus = 'idle' | 'calling' | 'success' | 'error';
672
+ interface ToolStatusBorderProps {
673
+ status: ToolBorderStatus;
674
+ children: ReactNode;
675
+ className?: string;
676
+ borderRadius?: string;
677
+ }
678
+ /**
679
+ * Minimal animated border for tool execution status.
680
+ *
681
+ * - idle/success: clean, no border (success is the default state)
682
+ * - calling: subtle animated gradient
683
+ * - error: brief red flash with shake
684
+ */
685
+ declare const ToolStatusBorder: FC<ToolStatusBorderProps>;
686
+ //#endregion
687
+ //#region src/components/pill/PillVoice.d.ts
688
+ interface PillVoiceProps {
689
+ /** Callback when voice mode ends */
690
+ onEnd?: () => void;
691
+ /** Whether to show a compact version */
692
+ compact?: boolean;
693
+ /** Additional class name */
694
+ className?: string;
695
+ }
696
+ /**
697
+ * Convert voice mode tool call status to border status
698
+ */
699
+
700
+ /**
701
+ * Compact voice mode UI for the pill.
702
+ * Shows waveforms, controls, and transcript preview.
703
+ * Uses motion animations for smooth transitions.
704
+ */
705
+ declare const PillVoice: FC<PillVoiceProps>;
706
+ /**
707
+ * Hook to get voice border status for the pill container
708
+ */
709
+ declare function useVoiceBorderStatus(): ToolBorderStatus;
710
+ //#endregion
711
+ //#region src/components/pill/HistorySidebar.d.ts
712
+ /**
713
+ * Represents a conversation in history
714
+ */
715
+ interface Conversation {
716
+ id: string;
717
+ title: string;
718
+ preview: string;
719
+ timestamp: Date;
720
+ messageCount: number;
721
+ }
722
+ interface HistorySidebarProps {
723
+ isOpen: boolean;
724
+ onClose: () => void;
725
+ conversations?: Conversation[];
726
+ selectedId?: string | null;
727
+ onSelectConversation?: (id: string) => void;
728
+ className?: string;
729
+ }
730
+ /**
731
+ * Sidebar panel showing conversation history and full thread view.
732
+ * Opens from the right side of the screen.
733
+ */
734
+ declare const HistorySidebar: FC<HistorySidebarProps>;
735
+ //#endregion
736
+ //#region src/components/assistant-modal.d.ts
737
+ declare const AssistantModal: FC;
738
+ //#endregion
739
+ //#region src/components/Thread.d.ts
740
+ declare const Thread: FC;
741
+ //#endregion
742
+ //#region src/components/Composer.d.ts
743
+ declare const Composer: FC;
744
+ //#endregion
745
+ //#region src/components/thread-with-voice.d.ts
746
+ declare const ThreadWithVoice: FC;
747
+ //#endregion
748
+ //#region src/components/UserMessage.d.ts
749
+ declare const UserMessage: FC;
750
+ //#endregion
751
+ //#region src/components/AssistantMessage.d.ts
752
+ declare const AssistantMessage: FC;
753
+ //#endregion
754
+ //#region src/components/pill/ActionList.d.ts
755
+ interface ActionListProps {
756
+ actions: Action[];
757
+ defaultCollapsed?: boolean;
758
+ className?: string;
759
+ }
760
+ /**
761
+ * Collapsible list of all actions (tool calls) in the current conversation.
762
+ * Shows count in header, expands to show full list with status icons.
763
+ */
764
+ declare const ActionList: FC<ActionListProps>;
765
+ /**
766
+ * Compact inline action summary (for collapsed pill states)
767
+ */
768
+ declare const ActionSummary: FC<{
769
+ actions: Action[];
770
+ className?: string;
771
+ }>;
772
+ //#endregion
773
+ //#region src/components/pill/CurrentActivity.d.ts
774
+ interface CurrentActivityProps {
775
+ currentAction: Action | null;
776
+ recentActions?: Action[];
777
+ showRecent?: boolean;
778
+ className?: string;
779
+ }
780
+ /**
781
+ * Displays the current action the agent is performing,
782
+ * with optional recent completed steps shown below.
783
+ */
784
+ declare const CurrentActivity: FC<CurrentActivityProps>;
785
+ interface ActionStatusIconProps {
786
+ status: Action['status'];
787
+ size?: 'sm' | 'md';
788
+ className?: string;
789
+ }
790
+ /**
791
+ * Icon component for action status
792
+ */
793
+ declare const ActionStatusIcon: FC<ActionStatusIconProps>;
794
+ /**
795
+ * Idle state indicator when no actions are running
796
+ */
797
+ declare const IdleIndicator: FC<{
798
+ className?: string;
799
+ }>;
800
+ //#endregion
801
+ //#region src/components/pill/SummaryBlock.d.ts
802
+ interface SummaryBlockProps {
803
+ summary: string;
804
+ isSuccess?: boolean;
805
+ isError?: boolean;
806
+ actions?: QuickAction[];
568
807
  className?: string;
569
808
  }
570
- declare function VoiceIndicator({
571
- isActive,
572
- isConnecting,
573
- isMuted,
574
- audioLevel,
575
- toolCall,
576
- onStart,
577
- onStop,
578
- onToggleMute,
579
- className
580
- }: VoiceIndicatorProps): react_jsx_runtime0.JSX.Element;
809
+ interface QuickAction {
810
+ label: string;
811
+ onClick: () => void;
812
+ variant?: 'primary' | 'secondary';
813
+ }
814
+ /**
815
+ * Summary block showing the agent's synthesized output.
816
+ * Displayed after task completion instead of token streaming.
817
+ * Uses compact styling with max-height and scrolling for long responses.
818
+ */
819
+ declare const SummaryBlock: FC<SummaryBlockProps>;
820
+ /**
821
+ * Hook to get the latest summary from the thread
822
+ * Returns the last text content from the last assistant message
823
+ */
824
+ declare function useLatestSummary(): string | null;
825
+ /**
826
+ * Welcome message for empty state
827
+ */
828
+ declare const WelcomeMessage: FC<{
829
+ className?: string;
830
+ }>;
831
+ /**
832
+ * Wrapper for conditional content based on thread state
833
+ */
834
+ declare const ThreadContent: FC<{
835
+ empty: ReactNode;
836
+ running: ReactNode;
837
+ complete: ReactNode;
838
+ }>;
581
839
  //#endregion
582
840
  //#region src/components/live-waveform.d.ts
583
841
  type LiveWaveformProps = HTMLAttributes<HTMLDivElement> & {
@@ -611,7 +869,115 @@ declare const LiveWaveform: ({
611
869
  manualAudioLevel,
612
870
  className,
613
871
  ...props
614
- }: LiveWaveformProps) => react_jsx_runtime0.JSX.Element;
872
+ }: LiveWaveformProps) => react_jsx_runtime19.JSX.Element;
873
+ //#endregion
874
+ //#region src/components/voice-indicator.d.ts
875
+ interface VoiceIndicatorProps {
876
+ isActive: boolean;
877
+ isConnecting: boolean;
878
+ isMuted: boolean;
879
+ audioLevel?: AudioLevelData;
880
+ toolCall?: ToolCallData;
881
+ onStart: () => void;
882
+ onStop: () => void;
883
+ onToggleMute: () => void;
884
+ className?: string;
885
+ }
886
+ declare function VoiceIndicator({
887
+ isActive,
888
+ isConnecting,
889
+ isMuted,
890
+ audioLevel,
891
+ toolCall,
892
+ onStart,
893
+ onStop,
894
+ onToggleMute,
895
+ className
896
+ }: VoiceIndicatorProps): react_jsx_runtime19.JSX.Element;
897
+ //#endregion
898
+ //#region src/components/pill/PillMarkdown.d.ts
899
+ interface PillMarkdownProps {
900
+ content: string;
901
+ className?: string;
902
+ /** Compact mode uses smaller text and tighter spacing */
903
+ compact?: boolean;
904
+ }
905
+ /**
906
+ * Markdown component for rendering content within pill UI.
907
+ * Supports GitHub-flavored markdown with compact styling option.
908
+ */
909
+ declare const PillMarkdown: FC<PillMarkdownProps>;
910
+ //#endregion
911
+ //#region src/web-component.d.ts
912
+ /** View mode for the agent UI */
913
+ type AgentViewMode = 'pill' | 'modal';
914
+ /**
915
+ * Props for the EmbeddedAgent React component
916
+ *
917
+ * These props map to HTML attributes in kebab-case when used as a web component:
918
+ * - appId -> app-id
919
+ * - apiBase -> api-base
920
+ * - tokenEndpoint -> token-endpoint
921
+ * - autoConnectLocal -> auto-connect-local
922
+ * - viewMode -> view-mode
923
+ */
924
+ interface EmbeddedAgentProps {
925
+ /** Your app/workspace ID */
926
+ appId: string;
927
+ /** API base URL for your WebMCP worker */
928
+ apiBase?: string;
929
+ /** Voice mode token endpoint (defaults to {apiBase}/api/realtime/session) */
930
+ tokenEndpoint?: string;
931
+ /** Auto-connect to local MCP source (default: true) */
932
+ autoConnectLocal?: boolean;
933
+ /** UI view mode: 'pill' (action-first) or 'modal' (traditional chat) */
934
+ viewMode?: AgentViewMode;
935
+ /** Callback when tools are updated */
936
+ onToolsChange?: (tools: unknown[]) => void;
937
+ /** Callback when voice mode errors */
938
+ onVoiceError?: (error: string) => void;
939
+ /** Callback when voice mode connects */
940
+ onVoiceConnect?: () => void;
941
+ /** Callback when voice mode disconnects */
942
+ onVoiceDisconnect?: (duration: number) => void;
943
+ }
944
+ /**
945
+ * EmbeddedAgent React Component
946
+ *
947
+ * A fully self-contained chat widget with MCP tool support and optional voice mode.
948
+ * Supports two view modes:
949
+ * - 'pill': Action-first compact UI (default)
950
+ * - 'modal': Traditional chat modal
951
+ *
952
+ * Can be used as a React component or converted to a web component.
953
+ */
954
+ declare const EmbeddedAgent: FC<EmbeddedAgentProps>;
955
+ /**
956
+ * Web Component Definition
957
+ *
958
+ * Converts EmbeddedAgent to a custom element that can be used in any HTML page.
959
+ * Attributes are automatically converted from kebab-case to camelCase props.
960
+ */
961
+ declare const WebMCPAgentElement: CustomElementConstructor;
962
+ /**
963
+ * Register the custom element
964
+ *
965
+ * Call this function to register the <webmcp-agent> custom element.
966
+ * This is automatically called when importing the web-component entry point.
967
+ * Styles are automatically injected into the document head.
968
+ */
969
+ declare function registerWebMCPAgent(tagName?: string): void;
970
+ //#endregion
971
+ //#region src/components/markdown-text.d.ts
972
+ declare const MarkdownText: react0.MemoExoticComponent<() => react_jsx_runtime19.JSX.Element>;
973
+ //#endregion
974
+ //#region src/components/tool-fallback.d.ts
975
+ declare const ToolFallback: ToolCallMessagePartComponent;
976
+ //#endregion
977
+ //#region src/components/attachment.d.ts
978
+ declare const UserMessageAttachments: FC;
979
+ declare const ComposerAttachments: FC;
980
+ declare const ComposerAddAttachment: FC;
615
981
  //#endregion
616
982
  //#region src/components/realtime-tool-card.d.ts
617
983
  interface RealtimeToolCardProps {
@@ -625,7 +991,7 @@ interface RealtimeToolCardProps {
625
991
  declare function RealtimeToolCard({
626
992
  toolCall,
627
993
  className
628
- }: RealtimeToolCardProps): react_jsx_runtime0.JSX.Element;
994
+ }: RealtimeToolCardProps): react_jsx_runtime19.JSX.Element;
629
995
  //#endregion
630
996
  //#region src/components/MCPToolRegistry.d.ts
631
997
  /**
@@ -653,21 +1019,21 @@ declare function Button({
653
1019
  ...props
654
1020
  }: react0.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
655
1021
  asChild?: boolean;
656
- }): react_jsx_runtime0.JSX.Element;
1022
+ }): react_jsx_runtime19.JSX.Element;
657
1023
  //#endregion
658
1024
  //#region src/components/avatar.d.ts
659
1025
  declare function Avatar({
660
1026
  className,
661
1027
  ...props
662
- }: react0.ComponentProps<typeof AvatarPrimitive.Root>): react_jsx_runtime0.JSX.Element;
1028
+ }: react0.ComponentProps<typeof AvatarPrimitive.Root>): react_jsx_runtime19.JSX.Element;
663
1029
  declare function AvatarImage({
664
1030
  className,
665
1031
  ...props
666
- }: react0.ComponentProps<typeof AvatarPrimitive.Image>): react_jsx_runtime0.JSX.Element;
1032
+ }: react0.ComponentProps<typeof AvatarPrimitive.Image>): react_jsx_runtime19.JSX.Element;
667
1033
  declare function AvatarFallback({
668
1034
  className,
669
1035
  ...props
670
- }: react0.ComponentProps<typeof AvatarPrimitive.Fallback>): react_jsx_runtime0.JSX.Element;
1036
+ }: react0.ComponentProps<typeof AvatarPrimitive.Fallback>): react_jsx_runtime19.JSX.Element;
671
1037
  //#endregion
672
1038
  //#region src/components/badge.d.ts
673
1039
  declare const badgeVariants: (props?: ({
@@ -678,25 +1044,25 @@ declare function Badge({
678
1044
  className,
679
1045
  variant,
680
1046
  ...props
681
- }: BadgeProps): react_jsx_runtime0.JSX.Element;
1047
+ }: BadgeProps): react_jsx_runtime19.JSX.Element;
682
1048
  //#endregion
683
1049
  //#region src/components/dialog.d.ts
684
1050
  declare function Dialog({
685
1051
  ...props
686
- }: react0.ComponentProps<typeof DialogPrimitive.Root>): react_jsx_runtime0.JSX.Element;
1052
+ }: react0.ComponentProps<typeof DialogPrimitive.Root>): react_jsx_runtime19.JSX.Element;
687
1053
  declare function DialogTrigger({
688
1054
  ...props
689
- }: react0.ComponentProps<typeof DialogPrimitive.Trigger>): react_jsx_runtime0.JSX.Element;
1055
+ }: react0.ComponentProps<typeof DialogPrimitive.Trigger>): react_jsx_runtime19.JSX.Element;
690
1056
  declare function DialogPortal({
691
1057
  ...props
692
- }: react0.ComponentProps<typeof DialogPrimitive.Portal>): react_jsx_runtime0.JSX.Element;
1058
+ }: react0.ComponentProps<typeof DialogPrimitive.Portal>): react_jsx_runtime19.JSX.Element;
693
1059
  declare function DialogClose({
694
1060
  ...props
695
- }: react0.ComponentProps<typeof DialogPrimitive.Close>): react_jsx_runtime0.JSX.Element;
1061
+ }: react0.ComponentProps<typeof DialogPrimitive.Close>): react_jsx_runtime19.JSX.Element;
696
1062
  declare function DialogOverlay({
697
1063
  className,
698
1064
  ...props
699
- }: react0.ComponentProps<typeof DialogPrimitive.Overlay>): react_jsx_runtime0.JSX.Element;
1065
+ }: react0.ComponentProps<typeof DialogPrimitive.Overlay>): react_jsx_runtime19.JSX.Element;
700
1066
  declare function DialogContent({
701
1067
  className,
702
1068
  children,
@@ -704,35 +1070,35 @@ declare function DialogContent({
704
1070
  ...props
705
1071
  }: react0.ComponentProps<typeof DialogPrimitive.Content> & {
706
1072
  showCloseButton?: boolean;
707
- }): react_jsx_runtime0.JSX.Element;
1073
+ }): react_jsx_runtime19.JSX.Element;
708
1074
  declare function DialogHeader({
709
1075
  className,
710
1076
  ...props
711
- }: react0.ComponentProps<'div'>): react_jsx_runtime0.JSX.Element;
1077
+ }: react0.ComponentProps<'div'>): react_jsx_runtime19.JSX.Element;
712
1078
  declare function DialogFooter({
713
1079
  className,
714
1080
  ...props
715
- }: react0.ComponentProps<'div'>): react_jsx_runtime0.JSX.Element;
1081
+ }: react0.ComponentProps<'div'>): react_jsx_runtime19.JSX.Element;
716
1082
  declare function DialogTitle({
717
1083
  className,
718
1084
  ...props
719
- }: react0.ComponentProps<typeof DialogPrimitive.Title>): react_jsx_runtime0.JSX.Element;
1085
+ }: react0.ComponentProps<typeof DialogPrimitive.Title>): react_jsx_runtime19.JSX.Element;
720
1086
  declare function DialogDescription({
721
1087
  className,
722
1088
  ...props
723
- }: react0.ComponentProps<typeof DialogPrimitive.Description>): react_jsx_runtime0.JSX.Element;
1089
+ }: react0.ComponentProps<typeof DialogPrimitive.Description>): react_jsx_runtime19.JSX.Element;
724
1090
  //#endregion
725
1091
  //#region src/components/scroll-area.d.ts
726
1092
  declare function ScrollArea({
727
1093
  className,
728
1094
  children,
729
1095
  ...props
730
- }: react0.ComponentProps<typeof ScrollAreaPrimitive.Root>): react_jsx_runtime0.JSX.Element;
1096
+ }: react0.ComponentProps<typeof ScrollAreaPrimitive.Root>): react_jsx_runtime19.JSX.Element;
731
1097
  declare function ScrollBar({
732
1098
  className,
733
1099
  orientation,
734
1100
  ...props
735
- }: react0.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>): react_jsx_runtime0.JSX.Element;
1101
+ }: react0.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>): react_jsx_runtime19.JSX.Element;
736
1102
  //#endregion
737
1103
  //#region src/components/separator.d.ts
738
1104
  declare function Separator({
@@ -740,25 +1106,25 @@ declare function Separator({
740
1106
  orientation,
741
1107
  decorative,
742
1108
  ...props
743
- }: react0.ComponentProps<typeof SeparatorPrimitive.Root>): react_jsx_runtime0.JSX.Element;
1109
+ }: react0.ComponentProps<typeof SeparatorPrimitive.Root>): react_jsx_runtime19.JSX.Element;
744
1110
  //#endregion
745
1111
  //#region src/components/tooltip.d.ts
746
1112
  declare function TooltipProvider({
747
1113
  delayDuration,
748
1114
  ...props
749
- }: react0.ComponentProps<typeof TooltipPrimitive.Provider>): react_jsx_runtime0.JSX.Element;
1115
+ }: react0.ComponentProps<typeof TooltipPrimitive.Provider>): react_jsx_runtime19.JSX.Element;
750
1116
  declare function Tooltip({
751
1117
  ...props
752
- }: react0.ComponentProps<typeof TooltipPrimitive.Root>): react_jsx_runtime0.JSX.Element;
1118
+ }: react0.ComponentProps<typeof TooltipPrimitive.Root>): react_jsx_runtime19.JSX.Element;
753
1119
  declare function TooltipTrigger({
754
1120
  ...props
755
- }: react0.ComponentProps<typeof TooltipPrimitive.Trigger>): react_jsx_runtime0.JSX.Element;
1121
+ }: react0.ComponentProps<typeof TooltipPrimitive.Trigger>): react_jsx_runtime19.JSX.Element;
756
1122
  declare function TooltipContent({
757
1123
  className,
758
1124
  sideOffset,
759
1125
  children,
760
1126
  ...props
761
- }: react0.ComponentProps<typeof TooltipPrimitive.Content>): react_jsx_runtime0.JSX.Element;
1127
+ }: react0.ComponentProps<typeof TooltipPrimitive.Content>): react_jsx_runtime19.JSX.Element;
762
1128
  //#endregion
763
1129
  //#region src/components/tooltip-icon-button.d.ts
764
1130
  type TooltipIconButtonProps = ComponentPropsWithRef<typeof Button> & {
@@ -767,59 +1133,13 @@ type TooltipIconButtonProps = ComponentPropsWithRef<typeof Button> & {
767
1133
  };
768
1134
  declare const TooltipIconButton: react0.ForwardRefExoticComponent<Omit<TooltipIconButtonProps, "ref"> & react0.RefAttributes<HTMLButtonElement>>;
769
1135
  //#endregion
770
- //#region src/providers/MCPToolsProvider.d.ts
771
- /** Well-known source IDs */
772
- declare const SOURCE_LOCAL = "local";
773
- declare const SOURCE_REMOTE = "remote";
774
- /**
775
- * MCP Tools Context Value
776
- */
777
- interface MCPToolsContextValue {
778
- /** All tools from all sources, tagged with _sourceId */
779
- tools: ToolWithSource[];
780
- /** All sources and their states */
781
- sources: Map<string, MCPSource>;
782
- /** Add a new source */
783
- addSource: (id: string, config: MCPSourceConfig) => Promise<void>;
784
- /** Remove a source */
785
- removeSource: (id: string) => Promise<void>;
786
- /** Get a specific source */
787
- getSource: (id: string) => MCPSource | undefined;
788
- /** Check if a source is connected */
789
- isConnected: (id: string) => boolean;
790
- /** Call a tool (auto-routes based on tool name lookup) */
791
- callTool: (name: string, args: Record<string, unknown>) => Promise<CallToolResult>;
792
- /** Call a tool on a specific source */
793
- callToolOnSource: (sourceId: string, name: string, args: Record<string, unknown>) => Promise<CallToolResult>;
794
- }
795
- interface MCPToolsProviderProps {
796
- children: ReactNode;
797
- /** Auto-connect to same-tab source on mount (default: true) */
798
- autoConnectLocal?: boolean;
799
- /** Callback when tools change */
800
- onToolsChange?: (tools: ToolWithSource[]) => void;
801
- }
802
- declare function MCPToolsProvider({
803
- children,
804
- autoConnectLocal,
805
- onToolsChange
806
- }: MCPToolsProviderProps): react_jsx_runtime0.JSX.Element;
807
- /**
808
- * Hook to access MCP Tools context
809
- */
810
- declare function useMCPTools(): MCPToolsContextValue;
811
- /**
812
- * Hook to optionally access MCP Tools context
813
- */
814
- declare function useOptionalMCPTools(): MCPToolsContextValue | null;
815
- //#endregion
816
- //#region src/hooks/useVoiceMode.d.ts
817
- interface UseVoiceModeOptions {
1136
+ //#region src/hooks/useAgentSdkVoiceMode.d.ts
1137
+ interface UseAgentSdkVoiceModeOptions {
818
1138
  /** Endpoint to get ephemeral tokens from */
819
1139
  tokenEndpoint: string;
820
- /** Tools available for the voice session */
1140
+ /** Tools available for the voice session (MCP format with JSON Schema) */
821
1141
  tools?: RegisteredTool[];
822
- /** Tool executor function */
1142
+ /** Tool executor function that routes calls to MCP */
823
1143
  toolExecutor?: ToolExecutor;
824
1144
  /** Callback when session connects */
825
1145
  onConnect?: () => void;
@@ -832,9 +1152,9 @@ interface UseVoiceModeOptions {
832
1152
  /** Callback when assistant transcript is complete */
833
1153
  onAssistantTranscript?: (text: string) => void;
834
1154
  }
835
- interface UseVoiceModeReturn extends VoiceModeState {
1155
+ interface UseAgentSdkVoiceModeReturn extends VoiceModeState {
836
1156
  /** Start voice session */
837
- startSession: (config?: RealtimeConfig) => Promise<void>;
1157
+ startSession: () => Promise<void>;
838
1158
  /** Stop voice session */
839
1159
  stopSession: () => void;
840
1160
  /** Toggle microphone mute */
@@ -842,22 +1162,17 @@ interface UseVoiceModeReturn extends VoiceModeState {
842
1162
  /** Send text message while in voice mode */
843
1163
  sendMessage: (text: string) => void;
844
1164
  }
845
- declare function useVoiceMode(options: UseVoiceModeOptions): UseVoiceModeReturn;
1165
+ declare function useAgentSdkVoiceMode(options: UseAgentSdkVoiceModeOptions): UseAgentSdkVoiceModeReturn;
846
1166
  //#endregion
847
- //#region src/providers/VoiceModeProvider.d.ts
848
- /**
849
- * Voice Mode Provider
850
- *
851
- * Provides voice mode state and controls to the component tree.
852
- */
853
- interface VoiceModeContextValue extends UseVoiceModeReturn {
1167
+ //#region src/providers/AgentSdkVoiceModeProvider.d.ts
1168
+ interface AgentSdkVoiceModeContextValue extends UseAgentSdkVoiceModeReturn {
854
1169
  isSupported: boolean;
855
1170
  }
856
- interface VoiceModeProviderProps {
1171
+ interface AgentSdkVoiceModeProviderProps {
857
1172
  children: ReactNode;
858
1173
  /** Backend endpoint for ephemeral tokens */
859
1174
  tokenEndpoint: string;
860
- /** Tools available for voice mode */
1175
+ /** Tools available for voice mode (MCP format) */
861
1176
  tools?: RegisteredTool[];
862
1177
  /** Tool executor function */
863
1178
  toolExecutor?: ToolExecutor;
@@ -872,7 +1187,7 @@ interface VoiceModeProviderProps {
872
1187
  /** Callback when assistant transcript is complete */
873
1188
  onAssistantTranscript?: (text: string) => void;
874
1189
  }
875
- declare function VoiceModeProvider({
1190
+ declare function AgentSdkVoiceModeProvider({
876
1191
  children,
877
1192
  tokenEndpoint,
878
1193
  tools,
@@ -882,15 +1197,31 @@ declare function VoiceModeProvider({
882
1197
  onError,
883
1198
  onUserTranscript,
884
1199
  onAssistantTranscript
885
- }: VoiceModeProviderProps): react_jsx_runtime0.JSX.Element;
1200
+ }: AgentSdkVoiceModeProviderProps): react_jsx_runtime19.JSX.Element;
886
1201
  /**
887
- * Hook to access voice mode context
1202
+ * Hook to access Agent SDK voice mode context
888
1203
  */
889
- declare function useVoiceModeContext(): VoiceModeContextValue;
1204
+ declare function useAgentSdkVoiceModeContext(): AgentSdkVoiceModeContextValue;
890
1205
  /**
891
- * Hook to optionally access voice mode context (returns null if not in provider)
1206
+ * Hook to optionally access Agent SDK voice mode context (returns null if not in provider)
892
1207
  */
893
- declare function useOptionalVoiceModeContext(): VoiceModeContextValue | null;
1208
+ declare function useOptionalAgentSdkVoiceModeContext(): AgentSdkVoiceModeContextValue | null;
1209
+ //#endregion
1210
+ //#region src/providers/AgentSdkVoiceMCPBridge.d.ts
1211
+ interface AgentSdkVoiceMCPBridgeProps {
1212
+ children: ReactNode;
1213
+ tokenEndpoint: string;
1214
+ onError?: (error: string) => void;
1215
+ onConnect?: () => void;
1216
+ onDisconnect?: (duration: number) => void;
1217
+ onUserTranscript?: (text: string) => void;
1218
+ onAssistantTranscript?: (text: string) => void;
1219
+ }
1220
+ /**
1221
+ * Bridge component that connects MCP tools to AgentSdkVoiceModeProvider.
1222
+ * Uses the MCP context and provides tools + executor to the SDK-based voice mode.
1223
+ */
1224
+ declare const AgentSdkVoiceMCPBridge: FC<AgentSdkVoiceMCPBridgeProps>;
894
1225
  //#endregion
895
1226
  //#region src/providers/ChatRuntimeProvider.d.ts
896
1227
  interface ChatRuntimeProviderProps {
@@ -1268,45 +1599,6 @@ declare function shouldFallbackToSSE(error: Error): boolean;
1268
1599
  */
1269
1600
  declare function calculateReconnectDelay(attempt: number, baseDelay: number, maxDelay: number): number;
1270
1601
  //#endregion
1271
- //#region src/lib/constants.d.ts
1272
- /**
1273
- * Shared Constants
1274
- *
1275
- * Centralized location for all magic numbers, timeouts, and configuration values.
1276
- * Having these in one place makes the codebase more maintainable and easier to tune.
1277
- */
1278
- /** Maximum number of reconnection attempts before giving up */
1279
- declare const MCP_MAX_RECONNECT_ATTEMPTS = 5;
1280
- /** Base delay in milliseconds for exponential backoff reconnection */
1281
- declare const MCP_BASE_RECONNECT_DELAY_MS = 1000;
1282
- /** Maximum reconnect delay in milliseconds (caps exponential backoff) */
1283
- declare const MCP_MAX_RECONNECT_DELAY_MS = 30000;
1284
- /** Delay before auto-connecting to tab-based MCP sources (allows server initialization) */
1285
- declare const MCP_TAB_CONNECT_DELAY_MS = 100;
1286
- /** Number of frequency bins for audio visualization */
1287
- declare const AUDIO_FREQUENCY_BINS = 32;
1288
- /** Default OpenAI Realtime model */
1289
- declare const REALTIME_DEFAULT_MODEL = "gpt-4o-realtime-preview-2024-12-17";
1290
- /** Default voice for OpenAI Realtime */
1291
- declare const REALTIME_DEFAULT_VOICE = "verse";
1292
- /** Default OpenAI Realtime API URL */
1293
- declare const REALTIME_DEFAULT_API_URL = "https://api.openai.com/v1/realtime";
1294
- /**
1295
- * Enable debug logging for development.
1296
- * Can be enabled by setting window.__WEBMCP_DEBUG__ = true in the browser console.
1297
- * In production builds, this defaults to false.
1298
- */
1299
- declare const DEBUG_LOGGING_ENABLED: boolean;
1300
- /**
1301
- * Conditional debug logger that only logs when DEBUG_LOGGING_ENABLED is true.
1302
- * Can be enabled at runtime by setting window.__WEBMCP_DEBUG__ = true
1303
- *
1304
- * @param component - The component or service name for the log prefix
1305
- * @param message - The log message
1306
- * @param data - Optional data to include in the log
1307
- */
1308
- declare function debugLog(component: string, message: string, data?: unknown): void;
1309
- //#endregion
1310
1602
  //#region src/embed.d.ts
1311
1603
  /**
1312
1604
  * WebMCP Embedded Agent - Intercom-style Installation
@@ -1394,5 +1686,5 @@ declare global {
1394
1686
  }
1395
1687
  }
1396
1688
  //#endregion
1397
- export { AUDIO_FREQUENCY_BINS, type Action, ActionList, ActionStatusIcon, ActionSummary, AgentPill, type AgentViewMode, AssistantMessage, AssistantModal, type AssistantTranscriptEventData, type AudioLevelData, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, Button, type ButtonProps, ChatRuntimeProvider, type ChatRuntimeProviderProps, Composer, ComposerAddAttachment, ComposerAttachments, type Conversation, CurrentActivity, DEBUG_LOGGING_ENABLED, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, EmbeddedAgent, type EmbeddedAgentProps, type ErrorEventData, HistorySidebar, IdleIndicator, LiveWaveform, MCPToolRegistry, type MCPToolsContextValue, MCPToolsProvider, type MCPToolsProviderProps, MCP_BASE_RECONNECT_DELAY_MS, MCP_MAX_RECONNECT_ATTEMPTS, MCP_MAX_RECONNECT_DELAY_MS, MCP_TAB_CONNECT_DELAY_MS, MarkdownText, MinimalComposer, OpenAIRealtimeService, PillComposer, PillContainer, type PillMode, REALTIME_DEFAULT_API_URL, REALTIME_DEFAULT_MODEL, REALTIME_DEFAULT_VOICE, type RealtimeConfig, type RealtimeSession, RealtimeToolCard, type RegisteredTool, RemoteMCPSettings, SOURCE_LOCAL, SOURCE_REMOTE, ScrollArea, ScrollBar, Separator, type SessionStateEventData, SummaryBlock, Thread, ThreadWithVoice, type ToolBorderStatus, type ToolCallCompletedEventData, type ToolCallData, type ToolCallStartedEventData, type ToolExecutor, ToolFallback, ToolStatusBorder, Tooltip, TooltipContent, TooltipIconButton, TooltipProvider, TooltipTrigger, type TranscriptData, type TransportType, type UseAgentChatOptions, type UseAgentChatReturn, type UseMCPSourceOptions, type UseMCPSourceReturn, type UseVoiceModeOptions, type UseVoiceModeReturn, UserMessage, UserMessageAttachments, type UserTranscriptEventData, VoiceIndicator, VoiceModeProvider, type VoiceModeProviderProps, type VoiceModeState, WebMCPAgentElement, type WebMCPBootOptions, type WebMCPFunction, type WebMCPMethod, type WebMCPSettings, WelcomeMessage, badgeVariants, buttonVariants, calculateReconnectDelay, cn, convertAssistantUIMessage, convertToAssistantUiMessages, createMCPTransport, debugLog, humanizeToolName, isAssistantTranscriptEventData, isAudioLevelData, isErrorEventData, isSessionStateEventData, isToolCallCompletedEventData, isToolCallStartedEventData, isUserTranscriptEventData, registerWebMCPAgent, shouldFallbackToSSE, useActionStats, useActions, useAgentChat, useAssistantMCP, useCloudflareRuntime, useCurrentAction, useMCPSource, useMCPTools, useOptionalMCPTools, useOptionalVoiceModeContext, useRecentActions, useVoiceMode, useVoiceModeContext };
1689
+ export { AUDIO_FREQUENCY_BINS, type Action, ActionList, ActionStatusIcon, ActionSummary, AgentPill, type AgentPillProps, AgentProvider, type AgentProviderProps, AgentSdkVoiceMCPBridge, type AgentSdkVoiceMCPBridgeProps, AgentSdkVoiceModeProvider, type AgentSdkVoiceModeProviderProps, type AgentState, type AgentTools, type AgentViewMode, type AgentVoice, AssistantMessage, AssistantModal, type AssistantTranscriptEventData, type AudioLevelData, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, Button, type ButtonProps, ChatRuntimeProvider, type ChatRuntimeProviderProps, Composer, ComposerAddAttachment, ComposerAttachments, type Conversation, CurrentActivity, DEBUG_LOGGING_ENABLED, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, EmbeddedAgent, type EmbeddedAgentProps, type ErrorEventData, HistorySidebar, IdleIndicator, LiveWaveform, MCPToolRegistry, type MCPToolsContextValue, MCPToolsProvider, type MCPToolsProviderProps, MCP_BASE_RECONNECT_DELAY_MS, MCP_MAX_RECONNECT_ATTEMPTS, MCP_MAX_RECONNECT_DELAY_MS, MCP_TAB_CONNECT_DELAY_MS, MarkdownText, MinimalComposer, OpenAIRealtimeService, PillComposer, PillContainer, PillMarkdown, type PillMode, type PillPosition, PillVoice, REALTIME_DEFAULT_API_URL, REALTIME_DEFAULT_MODEL, REALTIME_DEFAULT_VOICE, type RealtimeConfig, type RealtimeSession, RealtimeToolCard, type RegisteredTool, RemoteMCPSettings, SOURCE_LOCAL, SOURCE_REMOTE, ScrollArea, ScrollBar, Separator, type SessionStateEventData, SummaryBlock, Thread, ThreadContent, ThreadWithVoice, type ToolBorderStatus, type ToolCallCompletedEventData, type ToolCallData, type ToolCallStartedEventData, type ToolExecutor, ToolFallback, ToolStatusBorder, Tooltip, TooltipContent, TooltipIconButton, TooltipProvider, TooltipTrigger, type TranscriptData, type TransportType, type UseAgentChatOptions, type UseAgentChatReturn, type UseAgentSdkVoiceModeOptions, type UseAgentSdkVoiceModeReturn, type UseMCPSourceOptions, type UseMCPSourceReturn, type UseVoiceModeOptions, type UseVoiceModeReturn, UserMessage, UserMessageAttachments, type UserTranscriptEventData, VOICE_ACTIONS_RETENTION_MS, VOICE_SUMMARY_RETENTION_MS, VoiceIndicator, VoiceModeProvider, type VoiceModeProviderProps, type VoiceModeState, type VoiceSummary, WebMCPAgentElement, type WebMCPBootOptions, type WebMCPFunction, type WebMCPMethod, type WebMCPSettings, WelcomeMessage, badgeVariants, buttonVariants, calculateReconnectDelay, cn, convertAssistantUIMessage, convertToAssistantUiMessages, createMCPTransport, debugLog, humanizeToolName, isAssistantTranscriptEventData, isAudioLevelData, isErrorEventData, isSessionStateEventData, isToolCallCompletedEventData, isToolCallStartedEventData, isUserTranscriptEventData, registerWebMCPAgent, shouldFallbackToSSE, useActionStats, useActions, useAgent, useAgentChat, useAgentSdkVoiceMode, useAgentSdkVoiceModeContext, useAssistantMCP, useCloudflareRuntime, useCurrentAction, useCurrentVoiceAction, useHasVoiceSummary, useIsAgentAvailable, useLatestSummary, useMCPSource, useMCPTools, useOptionalAgentSdkVoiceModeContext, useOptionalMCPTools, useOptionalVoiceModeContext, useRecentActions, useRecentVoiceActions, useVoiceActions, useVoiceBorderStatus, useVoiceMode, useVoiceModeContext, useVoiceSummary };
1398
1690
  //# sourceMappingURL=index.d.ts.map