@pancake-apps/web 0.0.0-snapshot-20260125200133

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/unified/detection.ts","../src/unified/defaults.ts","../src/unified/base-adaptor.ts","../src/unified/apps-sdk-adaptor.ts","../src/unified/mcp-apps-adaptor.ts","../src/unified/adaptor.ts"],"names":["deriveDeviceType"],"mappings":";;;;AAkBO,SAAS,kBAAA,GAA8B;AAC5C,EAAA,OAAO,OAAO,MAAA,KAAW,WAAA,IAAe,MAAA,CAAO,MAAA,IAAU,IAAA;AAC3D;AAOO,SAAS,kBAAA,GAA8B;AAC5C,EAAA,IAAI,OAAO,MAAA,KAAW,WAAA,EAAa,OAAO,KAAA;AAG1C,EAAA,IAAI,MAAA,CAAO,uBAAuB,OAAO,IAAA;AAGzC,EAAA,IAAI;AACF,IAAA,OAAO,MAAA,CAAO,SAAS,MAAA,CAAO,GAAA;AAAA,EAChC,CAAA,CAAA,MAAQ;AAEN,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AASO,SAAS,cAAA,GAA+B;AAC7C,EAAA,IAAI,oBAAmB,EAAG;AACxB,IAAA,OAAO,UAAA;AAAA,EACT;AACA,EAAA,OAAO,UAAA;AACT;AAKA,IAAI,cAAA,GAAsC,IAAA;AAEnC,SAAS,WAAA,GAA4B;AAC1C,EAAA,IAAI,mBAAmB,IAAA,EAAM;AAC3B,IAAA,cAAA,GAAiB,cAAA,EAAe;AAAA,EAClC;AACA,EAAA,OAAO,cAAA;AACT;AAKO,SAAS,kBAAA,GAA2B;AACzC,EAAA,cAAA,GAAiB,IAAA;AACnB;;;AC7DO,IAAM,YAAA,GAAkC;AAAA,EAC7C,KAAA,EAAO,OAAA;AAAA,EACP,MAAA,EAAQ,OAAA;AAAA,EACR,WAAA,EAAa,QAAA;AAAA,EACb,SAAA,EAAW,GAAA;AAAA,EACX,QAAA,EAAU,EAAE,GA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AAAA,IACnD;AACA,IAAA,OAAO,IAAA,CAAK,WAAA;AAAA,EACd;AAAA,EAEA,MAAM,WAAA,GAA6B;AACjC,IAAA,IAAI,CAAC,IAAA,CAAK,MAAA,CAAO,aAAA,EAAe;AAC9B,MAAA,MAAM,KAAK,UAAA,EAAW;AAAA,IACxB;AAAA,EACF;AACF,CAAA;;;ACpZA,IAAI,aAAA,GAAuC,IAAA;AAQpC,SAAS,UAAA,GAA6B;AAC3C,EAAA,IAAI,aAAA,EAAe;AACjB,IAAA,OAAO,aAAA;AAAA,EACT;AAEA,EAAA,MAAM,WAAW,WAAA,EAAY;AAE7B,EAAA,IAAI,aAAa,UAAA,EAAY;AAC3B,IAAA,aAAA,GAAgB,IAAI,cAAA,EAAe;AAAA,EACrC,CAAA,MAAO;AACL,IAAA,aAAA,GAAgB,IAAI,cAAA,EAAe;AAAA,EACrC;AAEA,EAAA,OAAO,aAAA;AACT;AAKO,SAAS,YAAA,GAAqB;AACnC,EAAA,aAAA,GAAgB,IAAA;AAChB,EAAA,kBAAA,EAAmB;AACrB","file":"chunk-ZYBPDIEG.js","sourcesContent":["/**\n * Platform Detection\n *\n * Detects which host environment is available.\n */\n\nexport type HostPlatform = 'apps-sdk' | 'mcp-apps';\n\n// Global flag to force MCP mode (for testing/development)\ndeclare global {\n interface Window {\n __PANCAKE_FORCE_MCP__?: boolean;\n }\n}\n\n/**\n * Check if ChatGPT Apps SDK (window.openai) is available\n */\nexport function isAppsSdkAvailable(): boolean {\n return typeof window !== 'undefined' && window.openai != null;\n}\n\n/**\n * Check if MCP Apps environment is likely available\n *\n * MCP Apps uses postMessage, so we check for iframe context\n */\nexport function isMcpAppsAvailable(): boolean {\n if (typeof window === 'undefined') return false;\n\n // Allow forcing MCP mode via global flag (for testing/development)\n if (window.__PANCAKE_FORCE_MCP__) return true;\n\n // In MCP Apps, we're always in an iframe\n try {\n return window.self !== window.top;\n } catch {\n // If we can't access window.top, we're in a sandboxed iframe\n return true;\n }\n}\n\n/**\n * Detect the current host platform\n *\n * Priority:\n * 1. Apps SDK (window.openai) takes precedence if present\n * 2. Falls back to MCP Apps (postMessage)\n */\nexport function detectPlatform(): HostPlatform {\n if (isAppsSdkAvailable()) {\n return 'apps-sdk';\n }\n return 'mcp-apps';\n}\n\n/**\n * Get the current platform (cached after first call)\n */\nlet cachedPlatform: HostPlatform | null = null;\n\nexport function getPlatform(): HostPlatform {\n if (cachedPlatform === null) {\n cachedPlatform = detectPlatform();\n }\n return cachedPlatform;\n}\n\n/**\n * Reset platform cache (for testing)\n */\nexport function resetPlatformCache(): void {\n cachedPlatform = null;\n}\n","/**\n * Shared SSR Defaults\n *\n * These defaults are used during server-side rendering when\n * actual platform values are not yet available.\n */\n\nimport type { AdaptorStoreState } from './types';\n\n/**\n * Sensible default values for SSR\n */\nexport const SSR_DEFAULTS: AdaptorStoreState = {\n theme: 'light',\n locale: 'en-US',\n displayMode: 'inline',\n maxHeight: 400,\n safeArea: { top: 0, right: 0, bottom: 0, left: 0 },\n containerSize: { width: 0, height: 400 },\n containerWidth: 0,\n containerHeight: 400,\n platform: 'web',\n deviceType: 'desktop',\n canHover: true,\n hasCoarsePointer: false,\n inputCapabilities: { canHover: true, hasCoarsePointer: false },\n toolInput: undefined,\n toolInputPartial: undefined,\n toolOutput: undefined,\n toolResponseMetadata: undefined,\n viewState: undefined,\n};\n","/**\n * Base Adaptor\n *\n * Abstract base class containing shared logic for both platform adaptors.\n */\n\nimport type {\n Theme,\n DisplayMode,\n Platform,\n DeviceType,\n SafeAreaInsets,\n CallToolResult,\n Feature,\n AdaptorStoreState,\n AdaptorStoreKey,\n ExternalStore,\n LogLevel,\n ResourceReadResult,\n UpdateModelContextParams,\n TeardownHandler,\n} from './types';\nimport type { UnifiedAdaptor } from './adaptor-interface';\nimport { SSR_DEFAULTS } from './defaults';\n\n/**\n * Abstract base class implementing shared adaptor logic\n */\nexport abstract class BaseAdaptor implements UnifiedAdaptor {\n abstract readonly platform: 'apps-sdk' | 'mcp-apps';\n\n // ============================================\n // External Store Access\n // ============================================\n\n abstract getExternalStore<K extends AdaptorStoreKey>(key: K): ExternalStore<AdaptorStoreState[K]>;\n\n /**\n * Shared implementation for getting SSR snapshot values\n */\n protected getServerSnapshotForKey<K extends AdaptorStoreKey>(key: K): AdaptorStoreState[K] {\n return SSR_DEFAULTS[key];\n }\n\n /**\n * Shared implementation for getting snapshot values\n * Maps keys to the appropriate getter methods\n */\n protected getSnapshotForKey<K extends AdaptorStoreKey>(key: K): AdaptorStoreState[K] {\n switch (key) {\n case 'theme':\n return this.getTheme() as AdaptorStoreState[K];\n case 'locale':\n return this.getLocale() as AdaptorStoreState[K];\n case 'displayMode':\n return this.getDisplayMode() as AdaptorStoreState[K];\n case 'maxHeight':\n return this.getMaxHeight() as AdaptorStoreState[K];\n case 'safeArea':\n return this.getSafeArea() as AdaptorStoreState[K];\n case 'containerSize':\n return this.getContainerSize() as AdaptorStoreState[K];\n case 'platform':\n return this.getPlatform() as AdaptorStoreState[K];\n case 'deviceType':\n return this.getDeviceType() as AdaptorStoreState[K];\n case 'containerWidth':\n return this.getContainerSize().width as AdaptorStoreState[K];\n case 'containerHeight':\n return this.getContainerSize().height as AdaptorStoreState[K];\n case 'inputCapabilities':\n return this.getInputCapabilities() as AdaptorStoreState[K];\n case 'canHover':\n return this.getInputCapabilities().canHover as AdaptorStoreState[K];\n case 'hasCoarsePointer':\n return this.getInputCapabilities().hasCoarsePointer as AdaptorStoreState[K];\n case 'toolInput':\n return this.getToolInput() as AdaptorStoreState[K];\n case 'toolOutput':\n return this.getToolOutput() as AdaptorStoreState[K];\n case 'toolResponseMetadata':\n return this.getToolResponseMetadata() as AdaptorStoreState[K];\n case 'viewState':\n return this.getViewState() as AdaptorStoreState[K];\n case 'toolInputPartial':\n return this.getToolInputPartial() as AdaptorStoreState[K];\n default:\n return undefined as AdaptorStoreState[K];\n }\n }\n\n // ============================================\n // Direct Getters (abstract - each adaptor must implement)\n // ============================================\n\n abstract getTheme(): Theme;\n abstract getLocale(): string;\n abstract getDisplayMode(): DisplayMode;\n abstract getMaxHeight(): number;\n abstract getSafeArea(): SafeAreaInsets;\n abstract getPlatform(): Platform;\n abstract getDeviceType(): DeviceType;\n abstract getContainerSize(): { width: number; height: number };\n abstract getInputCapabilities(): { canHover: boolean; hasCoarsePointer: boolean };\n abstract getToolInput<T>(): T | undefined;\n abstract getToolOutput<T>(): T | undefined;\n abstract getToolResponseMetadata<T>(): T | undefined;\n abstract getViewState<T>(): T | undefined;\n abstract getToolInputPartial<T>(): Partial<T> | undefined;\n\n // ============================================\n // Actions (abstract - each adaptor must implement)\n // ============================================\n\n abstract callTool<TInput, TOutput>(name: string, args?: TInput): Promise<CallToolResult<TOutput>>;\n abstract sendFollowUpMessage(message: string): void;\n abstract openExternal(url: string): void;\n abstract requestDisplayMode(mode: DisplayMode): void;\n abstract setViewState<T>(state: T): void;\n\n // ============================================\n // Feature Detection (abstract)\n // ============================================\n\n abstract isSupported(feature: Feature): boolean;\n\n // ============================================\n // MCP-Specific Actions (abstract - each adaptor provides fallbacks)\n // ============================================\n\n abstract readResource(uri: string): Promise<ResourceReadResult>;\n abstract updateModelContext(params: UpdateModelContextParams): Promise<void>;\n abstract log(level: LogLevel, data: unknown, logger?: string): void;\n abstract ping(): Promise<void>;\n abstract onTeardown(handler: TeardownHandler): () => void;\n abstract notifySizeChanged(width: number, height: number): void;\n abstract setupAutoSizeReporting(element: HTMLElement): () => void;\n\n // ============================================\n // Initialization (abstract)\n // ============================================\n\n abstract ensureReady(): Promise<void>;\n}\n","/**\n * Apps SDK Adaptor\n *\n * Adapts the ChatGPT Apps SDK (window.openai) to the unified interface.\n */\n\nimport {\n AppsSdkBridge,\n AppsSdkStore,\n type DisplayMode as AppsSdkDisplayMode,\n type OpenAiGlobals,\n} from '../apps-sdk';\nimport type {\n Theme,\n DisplayMode,\n Platform,\n DeviceType,\n SafeAreaInsets,\n CallToolResult,\n Feature,\n AdaptorStoreKey,\n LogLevel,\n TeardownHandler,\n} from './types';\nimport type { ExternalStore, AdaptorStoreState } from './types';\nimport { BaseAdaptor } from './base-adaptor';\n\n/**\n * Map Apps SDK display mode to unified display mode\n */\nfunction mapDisplayMode(mode: AppsSdkDisplayMode): DisplayMode {\n return mode; // 'inline' | 'pip' | 'fullscreen' map directly\n}\n\n/**\n * Derive device type from user agent (best effort)\n */\nfunction deriveDeviceType(userAgent?: string): DeviceType {\n if (!userAgent) return 'desktop';\n\n const ua = userAgent.toLowerCase();\n if (/mobile|iphone|android.*mobile/.test(ua)) return 'mobile';\n if (/tablet|ipad|android(?!.*mobile)/.test(ua)) return 'tablet';\n return 'desktop';\n}\n\n/**\n * Derive platform from user agent (best effort)\n */\nfunction derivePlatform(userAgent?: string): Platform {\n if (!userAgent) return 'web';\n\n const ua = userAgent.toLowerCase();\n if (/iphone|ipad|ipod/.test(ua)) return 'ios';\n if (/android/.test(ua)) return 'android';\n if (/macintosh|mac os/.test(ua)) return 'macos';\n if (/windows/.test(ua)) return 'windows';\n return 'web';\n}\n\nexport class AppsSdkAdaptor extends BaseAdaptor {\n readonly platform = 'apps-sdk' as const;\n\n private bridge: AppsSdkBridge;\n private store: AppsSdkStore;\n private externalStoreCache = new Map<AdaptorStoreKey, ExternalStore<unknown>>();\n\n constructor() {\n super();\n this.bridge = AppsSdkBridge.getInstance();\n this.store = AppsSdkStore.getInstance();\n }\n\n // ============================================\n // External Store Access\n // ============================================\n\n getExternalStore<K extends AdaptorStoreKey>(key: K): ExternalStore<AdaptorStoreState[K]> {\n let cached = this.externalStoreCache.get(key);\n\n if (!cached) {\n cached = {\n subscribe: (callback: () => void) => {\n // Map unified keys to Apps SDK store keys\n const appsSdkKey = this.mapKeyToAppsSdk(key);\n if (appsSdkKey) {\n return this.store.subscribe(appsSdkKey, callback);\n }\n // For computed values, subscribe to relevant keys\n return this.subscribeForComputedKey(key, callback);\n },\n getSnapshot: () => this.getSnapshotForKey(key),\n getServerSnapshot: () => this.getServerSnapshotForKey(key),\n };\n this.externalStoreCache.set(key, cached);\n }\n\n return cached as ExternalStore<AdaptorStoreState[K]>;\n }\n\n private mapKeyToAppsSdk(key: AdaptorStoreKey): keyof OpenAiGlobals | null {\n const mapping: Partial<Record<AdaptorStoreKey, keyof OpenAiGlobals>> = {\n theme: 'theme',\n locale: 'locale',\n displayMode: 'displayMode',\n maxHeight: 'maxHeight',\n safeArea: 'safeArea',\n toolInput: 'toolInput',\n toolOutput: 'toolOutput',\n toolResponseMetadata: 'toolResponseMetadata',\n viewState: 'widgetState',\n };\n return mapping[key] ?? null;\n }\n\n private subscribeForComputedKey(key: AdaptorStoreKey, callback: () => void): () => void {\n // Keys derived from userAgent\n if (\n key === 'platform' ||\n key === 'deviceType' ||\n key === 'canHover' ||\n key === 'hasCoarsePointer'\n ) {\n return this.store.subscribe('userAgent', callback);\n }\n // Container size doesn't have direct updates in Apps SDK\n if (key === 'containerWidth' || key === 'containerHeight') {\n return this.store.subscribe('maxHeight', callback);\n }\n return () => { };\n }\n\n // ============================================\n // Direct Getters\n // ============================================\n\n getTheme(): Theme {\n return this.store.getSnapshot('theme') ?? 'light';\n }\n\n getLocale(): string {\n return this.store.getSnapshot('locale') ?? 'en-US';\n }\n\n getDisplayMode(): DisplayMode {\n const mode = this.store.getSnapshot('displayMode') ?? 'inline';\n return mapDisplayMode(mode as AppsSdkDisplayMode);\n }\n\n getMaxHeight(): number {\n return this.store.getSnapshot('maxHeight') ?? 400;\n }\n\n getSafeArea(): SafeAreaInsets {\n return this.store.getSnapshot('safeArea') ?? { top: 0, right: 0, bottom: 0, left: 0 };\n }\n\n getPlatform(): Platform {\n const userAgent = this.store.getSnapshot('userAgent');\n return derivePlatform(userAgent);\n }\n\n getDeviceType(): DeviceType {\n const userAgent = this.store.getSnapshot('userAgent');\n return deriveDeviceType(userAgent);\n }\n\n getContainerSize(): { width: number; height: number } {\n // Apps SDK only provides maxHeight, width is assumed to be container width\n const maxHeight = this.getMaxHeight();\n return {\n width: typeof window !== 'undefined' ? window.innerWidth : 0,\n height: maxHeight,\n };\n }\n\n getInputCapabilities(): { canHover: boolean; hasCoarsePointer: boolean } {\n const deviceType = this.getDeviceType();\n const isMobile = deviceType === 'mobile' || deviceType === 'tablet';\n return {\n canHover: !isMobile,\n hasCoarsePointer: isMobile,\n };\n }\n\n getToolInput<T>(): T | undefined {\n return this.store.getSnapshot('toolInput') as T | undefined;\n }\n\n getToolOutput<T>(): T | undefined {\n return this.store.getSnapshot('toolOutput') as T | undefined;\n }\n\n getToolResponseMetadata<T>(): T | undefined {\n return this.store.getSnapshot('toolResponseMetadata') as T | undefined;\n }\n\n getViewState<T>(): T | undefined {\n return this.store.getSnapshot('widgetState') as T | undefined;\n }\n\n getToolInputPartial<T>(): Partial<T> | undefined {\n // Apps SDK doesn't support streaming input\n return undefined;\n }\n\n // ============================================\n // Actions\n // ============================================\n\n async callTool<TInput, TOutput>(name: string, args?: TInput): Promise<CallToolResult<TOutput>> {\n return this.bridge.callTool<TInput, TOutput>(name, args);\n }\n\n sendFollowUpMessage(message: string): void {\n this.bridge.sendFollowUpMessage(message);\n }\n\n openExternal(url: string): void {\n this.bridge.openExternal(url);\n }\n\n requestDisplayMode(mode: DisplayMode): void {\n this.bridge.requestDisplayMode(mode as AppsSdkDisplayMode);\n }\n\n setViewState<T>(state: T): void {\n this.bridge.setWidgetState(state);\n }\n\n // ============================================\n // Feature Detection\n // ============================================\n\n isSupported(feature: Feature): boolean {\n const supported: Feature[] = [\n 'uploadFile',\n 'getFileDownloadUrl',\n 'requestModal',\n 'requestClose',\n 'setOpenInAppUrl',\n 'notifyIntrinsicHeight',\n 'sizeReporting',\n 'callTool',\n 'sendMessage',\n 'openLink',\n 'requestDisplayMode',\n ];\n return supported.includes(feature);\n }\n\n // ============================================\n // MCP-Specific Stubs (with console warnings)\n // ============================================\n\n async readResource(_uri: string): Promise<never> {\n console.warn('[Pancake] readResource is not supported on Apps SDK');\n throw new Error('readResource is not supported on Apps SDK');\n }\n\n async updateModelContext(_params: unknown): Promise<void> {\n console.warn('[Pancake] updateModelContext is not supported on Apps SDK');\n // No-op - Apps SDK doesn't have this concept\n }\n\n log(level: LogLevel, data: unknown, logger?: string): void {\n // Fallback to console for logging on Apps SDK\n const loggerPrefix = logger ? `[${logger}]` : '[Pancake]';\n switch (level) {\n case 'debug':\n console.debug(loggerPrefix, data);\n break;\n case 'info':\n console.info(loggerPrefix, data);\n break;\n case 'warning':\n console.warn(loggerPrefix, data);\n break;\n case 'error':\n console.error(loggerPrefix, data);\n break;\n }\n }\n\n async ping(): Promise<void> {\n // No-op - Apps SDK doesn't have ping\n return Promise.resolve();\n }\n\n onTeardown(_handler: TeardownHandler): () => void {\n console.warn('[Pancake] onTeardown is not supported on Apps SDK');\n // Return no-op unsubscribe\n return () => { };\n }\n\n notifySizeChanged(_width: number, height: number): void {\n // Use notifyIntrinsicHeight for height changes (Apps SDK only supports height)\n this.bridge.notifyIntrinsicHeight?.(height);\n }\n\n setupAutoSizeReporting(element: HTMLElement): () => void {\n // Use ResizeObserver to report height changes via notifyIntrinsicHeight\n if (typeof ResizeObserver === 'undefined' || !this.bridge.notifyIntrinsicHeight) {\n return () => { };\n }\n\n const observer = new ResizeObserver((entries) => {\n const entry = entries[0];\n if (entry) {\n this.bridge.notifyIntrinsicHeight?.(entry.contentRect.height);\n }\n });\n\n observer.observe(element);\n\n return () => {\n observer.disconnect();\n };\n }\n\n // ============================================\n // Initialization\n // ============================================\n\n async ensureReady(): Promise<void> {\n // Apps SDK is ready immediately (window.openai is pre-injected)\n return Promise.resolve();\n }\n}\n","/**\n * MCP Apps Adaptor\n *\n * Adapts MCP Apps (JSON-RPC over postMessage) to the unified interface.\n */\n\nimport {\n McpAppsBridge,\n McpAppsStore,\n initialize as mcpInitialize,\n type DisplayMode as McpDisplayMode,\n type Platform as McpPlatform,\n} from '../mcp-apps';\nimport type {\n Theme,\n DisplayMode,\n Platform,\n DeviceType,\n SafeAreaInsets,\n CallToolResult,\n Feature,\n AdaptorStoreKey,\n LogLevel,\n ResourceReadResult,\n UpdateModelContextParams,\n TeardownHandler,\n} from './types';\nimport type { ExternalStore, AdaptorStoreState } from './types';\nimport { BaseAdaptor } from './base-adaptor';\n\n/**\n * Map MCP platform to unified platform\n *\n * Note: MCP only provides 'web' | 'desktop' | 'mobile' - we can't distinguish\n * between iOS/Android or macOS/Windows without additional context like userAgent.\n * We default to 'web' for mobile since we can't make assumptions.\n */\nfunction mapPlatform(platform?: McpPlatform, userAgent?: string): Platform {\n // If we have userAgent, try to detect more specific platform\n if (userAgent) {\n const ua = userAgent.toLowerCase();\n if (/iphone|ipad|ipod/.test(ua)) return 'ios';\n if (/android/.test(ua)) return 'android';\n if (/macintosh|mac os/.test(ua)) return 'macos';\n if (/windows/.test(ua)) return 'windows';\n }\n\n // Fall back to MCP platform mapping\n switch (platform) {\n case 'mobile':\n // Without userAgent, we can't distinguish iOS from Android\n // Return 'web' as a safe generic default\n return 'web';\n case 'desktop':\n // Without userAgent, we can't distinguish macOS from Windows\n // Return 'web' as a safe generic default\n return 'web';\n case 'web':\n default:\n return 'web';\n }\n}\n\n/**\n * Derive device type from MCP platform\n */\nfunction deriveDeviceType(platform?: McpPlatform): DeviceType {\n switch (platform) {\n case 'mobile':\n return 'mobile';\n case 'desktop':\n case 'web':\n default:\n return 'desktop';\n }\n}\n\nexport class McpAppsAdaptor extends BaseAdaptor {\n readonly platform = 'mcp-apps' as const;\n\n private bridge: McpAppsBridge;\n private store: McpAppsStore;\n private initPromise: Promise<void> | null = null;\n private viewStateKey: string = 'pancake-view-state:default';\n private viewStateSubscribers = new Set<() => void>();\n private externalStoreCache = new Map<AdaptorStoreKey, ExternalStore<unknown>>();\n\n constructor() {\n super();\n this.bridge = McpAppsBridge.getInstance();\n this.store = McpAppsStore.getInstance();\n this.setupStorageListener();\n }\n\n /**\n * Setup localStorage listener for viewState cross-tab synchronization\n */\n private setupStorageListener(): void {\n if (typeof window === 'undefined') return;\n\n window.addEventListener('storage', (event) => {\n if (event.key === this.viewStateKey) {\n this.notifyViewStateSubscribers();\n }\n });\n }\n\n /**\n * Notify all viewState subscribers of changes\n */\n private notifyViewStateSubscribers(): void {\n this.viewStateSubscribers.forEach((callback) => callback());\n }\n\n /**\n * Get the localStorage key for view state, derived from toolInfo\n */\n private getViewStateKey(): string {\n const hostContext = this.store.getSnapshot('hostContext');\n const toolName = hostContext?.toolInfo?.tool?.name;\n if (toolName && this.viewStateKey === 'pancake-view-state:default') {\n this.viewStateKey = `pancake-view-state:${toolName}`;\n }\n return this.viewStateKey;\n }\n\n // ============================================\n // External Store Access\n // ============================================\n\n getExternalStore<K extends AdaptorStoreKey>(key: K): ExternalStore<AdaptorStoreState[K]> {\n let cached = this.externalStoreCache.get(key);\n\n if (!cached) {\n cached = {\n subscribe: (callback: () => void) => {\n return this.subscribeForKey(key, callback);\n },\n getSnapshot: () => this.getSnapshotForKey(key),\n getServerSnapshot: () => this.getServerSnapshotForKey(key),\n };\n this.externalStoreCache.set(key, cached);\n }\n\n return cached as ExternalStore<AdaptorStoreState[K]>;\n }\n\n private subscribeForKey(key: AdaptorStoreKey, callback: () => void): () => void {\n // Most keys come from hostContext\n const hostContextKeys: AdaptorStoreKey[] = [\n 'theme',\n 'locale',\n 'displayMode',\n 'maxHeight',\n 'safeArea',\n 'containerSize',\n 'platform',\n 'deviceType',\n 'containerWidth',\n 'containerHeight',\n 'inputCapabilities',\n 'canHover',\n 'hasCoarsePointer',\n ];\n\n if (hostContextKeys.includes(key)) {\n return this.store.subscribe('hostContext', callback);\n }\n\n // Tool data keys\n if (key === 'toolInput') {\n return this.store.subscribe('toolInput', callback);\n }\n if (key === 'toolOutput') {\n return this.store.subscribe('toolResult', callback);\n }\n if (key === 'toolResponseMetadata') {\n return this.store.subscribe('toolResult', callback);\n }\n\n // Tool input partial (streaming)\n if (key === 'toolInputPartial') {\n return this.store.subscribe('toolInputPartial', callback);\n }\n\n // View state - uses localStorage with subscription\n if (key === 'viewState') {\n this.viewStateSubscribers.add(callback);\n return () => {\n this.viewStateSubscribers.delete(callback);\n };\n }\n\n return () => { };\n }\n\n // ============================================\n // Direct Getters\n // ============================================\n\n getTheme(): Theme {\n const hostContext = this.store.getSnapshot('hostContext');\n return hostContext.theme ?? 'light';\n }\n\n getLocale(): string {\n const hostContext = this.store.getSnapshot('hostContext');\n return hostContext.locale ?? 'en-US';\n }\n\n getDisplayMode(): DisplayMode {\n const hostContext = this.store.getSnapshot('hostContext');\n return (hostContext.displayMode ?? 'inline') as DisplayMode;\n }\n\n getMaxHeight(): number {\n const hostContext = this.store.getSnapshot('hostContext');\n const dims = hostContext.containerDimensions;\n return dims?.maxHeight ?? dims?.height ?? 400;\n }\n\n getSafeArea(): SafeAreaInsets {\n const hostContext = this.store.getSnapshot('hostContext');\n return hostContext.safeAreaInsets ?? { top: 0, right: 0, bottom: 0, left: 0 };\n }\n\n getPlatform(): Platform {\n const hostContext = this.store.getSnapshot('hostContext');\n return mapPlatform(hostContext.platform, hostContext.userAgent);\n }\n\n getDeviceType(): DeviceType {\n const hostContext = this.store.getSnapshot('hostContext');\n return deriveDeviceType(hostContext.platform);\n }\n\n getContainerSize(): { width: number; height: number } {\n const hostContext = this.store.getSnapshot('hostContext');\n const dims = hostContext.containerDimensions;\n return {\n width: dims?.maxWidth ?? dims?.width ?? (typeof window !== 'undefined' ? window.innerWidth : 0),\n height: dims?.maxHeight ?? dims?.height ?? 400,\n };\n }\n\n getInputCapabilities(): { canHover: boolean; hasCoarsePointer: boolean } {\n const hostContext = this.store.getSnapshot('hostContext');\n const caps = hostContext.deviceCapabilities;\n return {\n canHover: caps?.hover ?? true,\n hasCoarsePointer: caps?.touch ?? false,\n };\n }\n\n getToolInput<T>(): T | undefined {\n return this.store.getSnapshot('toolInput') as T | undefined;\n }\n\n getToolOutput<T>(): T | undefined {\n const result = this.store.getSnapshot('toolResult');\n return result?.structuredContent as T | undefined;\n }\n\n getToolResponseMetadata<T>(): T | undefined {\n const result = this.store.getSnapshot('toolResult');\n return result?._meta as T | undefined;\n }\n\n getViewState<T>(): T | undefined {\n // MCP Apps uses localStorage for state persistence (since updateModelContext can't be read back)\n if (typeof window === 'undefined') return undefined;\n\n try {\n const key = this.getViewStateKey();\n const stored = localStorage.getItem(key);\n return stored ? JSON.parse(stored) : undefined;\n } catch {\n return undefined;\n }\n }\n\n getToolInputPartial<T>(): Partial<T> | undefined {\n return this.store.getSnapshot('toolInputPartial') as Partial<T> | undefined;\n }\n\n // ============================================\n // Actions\n // ============================================\n\n async callTool<TInput, TOutput>(name: string, args?: TInput): Promise<CallToolResult<TOutput>> {\n await this.ensureReady();\n return this.bridge.callTool<TInput, TOutput>(name, args);\n }\n\n sendFollowUpMessage(message: string): void {\n this.ensureReady().then(() => {\n this.bridge.sendMessage(message);\n }).catch((error) => {\n console.warn('[pancake] sendFollowUpMessage failed:', error);\n });\n }\n\n openExternal(url: string): void {\n this.ensureReady().then(() => {\n this.bridge.openLink(url);\n }).catch((error) => {\n console.warn('[pancake] openExternal failed:', error);\n });\n }\n\n requestDisplayMode(mode: DisplayMode): void {\n this.ensureReady().then(() => {\n this.bridge.requestDisplayMode(mode as McpDisplayMode);\n }).catch((error) => {\n console.warn('[pancake] requestDisplayMode failed:', error);\n });\n }\n\n setViewState<T>(state: T): void {\n // Write to localStorage for UI persistence\n if (typeof window !== 'undefined') {\n try {\n const key = this.getViewStateKey();\n localStorage.setItem(key, JSON.stringify(state));\n // Notify subscribers of the change (storage event only fires for other tabs)\n this.notifyViewStateSubscribers();\n } catch {\n // localStorage may be unavailable or full\n }\n }\n\n // Also send to model context for conversation continuity (model can see it in future turns)\n this.ensureReady().then(() => {\n this.bridge.updateModelContext({\n structuredContent: { __viewState: state },\n });\n }).catch((error) => {\n console.warn('[pancake] setViewState updateModelContext failed:', error);\n });\n }\n\n // ============================================\n // MCP-Specific Actions\n // ============================================\n\n async readResource(uri: string): Promise<ResourceReadResult> {\n await this.ensureReady();\n return this.bridge.readResource(uri);\n }\n\n async updateModelContext(params: UpdateModelContextParams): Promise<void> {\n await this.ensureReady();\n return this.bridge.updateModelContext(params);\n }\n\n log(level: LogLevel, data: unknown, logger?: string): void {\n this.bridge.log(level, data, logger);\n }\n\n async ping(): Promise<void> {\n await this.ensureReady();\n return this.bridge.ping();\n }\n\n onTeardown(handler: TeardownHandler): () => void {\n return this.bridge.onTeardown(handler);\n }\n\n notifySizeChanged(width: number, height: number): void {\n this.bridge.notifySizeChanged(width, height);\n }\n\n setupAutoSizeReporting(element: HTMLElement): () => void {\n return this.bridge.setupAutoSizeReporting(element);\n }\n\n // ============================================\n // Feature Detection\n // ============================================\n\n isSupported(feature: Feature): boolean {\n const supported: Feature[] = [\n 'readResource',\n 'updateModelContext',\n 'timezone',\n 'cssVariables',\n 'toolInfo',\n 'logging',\n 'ping',\n 'onTeardown',\n 'callTool',\n 'sendMessage',\n 'openLink',\n 'requestDisplayMode',\n 'sizeReporting',\n ];\n return supported.includes(feature);\n }\n\n // ============================================\n // Initialization\n // ============================================\n\n async initialize(): Promise<void> {\n if (!this.initPromise) {\n this.initPromise = mcpInitialize().then(() => { });\n }\n return this.initPromise;\n }\n\n async ensureReady(): Promise<void> {\n if (!this.bridge.isInitialized) {\n await this.initialize();\n }\n }\n}\n","/**\n * Adaptor Factory\n *\n * Creates and caches the appropriate adaptor based on detected platform.\n */\n\nimport { getPlatform, resetPlatformCache } from './detection';\nimport { AppsSdkAdaptor } from './apps-sdk-adaptor';\nimport { McpAppsAdaptor } from './mcp-apps-adaptor';\nimport type { UnifiedAdaptor } from './adaptor-interface';\n\nlet cachedAdaptor: UnifiedAdaptor | null = null;\n\n/**\n * Get the adaptor for the current platform\n *\n * Automatically detects the platform and returns the appropriate adaptor.\n * The adaptor is cached for the lifetime of the application.\n */\nexport function getAdaptor(): UnifiedAdaptor {\n if (cachedAdaptor) {\n return cachedAdaptor;\n }\n\n const platform = getPlatform();\n\n if (platform === 'apps-sdk') {\n cachedAdaptor = new AppsSdkAdaptor();\n } else {\n cachedAdaptor = new McpAppsAdaptor();\n }\n\n return cachedAdaptor;\n}\n\n/**\n * Reset the adaptor cache (for testing)\n */\nexport function resetAdaptor(): void {\n cachedAdaptor = null;\n resetPlatformCache();\n}\n\n/**\n * Check which platform is active\n */\nexport function isAppsSdk(): boolean {\n return getAdaptor().platform === 'apps-sdk';\n}\n\n/**\n * Check which platform is active\n */\nexport function isMcpApps(): boolean {\n return getAdaptor().platform === 'mcp-apps';\n}\n"]}
@@ -0,0 +1,169 @@
1
+ import { T as Theme, D as DisplayMode, S as SafeAreaInsets, C as ContainerSize, P as Platform, a as DeviceType, I as InputCapabilities } from '../adaptor-interface-BYbH9PpT.js';
2
+ export { A as ActionTool, c as CallToolResult, d as ContentBlock, k as DataTool, F as Feature, L as LogLevel, R as ResourceContent, f as ResourceReadResult, h as ResourceTeardownParams, j as TeardownHandler, e as ToolResponseMetadata, l as UnifiedAdaptor, U as UpdateModelContextParams, g as getPlatform, i as isAppsSdkAvailable, b as isMcpAppsAvailable } from '../adaptor-interface-BYbH9PpT.js';
3
+ export { b as action, c as callTool, d as data, t as getAdaptor, i as isSupported, l as log, f as logDebug, j as logError, g as logInfo, h as logWarning, n as navigateToView, m as notifySizeChanged, k as onTeardown, o as openExternal, p as ping, e as readResource, r as requestDisplayMode, v as resetAdaptor, a as say, s as sendFollowUpMessage, q as setupAutoSizeReporting, u as updateModelContext } from '../notify-size-changed-Ck2BGfUk.js';
4
+
5
+ /**
6
+ * Observable Implementation
7
+ *
8
+ * Framework-agnostic reactive primitives for non-React developers.
9
+ */
10
+ /**
11
+ * A simple observable that provides reactive state access.
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * const unsub = theme$.subscribe(theme => console.log(theme));
16
+ * const currentTheme = theme$.value;
17
+ * unsub(); // Stop listening
18
+ * ```
19
+ */
20
+ interface Observable<T> {
21
+ /**
22
+ * Get the current value synchronously
23
+ */
24
+ readonly value: T;
25
+ /**
26
+ * Subscribe to value changes.
27
+ * The callback is invoked immediately with the current value,
28
+ * and again whenever the value changes.
29
+ *
30
+ * @param callback - Function to call with the current and future values
31
+ * @returns Unsubscribe function
32
+ */
33
+ subscribe(callback: (value: T) => void): () => void;
34
+ }
35
+ /**
36
+ * Create an observable from getter and subscription functions.
37
+ *
38
+ * @param getValue - Function that returns the current value
39
+ * @param subscribeToChanges - Function that subscribes to change notifications
40
+ * @returns An Observable instance
41
+ */
42
+ declare function createObservable<T>(getValue: () => T, subscribeToChanges: (callback: () => void) => () => void): Observable<T>;
43
+
44
+ /**
45
+ * Pre-built Observables
46
+ *
47
+ * Framework-agnostic reactive state for host environment data.
48
+ */
49
+
50
+ /**
51
+ * View data combining input, output, and metadata
52
+ */
53
+ interface ViewData<TInput = unknown, TOutput = unknown, TMeta = unknown> {
54
+ input: TInput | undefined;
55
+ output: TOutput | undefined;
56
+ metadata: TMeta | undefined;
57
+ }
58
+ /**
59
+ * Observable for the current theme (light/dark)
60
+ *
61
+ * @example
62
+ * ```typescript
63
+ * const unsub = theme$.subscribe(theme => {
64
+ * document.body.className = theme;
65
+ * });
66
+ * ```
67
+ */
68
+ declare const theme$: Observable<Theme>;
69
+ /**
70
+ * Observable for the current locale (e.g., 'en-US')
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * locale$.subscribe(locale => {
75
+ * i18n.setLocale(locale);
76
+ * });
77
+ * ```
78
+ */
79
+ declare const locale$: Observable<string>;
80
+ /**
81
+ * Observable for the current display mode (inline/pip/fullscreen)
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * displayMode$.subscribe(mode => {
86
+ * if (mode === 'fullscreen') {
87
+ * showExtendedUI();
88
+ * }
89
+ * });
90
+ * ```
91
+ */
92
+ declare const displayMode$: Observable<DisplayMode>;
93
+ /**
94
+ * Observable for safe area insets (for notches, status bars, etc.)
95
+ *
96
+ * @example
97
+ * ```typescript
98
+ * safeArea$.subscribe(insets => {
99
+ * container.style.paddingTop = `${insets.top}px`;
100
+ * });
101
+ * ```
102
+ */
103
+ declare const safeArea$: Observable<SafeAreaInsets>;
104
+ /**
105
+ * Observable for container dimensions
106
+ *
107
+ * @example
108
+ * ```typescript
109
+ * containerSize$.subscribe(size => {
110
+ * canvas.width = size.width;
111
+ * canvas.height = size.height;
112
+ * });
113
+ * ```
114
+ */
115
+ declare const containerSize$: Observable<ContainerSize>;
116
+ /**
117
+ * Observable for the host platform (ios/android/macos/windows/web)
118
+ *
119
+ * @example
120
+ * ```typescript
121
+ * platform$.subscribe(platform => {
122
+ * if (platform === 'ios' || platform === 'android') {
123
+ * enableMobileFeatures();
124
+ * }
125
+ * });
126
+ * ```
127
+ */
128
+ declare const platform$: Observable<Platform>;
129
+ /**
130
+ * Observable for the device type (mobile/tablet/desktop)
131
+ *
132
+ * @example
133
+ * ```typescript
134
+ * deviceType$.subscribe(type => {
135
+ * if (type === 'mobile') {
136
+ * enableTouchOptimizations();
137
+ * }
138
+ * });
139
+ * ```
140
+ */
141
+ declare const deviceType$: Observable<DeviceType>;
142
+ /**
143
+ * Observable for input capabilities (hover support, pointer type)
144
+ *
145
+ * @example
146
+ * ```typescript
147
+ * inputCapabilities$.subscribe(caps => {
148
+ * if (!caps.canHover) {
149
+ * disableHoverEffects();
150
+ * }
151
+ * });
152
+ * ```
153
+ */
154
+ declare const inputCapabilities$: Observable<InputCapabilities>;
155
+ /**
156
+ * Observable for combined view data (input, output, and metadata)
157
+ *
158
+ * @example
159
+ * ```typescript
160
+ * viewData$.subscribe(data => {
161
+ * if (data.input) {
162
+ * renderContent(data.input, data.output);
163
+ * }
164
+ * });
165
+ * ```
166
+ */
167
+ declare const viewData$: Observable<ViewData>;
168
+
169
+ export { ContainerSize, DeviceType, DisplayMode, InputCapabilities, type Observable, Platform, SafeAreaInsets, Theme, type ViewData, containerSize$, createObservable, deviceType$, displayMode$, inputCapabilities$, locale$, platform$, safeArea$, theme$, viewData$ };
@@ -0,0 +1,195 @@
1
+ export { action, callTool, data, isSupported, log, logDebug, logError, logInfo, logWarning, navigateToView, notifySizeChanged, onTeardown, openExternal, ping, readResource, requestDisplayMode, say, sendFollowUpMessage, setupAutoSizeReporting, updateModelContext } from '../chunk-7HJ5PKKT.js';
2
+ import { getAdaptor } from '../chunk-ZYBPDIEG.js';
3
+ export { getAdaptor, getPlatform, isAppsSdkAvailable, isMcpAppsAvailable, resetAdaptor } from '../chunk-ZYBPDIEG.js';
4
+ import '../chunk-5NYJ2IVD.js';
5
+ import '../chunk-YGGRUIUG.js';
6
+ import '../chunk-PZ5AY32C.js';
7
+
8
+ // src/core/observable.ts
9
+ function createObservable(getValue, subscribeToChanges) {
10
+ return {
11
+ get value() {
12
+ return getValue();
13
+ },
14
+ subscribe(callback) {
15
+ callback(getValue());
16
+ const unsubscribe = subscribeToChanges(() => {
17
+ callback(getValue());
18
+ });
19
+ return unsubscribe;
20
+ }
21
+ };
22
+ }
23
+
24
+ // src/core/observables.ts
25
+ function createStoreObservable(getStore) {
26
+ return createObservable(
27
+ () => getStore().getSnapshot(),
28
+ (callback) => getStore().subscribe(callback)
29
+ );
30
+ }
31
+ var _theme$ = null;
32
+ var _locale$ = null;
33
+ var _displayMode$ = null;
34
+ var _safeArea$ = null;
35
+ var _containerSize$ = null;
36
+ var _platform$ = null;
37
+ var _deviceType$ = null;
38
+ var _inputCapabilities$ = null;
39
+ var _viewData$ = null;
40
+ var theme$ = {
41
+ get value() {
42
+ if (!_theme$) {
43
+ _theme$ = createStoreObservable(() => getAdaptor().getExternalStore("theme"));
44
+ }
45
+ return _theme$.value;
46
+ },
47
+ subscribe(callback) {
48
+ if (!_theme$) {
49
+ _theme$ = createStoreObservable(() => getAdaptor().getExternalStore("theme"));
50
+ }
51
+ return _theme$.subscribe(callback);
52
+ }
53
+ };
54
+ var locale$ = {
55
+ get value() {
56
+ if (!_locale$) {
57
+ _locale$ = createStoreObservable(() => getAdaptor().getExternalStore("locale"));
58
+ }
59
+ return _locale$.value;
60
+ },
61
+ subscribe(callback) {
62
+ if (!_locale$) {
63
+ _locale$ = createStoreObservable(() => getAdaptor().getExternalStore("locale"));
64
+ }
65
+ return _locale$.subscribe(callback);
66
+ }
67
+ };
68
+ var displayMode$ = {
69
+ get value() {
70
+ if (!_displayMode$) {
71
+ _displayMode$ = createStoreObservable(() => getAdaptor().getExternalStore("displayMode"));
72
+ }
73
+ return _displayMode$.value;
74
+ },
75
+ subscribe(callback) {
76
+ if (!_displayMode$) {
77
+ _displayMode$ = createStoreObservable(() => getAdaptor().getExternalStore("displayMode"));
78
+ }
79
+ return _displayMode$.subscribe(callback);
80
+ }
81
+ };
82
+ var safeArea$ = {
83
+ get value() {
84
+ if (!_safeArea$) {
85
+ _safeArea$ = createStoreObservable(() => getAdaptor().getExternalStore("safeArea"));
86
+ }
87
+ return _safeArea$.value;
88
+ },
89
+ subscribe(callback) {
90
+ if (!_safeArea$) {
91
+ _safeArea$ = createStoreObservable(() => getAdaptor().getExternalStore("safeArea"));
92
+ }
93
+ return _safeArea$.subscribe(callback);
94
+ }
95
+ };
96
+ var containerSize$ = {
97
+ get value() {
98
+ if (!_containerSize$) {
99
+ _containerSize$ = createStoreObservable(() => getAdaptor().getExternalStore("containerSize"));
100
+ }
101
+ return _containerSize$.value;
102
+ },
103
+ subscribe(callback) {
104
+ if (!_containerSize$) {
105
+ _containerSize$ = createStoreObservable(() => getAdaptor().getExternalStore("containerSize"));
106
+ }
107
+ return _containerSize$.subscribe(callback);
108
+ }
109
+ };
110
+ var platform$ = {
111
+ get value() {
112
+ if (!_platform$) {
113
+ _platform$ = createStoreObservable(() => getAdaptor().getExternalStore("platform"));
114
+ }
115
+ return _platform$.value;
116
+ },
117
+ subscribe(callback) {
118
+ if (!_platform$) {
119
+ _platform$ = createStoreObservable(() => getAdaptor().getExternalStore("platform"));
120
+ }
121
+ return _platform$.subscribe(callback);
122
+ }
123
+ };
124
+ var deviceType$ = {
125
+ get value() {
126
+ if (!_deviceType$) {
127
+ _deviceType$ = createStoreObservable(() => getAdaptor().getExternalStore("deviceType"));
128
+ }
129
+ return _deviceType$.value;
130
+ },
131
+ subscribe(callback) {
132
+ if (!_deviceType$) {
133
+ _deviceType$ = createStoreObservable(() => getAdaptor().getExternalStore("deviceType"));
134
+ }
135
+ return _deviceType$.subscribe(callback);
136
+ }
137
+ };
138
+ var inputCapabilities$ = {
139
+ get value() {
140
+ if (!_inputCapabilities$) {
141
+ _inputCapabilities$ = createStoreObservable(
142
+ () => getAdaptor().getExternalStore("inputCapabilities")
143
+ );
144
+ }
145
+ return _inputCapabilities$.value;
146
+ },
147
+ subscribe(callback) {
148
+ if (!_inputCapabilities$) {
149
+ _inputCapabilities$ = createStoreObservable(
150
+ () => getAdaptor().getExternalStore("inputCapabilities")
151
+ );
152
+ }
153
+ return _inputCapabilities$.subscribe(callback);
154
+ }
155
+ };
156
+ var viewData$ = {
157
+ get value() {
158
+ if (!_viewData$) {
159
+ _viewData$ = createViewDataObservable();
160
+ }
161
+ return _viewData$.value;
162
+ },
163
+ subscribe(callback) {
164
+ if (!_viewData$) {
165
+ _viewData$ = createViewDataObservable();
166
+ }
167
+ return _viewData$.subscribe(callback);
168
+ }
169
+ };
170
+ function createViewDataObservable() {
171
+ const getValue = () => {
172
+ const adaptor = getAdaptor();
173
+ return {
174
+ input: adaptor.getToolInput(),
175
+ output: adaptor.getToolOutput(),
176
+ metadata: adaptor.getToolResponseMetadata()
177
+ };
178
+ };
179
+ const subscribeToChanges = (callback) => {
180
+ const adaptor = getAdaptor();
181
+ const unsubInput = adaptor.getExternalStore("toolInput").subscribe(callback);
182
+ const unsubOutput = adaptor.getExternalStore("toolOutput").subscribe(callback);
183
+ const unsubMeta = adaptor.getExternalStore("toolResponseMetadata").subscribe(callback);
184
+ return () => {
185
+ unsubInput();
186
+ unsubOutput();
187
+ unsubMeta();
188
+ };
189
+ };
190
+ return createObservable(getValue, subscribeToChanges);
191
+ }
192
+
193
+ export { containerSize$, createObservable, deviceType$, displayMode$, inputCapabilities$, locale$, platform$, safeArea$, theme$, viewData$ };
194
+ //# sourceMappingURL=index.js.map
195
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"s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;AACA,IAAA,OAAO,UAAA,CAAW,KAAA;AAAA,EACpB,CAAA;AAAA,EACA,UAAU,QAAA,EAAiD;AACzD,IAAA,IAAI,CAAC,UAAA,EAAY;AACf,MAAA,UAAA,GAAa,wBAAA,EAAyB;AAAA,IACxC;AACA,IAAA,OAAO,UAAA,CAAW,UAAU,QAAQ,CAAA;AAAA,EACtC;AACF;AAKA,SAAS,wBAAA,GAAiD;AACxD,EAAA,MAAM,WAAW,MAAgB;AAC/B,IAAA,MAAM,UAAU,UAAA,EAAW;AAC3B,IAAA,OAAO;AAAA,MACL,KAAA,EAAO,QAAQ,YAAA,EAAa;AAAA,MAC5B,MAAA,EAAQ,QAAQ,aAAA,EAAc;AAAA,MAC9B,QAAA,EAAU,QAAQ,uBAAA;AAAwB,KAC5C;AAAA,EACF,CAAA;AAEA,EAAA,MAAM,kBAAA,GAAqB,CAAC,QAAA,KAAuC;AACjE,IAAA,MAAM,UAAU,UAAA,EAAW;AAC3B,IAAA,MAAM,aAAa,OAAA,CAAQ,gBAAA,CAAiB,WAAW,CAAA,CAAE,UAAU,QAAQ,CAAA;AAC3E,IAAA,MAAM,cAAc,OAAA,CAAQ,gBAAA,CAAiB,YAAY,CAAA,CAAE,UAAU,QAAQ,CAAA;AAC7E,IAAA,MAAM,YAAY,OAAA,CAAQ,gBAAA,CAAiB,sBAAsB,CAAA,CAAE,UAAU,QAAQ,CAAA;AAErF,IAAA,OAAO,MAAM;AACX,MAAA,UAAA,EAAW;AACX,MAAA,WAAA,EAAY;AACZ,MAAA,SAAA,EAAU;AAAA,IACZ,CAAA;AAAA,EACF,CAAA;AAEA,EAAA,OAAO,gBAAA,CAAiB,UAAU,kBAAkB,CAAA;AACtD","file":"index.js","sourcesContent":["/**\n * Observable Implementation\n *\n * Framework-agnostic reactive primitives for non-React developers.\n */\n\n/**\n * A simple observable that provides reactive state access.\n *\n * @example\n * ```typescript\n * const unsub = theme$.subscribe(theme => console.log(theme));\n * const currentTheme = theme$.value;\n * unsub(); // Stop listening\n * ```\n */\nexport interface Observable<T> {\n /**\n * Get the current value synchronously\n */\n readonly value: T;\n\n /**\n * Subscribe to value changes.\n * The callback is invoked immediately with the current value,\n * and again whenever the value changes.\n *\n * @param callback - Function to call with the current and future values\n * @returns Unsubscribe function\n */\n subscribe(callback: (value: T) => void): () => void;\n}\n\n/**\n * Create an observable from getter and subscription functions.\n *\n * @param getValue - Function that returns the current value\n * @param subscribeToChanges - Function that subscribes to change notifications\n * @returns An Observable instance\n */\nexport function createObservable<T>(\n getValue: () => T,\n subscribeToChanges: (callback: () => void) => () => void\n): Observable<T> {\n return {\n get value(): T {\n return getValue();\n },\n\n subscribe(callback: (value: T) => void): () => void {\n // Emit current value immediately\n callback(getValue());\n\n // Subscribe to future changes\n const unsubscribe = subscribeToChanges(() => {\n callback(getValue());\n });\n\n return unsubscribe;\n },\n };\n}\n","/**\n * Pre-built Observables\n *\n * Framework-agnostic reactive state for host environment data.\n */\n\nimport { getAdaptor } from '../unified/adaptor';\nimport type {\n Theme,\n DisplayMode,\n Platform,\n DeviceType,\n SafeAreaInsets,\n ContainerSize,\n InputCapabilities,\n} from '../unified/types';\nimport { createObservable, type Observable } from './observable';\n\n/**\n * View data combining input, output, and metadata\n */\nexport interface ViewData<TInput = unknown, TOutput = unknown, TMeta = unknown> {\n input: TInput | undefined;\n output: TOutput | undefined;\n metadata: TMeta | undefined;\n}\n\n// ============================================\n// Observable Factories\n// ============================================\n\n/**\n * Create an observable from an adaptor store key\n */\nfunction createStoreObservable<T>(\n getStore: () => { subscribe: (cb: () => void) => () => void; getSnapshot: () => T }\n): Observable<T> {\n return createObservable(\n () => getStore().getSnapshot(),\n (callback) => getStore().subscribe(callback)\n );\n}\n\n// ============================================\n// Pre-built Observables (lazy initialization)\n// ============================================\n\nlet _theme$: Observable<Theme> | null = null;\nlet _locale$: Observable<string> | null = null;\nlet _displayMode$: Observable<DisplayMode> | null = null;\nlet _safeArea$: Observable<SafeAreaInsets> | null = null;\nlet _containerSize$: Observable<ContainerSize> | null = null;\nlet _platform$: Observable<Platform> | null = null;\nlet _deviceType$: Observable<DeviceType> | null = null;\nlet _inputCapabilities$: Observable<InputCapabilities> | null = null;\nlet _viewData$: Observable<ViewData> | null = null;\n\n/**\n * Observable for the current theme (light/dark)\n *\n * @example\n * ```typescript\n * const unsub = theme$.subscribe(theme => {\n * document.body.className = theme;\n * });\n * ```\n */\nexport const theme$: Observable<Theme> = {\n get value(): Theme {\n if (!_theme$) {\n _theme$ = createStoreObservable(() => getAdaptor().getExternalStore('theme'));\n }\n return _theme$.value;\n },\n subscribe(callback: (value: Theme) => void): () => void {\n if (!_theme$) {\n _theme$ = createStoreObservable(() => getAdaptor().getExternalStore('theme'));\n }\n return _theme$.subscribe(callback);\n },\n};\n\n/**\n * Observable for the current locale (e.g., 'en-US')\n *\n * @example\n * ```typescript\n * locale$.subscribe(locale => {\n * i18n.setLocale(locale);\n * });\n * ```\n */\nexport const locale$: Observable<string> = {\n get value(): string {\n if (!_locale$) {\n _locale$ = createStoreObservable(() => getAdaptor().getExternalStore('locale'));\n }\n return _locale$.value;\n },\n subscribe(callback: (value: string) => void): () => void {\n if (!_locale$) {\n _locale$ = createStoreObservable(() => getAdaptor().getExternalStore('locale'));\n }\n return _locale$.subscribe(callback);\n },\n};\n\n/**\n * Observable for the current display mode (inline/pip/fullscreen)\n *\n * @example\n * ```typescript\n * displayMode$.subscribe(mode => {\n * if (mode === 'fullscreen') {\n * showExtendedUI();\n * }\n * });\n * ```\n */\nexport const displayMode$: Observable<DisplayMode> = {\n get value(): DisplayMode {\n if (!_displayMode$) {\n _displayMode$ = createStoreObservable(() => getAdaptor().getExternalStore('displayMode'));\n }\n return _displayMode$.value;\n },\n subscribe(callback: (value: DisplayMode) => void): () => void {\n if (!_displayMode$) {\n _displayMode$ = createStoreObservable(() => getAdaptor().getExternalStore('displayMode'));\n }\n return _displayMode$.subscribe(callback);\n },\n};\n\n/**\n * Observable for safe area insets (for notches, status bars, etc.)\n *\n * @example\n * ```typescript\n * safeArea$.subscribe(insets => {\n * container.style.paddingTop = `${insets.top}px`;\n * });\n * ```\n */\nexport const safeArea$: Observable<SafeAreaInsets> = {\n get value(): SafeAreaInsets {\n if (!_safeArea$) {\n _safeArea$ = createStoreObservable(() => getAdaptor().getExternalStore('safeArea'));\n }\n return _safeArea$.value;\n },\n subscribe(callback: (value: SafeAreaInsets) => void): () => void {\n if (!_safeArea$) {\n _safeArea$ = createStoreObservable(() => getAdaptor().getExternalStore('safeArea'));\n }\n return _safeArea$.subscribe(callback);\n },\n};\n\n/**\n * Observable for container dimensions\n *\n * @example\n * ```typescript\n * containerSize$.subscribe(size => {\n * canvas.width = size.width;\n * canvas.height = size.height;\n * });\n * ```\n */\nexport const containerSize$: Observable<ContainerSize> = {\n get value(): ContainerSize {\n if (!_containerSize$) {\n _containerSize$ = createStoreObservable(() => getAdaptor().getExternalStore('containerSize'));\n }\n return _containerSize$.value;\n },\n subscribe(callback: (value: ContainerSize) => void): () => void {\n if (!_containerSize$) {\n _containerSize$ = createStoreObservable(() => getAdaptor().getExternalStore('containerSize'));\n }\n return _containerSize$.subscribe(callback);\n },\n};\n\n/**\n * Observable for the host platform (ios/android/macos/windows/web)\n *\n * @example\n * ```typescript\n * platform$.subscribe(platform => {\n * if (platform === 'ios' || platform === 'android') {\n * enableMobileFeatures();\n * }\n * });\n * ```\n */\nexport const platform$: Observable<Platform> = {\n get value(): Platform {\n if (!_platform$) {\n _platform$ = createStoreObservable(() => getAdaptor().getExternalStore('platform'));\n }\n return _platform$.value;\n },\n subscribe(callback: (value: Platform) => void): () => void {\n if (!_platform$) {\n _platform$ = createStoreObservable(() => getAdaptor().getExternalStore('platform'));\n }\n return _platform$.subscribe(callback);\n },\n};\n\n/**\n * Observable for the device type (mobile/tablet/desktop)\n *\n * @example\n * ```typescript\n * deviceType$.subscribe(type => {\n * if (type === 'mobile') {\n * enableTouchOptimizations();\n * }\n * });\n * ```\n */\nexport const deviceType$: Observable<DeviceType> = {\n get value(): DeviceType {\n if (!_deviceType$) {\n _deviceType$ = createStoreObservable(() => getAdaptor().getExternalStore('deviceType'));\n }\n return _deviceType$.value;\n },\n subscribe(callback: (value: DeviceType) => void): () => void {\n if (!_deviceType$) {\n _deviceType$ = createStoreObservable(() => getAdaptor().getExternalStore('deviceType'));\n }\n return _deviceType$.subscribe(callback);\n },\n};\n\n/**\n * Observable for input capabilities (hover support, pointer type)\n *\n * @example\n * ```typescript\n * inputCapabilities$.subscribe(caps => {\n * if (!caps.canHover) {\n * disableHoverEffects();\n * }\n * });\n * ```\n */\nexport const inputCapabilities$: Observable<InputCapabilities> = {\n get value(): InputCapabilities {\n if (!_inputCapabilities$) {\n _inputCapabilities$ = createStoreObservable(() =>\n getAdaptor().getExternalStore('inputCapabilities')\n );\n }\n return _inputCapabilities$.value;\n },\n subscribe(callback: (value: InputCapabilities) => void): () => void {\n if (!_inputCapabilities$) {\n _inputCapabilities$ = createStoreObservable(() =>\n getAdaptor().getExternalStore('inputCapabilities')\n );\n }\n return _inputCapabilities$.subscribe(callback);\n },\n};\n\n/**\n * Observable for combined view data (input, output, and metadata)\n *\n * @example\n * ```typescript\n * viewData$.subscribe(data => {\n * if (data.input) {\n * renderContent(data.input, data.output);\n * }\n * });\n * ```\n */\nexport const viewData$: Observable<ViewData> = {\n get value(): ViewData {\n if (!_viewData$) {\n _viewData$ = createViewDataObservable();\n }\n return _viewData$.value;\n },\n subscribe(callback: (value: ViewData) => void): () => void {\n if (!_viewData$) {\n _viewData$ = createViewDataObservable();\n }\n return _viewData$.subscribe(callback);\n },\n};\n\n/**\n * Create a combined observable for view data\n */\nfunction createViewDataObservable(): Observable<ViewData> {\n const getValue = (): ViewData => {\n const adaptor = getAdaptor();\n return {\n input: adaptor.getToolInput(),\n output: adaptor.getToolOutput(),\n metadata: adaptor.getToolResponseMetadata(),\n };\n };\n\n const subscribeToChanges = (callback: () => void): (() => void) => {\n const adaptor = getAdaptor();\n const unsubInput = adaptor.getExternalStore('toolInput').subscribe(callback);\n const unsubOutput = adaptor.getExternalStore('toolOutput').subscribe(callback);\n const unsubMeta = adaptor.getExternalStore('toolResponseMetadata').subscribe(callback);\n\n return () => {\n unsubInput();\n unsubOutput();\n unsubMeta();\n };\n };\n\n return createObservable(getValue, subscribeToChanges);\n}\n\n// ============================================\n// Reset for Testing\n// ============================================\n\n/**\n * Reset all cached observables (for testing purposes)\n * @internal\n */\nexport function resetObservables(): void {\n _theme$ = null;\n _locale$ = null;\n _displayMode$ = null;\n _safeArea$ = null;\n _containerSize$ = null;\n _platform$ = null;\n _deviceType$ = null;\n _inputCapabilities$ = null;\n _viewData$ = null;\n}\n"]}