mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 16:02:32 +00:00
* fix(runtime): publish remote control diagnostics to renderer * test(runtime): account for diagnostics bridge listener * fix(i18n): add runtime connection state labels * test(runtime): clean up shared control connection * fix(runtime): fence diagnostics by shared-control capability * fix(runtime): preserve authoritative transport state * fix(runtime): preserve diagnostic overlay lifecycle * fix(runtime): avoid publishing unchanged diagnostics state --------- Co-authored-by: Merge Sim <sim@local>
30 lines
775 B
TypeScript
30 lines
775 B
TypeScript
import type WebSocket from 'ws'
|
|
import type {
|
|
SharedControlConnectionState,
|
|
SharedControlReadyWaiter
|
|
} from './remote-runtime-shared-control-types'
|
|
import {
|
|
isSharedControlReady,
|
|
waitForSharedControlReadyWithTimeout
|
|
} from './remote-runtime-shared-control-ready'
|
|
|
|
export function ensureSharedControlReady(args: {
|
|
state: SharedControlConnectionState
|
|
ws: WebSocket | null
|
|
sharedKey: Uint8Array | null
|
|
readyWaiters: SharedControlReadyWaiter[]
|
|
timeoutMs: number
|
|
signal?: AbortSignal
|
|
open: () => void
|
|
}): Promise<void> {
|
|
if (isSharedControlReady(args)) {
|
|
return Promise.resolve()
|
|
}
|
|
return waitForSharedControlReadyWithTimeout({
|
|
readyWaiters: args.readyWaiters,
|
|
timeoutMs: args.timeoutMs,
|
|
signal: args.signal,
|
|
open: args.open
|
|
})
|
|
}
|