| 44 | | SDKControlCancelRequest |
| 45 | |
| 46 | function isSessionsMessage(value: unknown): value is SessionsMessage { |
| 47 | if (typeof value !== 'object' || value === null || !('type' in value)) { |
| 48 | return false |
| 49 | } |
| 50 | // Accept any message with a string `type` field. Downstream handlers |
| 51 | // (sdkMessageAdapter, RemoteSessionManager) decide what to do with |
| 52 | // unknown types. A hardcoded allowlist here would silently drop new |
| 53 | // message types the backend starts sending before the client is updated. |
| 54 | return typeof value.type === 'string' |
| 55 | } |
| 56 | |
| 57 | export type SessionsWebSocketCallbacks = { |
| 58 | onMessage: (message: SessionsMessage) => void |