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>
56 lines
2.1 KiB
TypeScript
56 lines
2.1 KiB
TypeScript
import { handleSharedControlTextFrame } from './remote-runtime-shared-control-frame-handler'
|
|
import type { RemoteRuntimeClientError } from './remote-runtime-client-error'
|
|
import type { RuntimeCapability } from './protocol-version'
|
|
import type {
|
|
SharedControlConnectionState,
|
|
SharedControlLogicalSubscription,
|
|
SharedControlPendingRequest,
|
|
SharedControlReadyWaiter
|
|
} from './remote-runtime-shared-control-types'
|
|
import type { SharedControlRetiredRequestIds } from './remote-runtime-shared-control-retired-request-ids'
|
|
|
|
export function handleRuntimeControlTextFrame(args: {
|
|
frame: string
|
|
socketGeneration: number
|
|
isCurrent: (generation: number) => boolean
|
|
getState: () => SharedControlConnectionState
|
|
getSharedKey: () => Uint8Array | null
|
|
environmentId?: string
|
|
deviceToken: string
|
|
clientCapabilities: readonly RuntimeCapability[]
|
|
pendingRequests: Map<string, SharedControlPendingRequest<unknown>>
|
|
subscriptions: Map<string, SharedControlLogicalSubscription<unknown>>
|
|
retiredRequestIds: SharedControlRetiredRequestIds
|
|
readyWaiters: SharedControlReadyWaiter[]
|
|
setState: (state: SharedControlConnectionState) => void
|
|
handleSocketClosed: (error: RemoteRuntimeClientError) => void
|
|
sendEncrypted: (payload: unknown) => boolean
|
|
markReady: () => void
|
|
replaySubscriptions: () => void
|
|
publishDiagnostics: () => void
|
|
}): void {
|
|
if (!args.isCurrent(args.socketGeneration)) {
|
|
return
|
|
}
|
|
handleSharedControlTextFrame({
|
|
frame: args.frame,
|
|
state: args.getState(),
|
|
sharedKey: args.getSharedKey(),
|
|
environmentId: args.environmentId,
|
|
deviceToken: args.deviceToken,
|
|
clientCapabilities: args.clientCapabilities,
|
|
pendingRequests: args.pendingRequests,
|
|
subscriptions: args.subscriptions,
|
|
retiredRequestIds: args.retiredRequestIds,
|
|
readyWaiters: args.readyWaiters,
|
|
setState: (state) => {
|
|
args.setState(state)
|
|
args.publishDiagnostics()
|
|
},
|
|
handleSocketClosed: args.handleSocketClosed,
|
|
sendEncrypted: args.sendEncrypted,
|
|
markReady: args.markReady,
|
|
replaySubscriptions: args.replaySubscriptions
|
|
})
|
|
}
|