mirror of
https://github.com/stablyai/orca.git
synced 2026-09-24 08:02:33 +00:00
* Add global external worktree visibility defaults * Expand global worktree visibility source defaults * Fix host-scoped visibility settings races * Fix global worktree visibility integration * Enable source visibility defaults on mobile * Polish external worktree settings navigation * Clarify inherited worktree visibility settings * feat(sidebar): replace the inherited-visibility switch with a Show/Hide picker Each source row now shows a two-segment Show / Hide control preselected to the global setting, and explains itself only where the project actually disagrees: an "Overriding global setting: <value>" card names the value being ignored. Picking the segment global already holds drops the override instead of pinning a duplicate, so the same control both overrides and reverts, retiring the separate "Use global" link. The dialog footer now lists every inheritable source with its global value. * fix(sidebar): preserve reset for matching visibility overrides
85 lines
2.9 KiB
TypeScript
85 lines
2.9 KiB
TypeScript
import { parseAuthenticatedFrame, parseReadyFrame } from './remote-runtime-request-frames'
|
|
import type { RemoteRuntimeClientError } from './remote-runtime-client-error'
|
|
import {
|
|
AGENT_SESSION_BOUNDARY_RUNTIME_CAPABILITY,
|
|
SESSION_TAB_CLOSE_INTENT_RUNTIME_CAPABILITY,
|
|
WORKTREE_VISIBILITY_DEFAULTS_RUNTIME_CAPABILITY,
|
|
WORKTREE_VISIBILITY_SOURCE_DEFAULTS_RUNTIME_CAPABILITY
|
|
} from './protocol-version'
|
|
import { dispatchSharedControlFrame } from './remote-runtime-shared-control-frame-dispatch'
|
|
import { parseSharedControlFrame } from './remote-runtime-shared-control-protocol'
|
|
import type { SharedControlRetiredRequestIds } from './remote-runtime-shared-control-retired-request-ids'
|
|
import { resolveSharedControlReadyWaiters } from './remote-runtime-shared-control-state'
|
|
import type {
|
|
SharedControlConnectionState,
|
|
SharedControlLogicalSubscription,
|
|
SharedControlPendingRequest,
|
|
SharedControlReadyWaiter
|
|
} from './remote-runtime-shared-control-types'
|
|
|
|
export function handleSharedControlTextFrame(args: {
|
|
frame: string
|
|
state: SharedControlConnectionState
|
|
sharedKey: Uint8Array | null
|
|
deviceToken: string
|
|
environmentId?: string
|
|
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
|
|
}): void {
|
|
if (args.state === 'awaiting_ready') {
|
|
const error = parseReadyFrame(args.frame)
|
|
if (error) {
|
|
args.handleSocketClosed(error)
|
|
return
|
|
}
|
|
args.setState('awaiting_authenticated')
|
|
args.sendEncrypted({
|
|
type: 'e2ee_auth',
|
|
deviceToken: args.deviceToken,
|
|
clientCapabilities: [
|
|
SESSION_TAB_CLOSE_INTENT_RUNTIME_CAPABILITY,
|
|
AGENT_SESSION_BOUNDARY_RUNTIME_CAPABILITY,
|
|
WORKTREE_VISIBILITY_DEFAULTS_RUNTIME_CAPABILITY,
|
|
WORKTREE_VISIBILITY_SOURCE_DEFAULTS_RUNTIME_CAPABILITY
|
|
]
|
|
})
|
|
return
|
|
}
|
|
|
|
const parsed = parseSharedControlFrame(args.frame, args.sharedKey, args.state)
|
|
if (parsed.type === 'auth') {
|
|
const error = parseAuthenticatedFrame(parsed.plaintext)
|
|
if (error) {
|
|
args.handleSocketClosed(error)
|
|
return
|
|
}
|
|
args.setState('ready')
|
|
args.markReady()
|
|
resolveSharedControlReadyWaiters(args.readyWaiters)
|
|
args.replaySubscriptions()
|
|
return
|
|
}
|
|
|
|
if (parsed.type === 'error') {
|
|
args.handleSocketClosed(parsed.error)
|
|
return
|
|
}
|
|
|
|
dispatchSharedControlFrame({
|
|
environmentId: args.environmentId,
|
|
frame: parsed.frame,
|
|
pendingRequests: args.pendingRequests,
|
|
subscriptions: args.subscriptions,
|
|
retiredRequestIds: args.retiredRequestIds,
|
|
deviceToken: args.deviceToken,
|
|
send: args.sendEncrypted
|
|
})
|
|
}
|