export { forSession } from './companion-realtime.js'; import { type RemoteRuntimeEvents } from '@pellux/goodvibes-transport-realtime'; import { type GoodVibesSdkOptions, type GoodVibesSdk, type RuntimeEventRecord } from './client.js'; export interface ReactNativeGoodVibesSdkOptions extends GoodVibesSdkOptions { readonly WebSocketImpl?: typeof WebSocket | undefined; } export interface ReactNativeGoodVibesRealtime { runtime(): RemoteRuntimeEvents; viaWebSocket(webSocketImpl?: typeof WebSocket): RemoteRuntimeEvents; } export type ReactNativeGoodVibesSdk = Omit & { readonly realtime: ReactNativeGoodVibesRealtime; }; /** * Create a GoodVibes SDK instance for React Native. * * Key differences from the browser factory: * - Realtime is WebSocket-only (`realtime.runtime()` / `realtime.viaWebSocket()`). * SSE is not available in React Native. * - Requires a `WebSocket` implementation (e.g. the global provided by the * React Native runtime or the `react-native` package). Pass * `options.WebSocketImpl` when the global is not available. * - The daemon authenticates the upgrade request itself and answers 401 when * it carries no `Authorization` header, so realtime needs a wrapper * implementation that attaches the bearer token via React Native's * `(url, protocols, { headers })` constructor form (see the example). * - Returns `ReactNativeGoodVibesSdk` (extends `GoodVibesSdk` with a * React-Native-specific `realtime` namespace). * * @example * // Example only: replace baseUrl and authToken with your own values. * import { createReactNativeGoodVibesSdk } from '@pellux/goodvibes-sdk/react-native'; * * const sdk = createReactNativeGoodVibesSdk({ * baseUrl: 'https://daemon.example.com', * authToken: await SecureStore.getItemAsync('token'), * }); * * // The upgrade must carry the bearer token; RN's WebSocket accepts headers. * const token = await SecureStore.getItemAsync('token'); * const AuthorizedWebSocket = function (url: string | URL): WebSocket { * return new (WebSocket as never)(String(url), [], { * headers: { Authorization: `Bearer ${token}` }, * }); * } as unknown as typeof WebSocket; * * const events = sdk.realtime.viaWebSocket(AuthorizedWebSocket); * events.agents.on('AGENT_SPAWNING', ({ agentId }) => console.log(agentId)); */ export declare function createReactNativeGoodVibesSdk(options: ReactNativeGoodVibesSdkOptions): ReactNativeGoodVibesSdk; export { createIOSKeychainTokenStore, type IOSKeychainTokenStore, type IOSKeychainTokenStoreOptions, type KeychainAccessible, } from './client-auth/ios-keychain-token-store.js'; export { createAndroidKeystoreTokenStore, type AndroidKeystoreTokenStore, type AndroidKeystoreTokenStoreOptions, type AndroidAccessControl, type AndroidAccessible, } from './client-auth/android-keystore-token-store.js'; //# sourceMappingURL=react-native.d.ts.map