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.

973 B
Raw Blame
import { isRendererUnavailableReply } from '../transport/renderer-unavailable-reply'
import type { RpcFailure } from '../transport/types'
import type { MarkdownDocState } from './mobile-session-route-types'

export function shouldReadMarkdownFromDiskAfterReadTabFailure(response: RpcFailure): boolean {
  return isRendererUnavailableReply(response)
}

export function buildMarkdownDiskFallbackDoc(args: {
  content: string
  truncated?: boolean
  byteLength?: number
  tabIsDirty: boolean
}): Extract<MarkdownDocState, { status: 'ready' }> {
  const readOnlyReason = args.tabIsDirty
    ? 'Desktop has unsaved changes. Showing disk content.'
    : 'Editing needs Orca desktop running.'
  return {
    status: 'ready',
    content: args.content,
    localContent: args.content,
    baseVersion: '',
    isDirty: false,
    editable: false,
    stale: args.tabIsDirty,
    readOnlyReason,
    ...(args.truncated ? { truncated: true, byteLength: args.byteLength } : {})
  }
}