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.

757 B
Raw Blame
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' }
}