/** * Widget Debug Context * * Manages debugging state for MCP Apps and ChatGPT Apps widgets. * Tracks CSP violations, widget state, host context, and playground settings. * * Follows the same React Context pattern as InspectorContext (not Zustand). */ import type { ReactNode } from "react"; type WidgetProtocol = "mcp-apps" | "chatgpt-app" | "mcp-ui"; export interface CspViolation { directive: string; effectiveDirective: string; blockedUri: string; sourceFile?: string; lineNumber?: number; columnNumber?: number; timestamp: number; originalPolicy?: string; } export interface WidgetDeclaredCsp { connectDomains?: string[]; resourceDomains?: string[]; frameDomains?: string[]; baseUriDomains?: string[]; } interface WidgetInfo { toolName: string; protocol: WidgetProtocol; hostContext?: any; cspViolations: CspViolation[]; declaredCsp?: WidgetDeclaredCsp; effectivePolicy?: string; modelContext?: { content?: any[]; structuredContent?: Record; }; widgetState?: any; } export type DeviceType = "mobile" | "tablet" | "desktop" | "custom"; export interface PlaygroundSettings { deviceType: DeviceType; customViewport: { width: number; height: number; }; cspMode: "permissive" | "widget-declared"; displayModeOverride: "inline" | "pip" | "fullscreen" | null; capabilities: { hover: boolean; touch: boolean; }; safeAreaInsets: { top: number; right: number; bottom: number; left: number; }; locale: string; timeZone: string; selectedProtocol: "mcp-apps" | "chatgpt-app" | null; } interface WidgetDebugState { activeWidgetId: string | null; widgets: Map; playground: PlaygroundSettings; } interface WidgetDebugContextType extends WidgetDebugState { setActiveWidget: (widgetId: string | null) => void; addWidget: (widgetId: string, info: Omit) => void; removeWidget: (widgetId: string) => void; getWidget: (widgetId: string) => WidgetInfo | undefined; addCspViolation: (widgetId: string, violation: CspViolation) => void; clearCspViolations: (widgetId: string) => void; setWidgetModelContext: (widgetId: string, context: WidgetInfo["modelContext"]) => void; setWidgetState: (widgetId: string, state: any) => void; setWidgetDeclaredCsp: (widgetId: string, csp: WidgetDeclaredCsp | undefined, effectivePolicy?: string) => void; updatePlaygroundSettings: (settings: Partial) => void; clearAllWidgets: () => void; getAllModelContexts: () => Map; } /** * Provider for widget debugging context * * Manages widget debug state following the same pattern as InspectorProvider */ export declare function WidgetDebugProvider({ children }: { children: ReactNode; }): import("react/jsx-runtime").JSX.Element; /** * Hook to access widget debug context * * @throws Error if used outside of WidgetDebugProvider */ export declare function useWidgetDebug(): WidgetDebugContextType; /** * Device viewport configurations for common devices */ export declare const DEVICE_VIEWPORT_CONFIGS: { readonly mobile: { readonly width: 390; readonly height: 844; readonly name: "iPhone 14"; }; readonly tablet: { readonly width: 820; readonly height: 1180; readonly name: "iPad Air"; }; readonly desktop: { readonly width: 1440; readonly height: 900; readonly name: "Desktop"; }; readonly custom: { readonly width: 768; readonly height: 1024; readonly name: "Custom"; }; }; export {}; //# sourceMappingURL=WidgetDebugContext.d.ts.map