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
import { buildImageDataUri } from '../../../src/shared/image-data-uri'

// Only modifiedDeleted proves deletion; read failures can also return empty modifiedContent with modifiedIsBinary false.
// Omit kind: the reply reader admits every non-text arm, including unknown host arms.
export type MobileBinaryDiffResult = {
  kind?: string
  originalContent?: string
  modifiedContent?: string
  originalIsBinary?: boolean
  modifiedIsBinary?: boolean
  modifiedDeleted?: boolean
  isImage?: boolean
  mimeType?: string
}

// Use original bytes only for proven deletion; failed or size-capped reads must not show a stale image.
export function mobileDiffImageDataUri(result: MobileBinaryDiffResult): string | null {
  if (result.isImage !== true) {
    return null
  }
  const modified = result.modifiedContent || ''
  if (modified) {
    return buildImageDataUri(result.mimeType, modified)
  }
  if (result.modifiedDeleted === true) {
    return buildImageDataUri(result.mimeType, result.originalContent || '')
  }
  return null
}