@botdojo/chat-sdk 0.0.20 → 0.0.22

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 CHANGED
@@ -1632,6 +1632,13 @@ interface BotDojoChatProviderProps {
1632
1632
  /** @deprecated Connector is no longer used in headless mode. Callback receives null. */
1633
1633
  onConnectorInit?: (connector: BotDojoConnector$1 | null) => void;
1634
1634
  onConnectorError?: (error: Error) => void;
1635
+ /**
1636
+ * Enable debug mode for MCP App rendering.
1637
+ * When true, shows detailed error messages if MCP Apps fail to render.
1638
+ * When false (default), silently returns null for failed MCP Apps.
1639
+ * @default false
1640
+ */
1641
+ debug?: boolean;
1635
1642
  /**
1636
1643
  * Called when an MCP App requests to open a link (ui/open-link)
1637
1644
  * The host application should handle navigation - links are NOT automatically opened
@@ -1766,22 +1773,27 @@ declare function BotDojoCanvasFrame(props: BotDojoCanvasFrameProps): JSX.Element
1766
1773
  * McpAppHost Component
1767
1774
  *
1768
1775
  * Hosts an MCP App in an iframe with full JSON-RPC communication.
1769
- * Handles ui/initialize, ui/message, tools/call, ui/open-link and other MCP-UI events.
1776
+ * Uses the shared useMcpHostBridge hook from sdk-canvas for all protocol handling.
1770
1777
  */
1771
1778
 
1772
1779
  /**
1773
1780
  * Props for McpAppHost component
1774
1781
  *
1775
- * The component gets all MCP App data (HTML, arguments, result, etc.) automatically
1776
- * from BotDojoChatProvider via context. Parents only need to pass the mcpAppId.
1782
+ * MCP App data (HTML, arguments, result, etc.) is provided by BotDojoChatProvider
1783
+ * via context. Parents only need to pass the mcpAppId.
1777
1784
  */
1778
1785
  interface McpAppHostProps {
1779
1786
  /**
1780
1787
  * Unique identifier for this MCP App instance.
1781
- * McpAppHost will get HTML, arguments, result, and other data from
1782
- * BotDojoChatProvider's cache using this ID.
1788
+ * McpAppHost gets HTML, arguments, result from BotDojoChatProvider's cache.
1783
1789
  */
1784
1790
  mcpAppId: string;
1791
+ /**
1792
+ * Optional resource URI (e.g., ui://my-app/main) to resolve on demand.
1793
+ * Used for hydration when the cache doesn't have HTML yet.
1794
+ * If not provided, the component relies on cached data from streaming.
1795
+ */
1796
+ resourceUri?: string;
1785
1797
  /**
1786
1798
  * Called when app requests to open a link (ui/open-link)
1787
1799
  * Links are NOT automatically opened - host must handle this
@@ -1834,23 +1846,27 @@ interface McpAppHostProps {
1834
1846
  /**
1835
1847
  * McpAppHost - Hosts an MCP App iframe with full event handling
1836
1848
  *
1837
- * All MCP App data (HTML, arguments, result, etc.) is automatically provided
1849
+ * All MCP App data (URL, arguments, result, etc.) is automatically provided
1838
1850
  * by BotDojoChatProvider via context. Parents only need to pass the mcpAppId.
1839
1851
  *
1852
+ * When no valid URL is available:
1853
+ * - If debug=false (production): Returns null (no empty iframe)
1854
+ * - If debug=true: Shows error details to help developers diagnose issues
1855
+ *
1840
1856
  * @example
1841
1857
  * ```tsx
1842
1858
  * // Simple usage - just pass the mcpAppId
1843
1859
  * <McpAppHost mcpAppId={step.canvas.canvasId} />
1844
1860
  *
1845
- * // With event handlers
1861
+ * // With debug mode for development
1846
1862
  * <McpAppHost
1847
1863
  * mcpAppId={step.canvas.canvasId}
1864
+ * debug={true}
1848
1865
  * onOpenLink={(url, target, appId) => window.open(url, target)}
1849
- * onReady={(appId) => console.log('App ready:', appId)}
1850
1866
  * />
1851
1867
  * ```
1852
1868
  */
1853
- declare function McpAppHost(props: McpAppHostProps): JSX.Element;
1869
+ declare function McpAppHost(props: McpAppHostProps): JSX.Element | null;
1854
1870
 
1855
1871
  /**
1856
1872
  * useMcpAppHost Hook