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.

943 B
Raw Blame
import AsyncStorage from '@react-native-async-storage/async-storage'
import { normalizeHostAppVersion } from './host-app-version'

const STORAGE_KEY_PREFIX = 'orca:host-app-version:v1:'

export async function loadHostAppVersion(hostId: string): Promise<string | null> {
  try {
    return normalizeHostAppVersion(await AsyncStorage.getItem(storageKey(hostId)))
  } catch {
    return null
  }
}

export async function recordHostAppVersion(hostId: string, value: unknown): Promise<void> {
  const appVersion = normalizeHostAppVersion(value)
  if (!appVersion) {
    return
  }
  try {
    const key = storageKey(hostId)
    if (normalizeHostAppVersion(await AsyncStorage.getItem(key)) !== appVersion) {
      await AsyncStorage.setItem(key, appVersion)
    }
  } catch {
    // Best-effort diagnostic metadata must never affect host connectivity.
  }
}

function storageKey(hostId: string): string {
  return `${STORAGE_KEY_PREFIX}${hostId}`
}