@botdojo/chat-sdk 0.0.9 → 0.0.11
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/lib/index.d.ts +36 -39
- package/lib/index.js +6646 -1519
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -558,11 +558,16 @@ interface HeadlessChatHandle {
|
|
|
558
558
|
*/
|
|
559
559
|
|
|
560
560
|
/**
|
|
561
|
-
*
|
|
561
|
+
* Action from an MCP App embedded iframe (SEP-1865 aligned)
|
|
562
|
+
*
|
|
563
|
+
* Types map to MCP Apps JSON-RPC methods:
|
|
564
|
+
* - 'open-link' → ui/open-link
|
|
565
|
+
* - 'tool-call' → tools/call
|
|
566
|
+
* - 'message' → ui/message
|
|
562
567
|
*/
|
|
563
|
-
interface
|
|
564
|
-
type: '
|
|
565
|
-
|
|
568
|
+
interface AppAction {
|
|
569
|
+
type: 'open-link' | 'tool-call' | 'message';
|
|
570
|
+
appId: string;
|
|
566
571
|
payload: any;
|
|
567
572
|
}
|
|
568
573
|
/**
|
|
@@ -679,8 +684,8 @@ interface ChatActionsHook {
|
|
|
679
684
|
bargeInRequest: (text: string) => void;
|
|
680
685
|
setSessionId: (sessionId: string) => void;
|
|
681
686
|
reload: () => void;
|
|
682
|
-
/** Persist
|
|
683
|
-
|
|
687
|
+
/** Persist MCP App state to the server */
|
|
688
|
+
persistAppState: (appId: string, state: Record<string, any>) => void;
|
|
684
689
|
}
|
|
685
690
|
interface BotDojoChatProviderProps {
|
|
686
691
|
apiKey: string;
|
|
@@ -693,44 +698,33 @@ interface BotDojoChatProviderProps {
|
|
|
693
698
|
onReady?: () => void;
|
|
694
699
|
onSessionCreated?: (sessionId: string) => void;
|
|
695
700
|
onSessionHydrated?: (messageCount: number) => void;
|
|
696
|
-
|
|
701
|
+
/** @deprecated Connector is no longer used in headless mode. Callback receives null. */
|
|
702
|
+
onConnectorInit?: (connector: BotDojoConnector$1 | null) => void;
|
|
697
703
|
onConnectorError?: (error: Error) => void;
|
|
698
704
|
/**
|
|
699
|
-
*
|
|
700
|
-
*
|
|
701
|
-
* @param
|
|
702
|
-
* @param
|
|
703
|
-
* @
|
|
704
|
-
*/
|
|
705
|
-
onCanvasIntent?: (intent: string, params: any, canvasId: string) => Promise<any> | void;
|
|
706
|
-
/**
|
|
707
|
-
* Handler for canvas notify messages (canvas already acted, informing host of side effects)
|
|
708
|
-
* @param message - The notification message
|
|
709
|
-
* @param params - Additional notification parameters
|
|
710
|
-
* @param canvasId - ID of the canvas that sent the notification
|
|
711
|
-
*/
|
|
712
|
-
onCanvasNotify?: (message: string, params: any, canvasId: string) => void;
|
|
713
|
-
/**
|
|
714
|
-
* Handler for canvas prompt messages (canvas wants AI agent to respond)
|
|
715
|
-
* @param prompt - The prompt/question for the AI
|
|
716
|
-
* @param params - Additional prompt parameters
|
|
717
|
-
* @param canvasId - ID of the canvas that sent the prompt
|
|
718
|
-
* @returns Promise resolving to AI response, or void to use default behavior
|
|
705
|
+
* Called when an MCP App requests to open a link (ui/open-link)
|
|
706
|
+
* The host application should handle navigation - links are NOT automatically opened
|
|
707
|
+
* @param url - The URL to open
|
|
708
|
+
* @param target - Target window ('_blank', '_self', etc.)
|
|
709
|
+
* @param appId - The MCP App ID that sent the event
|
|
719
710
|
*/
|
|
720
|
-
|
|
711
|
+
onOpenLink?: (url: string, target: string, appId: string) => void;
|
|
721
712
|
/**
|
|
722
|
-
*
|
|
723
|
-
* @param
|
|
724
|
-
* @param
|
|
725
|
-
* @param
|
|
713
|
+
* Called when an MCP App requests a tool execution (tools/call) or sends an intent
|
|
714
|
+
* @param tool - The tool name to execute
|
|
715
|
+
* @param params - Tool parameters
|
|
716
|
+
* @param appId - The MCP App ID that sent the event
|
|
717
|
+
* @returns Tool execution result (async)
|
|
726
718
|
*/
|
|
727
|
-
|
|
719
|
+
onToolCall?: (tool: string, params: any, appId: string) => Promise<any> | void;
|
|
728
720
|
/**
|
|
729
|
-
*
|
|
730
|
-
*
|
|
731
|
-
* @
|
|
721
|
+
* Called when an MCP App sends a UI message (ui/message)
|
|
722
|
+
* This includes notify, prompt, update, and general message events
|
|
723
|
+
* @param message - The message content or payload
|
|
724
|
+
* @param params - Additional message parameters
|
|
725
|
+
* @param appId - The MCP App ID that sent the event
|
|
732
726
|
*/
|
|
733
|
-
|
|
727
|
+
onUiMessage?: (message: string, params: any, appId: string) => void;
|
|
734
728
|
}
|
|
735
729
|
|
|
736
730
|
/**
|
|
@@ -740,7 +734,7 @@ interface BotDojoChatProviderProps {
|
|
|
740
734
|
*
|
|
741
735
|
* This component:
|
|
742
736
|
* 1. Creates a hidden iframe with /embed/headless for all communication
|
|
743
|
-
* 2. Manages
|
|
737
|
+
* 2. Manages MCP App iframe bridges for rendering
|
|
744
738
|
* 3. Listens to postMessage events from iframe
|
|
745
739
|
* 4. Updates React state via reducer
|
|
746
740
|
* 5. Exposes state and actions via context
|
|
@@ -1262,4 +1256,7 @@ declare function MockCanvasProvider({ children, mockCanvasData, onSendMessage, d
|
|
|
1262
1256
|
*/
|
|
1263
1257
|
declare function useBotDojoCanvas(): UseBotDojoCanvasReturn;
|
|
1264
1258
|
|
|
1265
|
-
|
|
1259
|
+
/** @deprecated Use AppAction instead */
|
|
1260
|
+
type CanvasAction = AppAction;
|
|
1261
|
+
|
|
1262
|
+
export { type AppAction, type AppContextValue, type AppEvent, BotDojoCanvasFrame, type BotDojoCanvasFrameProps, BotDojoCanvasProvider, type BotDojoCanvasProviderProps, BotDojoChat, type BotDojoChatConfig, BotDojoChatConfigurator, type BotDojoChatConfiguratorProps, type BotDojoChatControl, type BotDojoChatDisplayMode, type BotDojoChatHook, type BotDojoChatProps, BotDojoChatProvider, type BotDojoChatProviderProps, type CanvasAction, type CanvasActionOptions, type CanvasEvent, type CanvasMode, type ChatActionsHook, type ChatConfig, type ChatMessage, type ChatMessagesHook, type ChatStatus, type ChatStatusHook, type HeadlessAction, HeadlessChat, type HeadlessChatHandle, type HeadlessChatProps, type HeadlessChatState, type HeadlessEvent, type HeadlessMessageEvent, type HeadlessStatusEvent, type HeadlessStepEvent, type HeadlessTokenEvent, type McpAppData, McpAppHost, McpAppHostContext, type McpAppHostContextValue, type McpAppHostProps, McpAppHostProvider, type McpAppHostProviderProps, MockCanvasProvider, type MockCanvasProviderProps, type PopupOptions, type SidePanelOptions, type UiSize, type UseBotDojoCanvasReturn, useBotDojoCanvas, useBotDojoChat, useChatActions, useChatMessages, useChatStatus, useMcpAppHost, useMcpAppHostRequired };
|