mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 08:02:28 +00:00
* fix(remote): recover stalled terminal streams * fix(i18n): localize manual disconnect error * fix(remote): park paired terminals with host snapshots * test(remote): mock authoritative resync snapshots * fix(terminal): defer startup mounts until hydration * fix(remote): raise paired terminal stream capacity * fix(remote): harden terminal recovery lifecycle * fix(remote): preserve calls across control refresh * test(remote): harden paired recovery oracle * test(workspace): seed Jira source context * test(remote): assert raw host terminal identities * test(terminal): keep restore sentinels atomic * test(terminal): keep restore sentinel on one row --------- Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
47 lines
1.7 KiB
TypeScript
47 lines
1.7 KiB
TypeScript
import type WebSocket from 'ws'
|
|
import { logSharedControlSocketClose } from './remote-runtime-shared-control-diagnostics-log'
|
|
import { closeSharedControlSocketState } from './remote-runtime-shared-control-state'
|
|
import { finishCloseAfterReadySubscriptions } from './remote-runtime-shared-control-subscriptions'
|
|
import type {
|
|
SharedControlConnectionState,
|
|
SharedControlLogicalSubscription,
|
|
SharedControlPendingRequest,
|
|
SharedControlReadyWaiter
|
|
} from './remote-runtime-shared-control-types'
|
|
|
|
export function closeSharedControlSocket(args: {
|
|
environmentId?: string
|
|
state: SharedControlConnectionState
|
|
ws: WebSocket | null
|
|
socketCleanup: (() => void) | null
|
|
pendingRequests: Map<string, SharedControlPendingRequest<unknown>>
|
|
subscriptions: Map<string, SharedControlLogicalSubscription<unknown>>
|
|
readyWaiters: SharedControlReadyWaiter[]
|
|
lastClose: { code: number; reason: string } | null
|
|
error?: Error
|
|
preserveReadyWaitersAndPendingRequests?: boolean
|
|
clearReadyStableTimer: () => void
|
|
}): void {
|
|
if (args.ws || args.socketCleanup) {
|
|
logSharedControlSocketClose({
|
|
environmentId: args.environmentId ?? 'unknown',
|
|
state: args.state,
|
|
pendingRequests: args.pendingRequests,
|
|
subscriptions: args.subscriptions,
|
|
lastClose: args.lastClose,
|
|
error: args.error
|
|
})
|
|
}
|
|
args.clearReadyStableTimer()
|
|
finishCloseAfterReadySubscriptions(args.subscriptions)
|
|
closeSharedControlSocketState({
|
|
readyWaiters: args.readyWaiters,
|
|
pendingRequests: args.pendingRequests,
|
|
subscriptions: args.subscriptions,
|
|
socketCleanup: args.socketCleanup,
|
|
ws: args.ws,
|
|
error: args.error,
|
|
preserveReadyWaitersAndPendingRequests: args.preserveReadyWaitersAndPendingRequests
|
|
})
|
|
}
|