mirror of
https://github.com/stablyai/orca.git
synced 2026-10-25 08:04:05 +00:00
* fix(browser): close guest-owned split tab * fix: check sourceId before toggling floating panel on close The empty-panel toggle is the ambient fallback only. Guest-initiated closes (with sourceId) target the main workspace and should not toggle the panel. * test(browser-split-shortcuts): remove terminal-mirrors close test and un Removes test case that verified Cmd+W closes guest-owned browser splits when active-tab mirrors point to a terminal, along with the helper function and unused fixture properties that only that test required.
26 lines
757 B
TypeScript
26 lines
757 B
TypeScript
import type { CloseActiveTabPayload } from './api/ui-command-event-api'
|
|
|
|
export type AdmittedCloseActiveTabPayload =
|
|
| { kind: 'legacy' }
|
|
| { kind: 'source'; payload: CloseActiveTabPayload }
|
|
| { kind: 'invalid' }
|
|
|
|
export function admitCloseActiveTabPayload(value: unknown): AdmittedCloseActiveTabPayload {
|
|
if (value === undefined) {
|
|
return { kind: 'legacy' }
|
|
}
|
|
if (
|
|
typeof value === 'object' &&
|
|
value !== null &&
|
|
!Array.isArray(value) &&
|
|
typeof (value as Record<string, unknown>).sourceId === 'string' &&
|
|
(value as Record<string, unknown>).sourceId !== ''
|
|
) {
|
|
return {
|
|
kind: 'source',
|
|
payload: { sourceId: (value as Record<string, unknown>).sourceId as string }
|
|
}
|
|
}
|
|
return { kind: 'invalid' }
|
|
}
|