Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

1.0 KB
Raw Blame
/** 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<BrowserFindSource>
  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 }
}