/** A mounted browser pane's find bar. Both ids are known to whoever renders the chrome. */ export type BrowserFindSource = { browserPageId: string browserWorkspaceId: string } /** Forward chrome chords by unique page ID even without workspace: client-hosted commands lack it, unlike renderer-registered guests. */ export type BrowserFindTarget = { browserPageId: string browserWorkspaceId?: string } export function asBrowserFindTarget(value: unknown): BrowserFindTarget | null { if (!value || typeof value !== 'object' || Array.isArray(value)) { return null } const target = value as Partial if (typeof target.browserPageId !== 'string' || target.browserPageId.length === 0) { return null } if (target.browserWorkspaceId === undefined) { return { browserPageId: target.browserPageId } } if (typeof target.browserWorkspaceId !== 'string' || target.browserWorkspaceId.length === 0) { return null } return { browserPageId: target.browserPageId, browserWorkspaceId: target.browserWorkspaceId } }