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