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.3 KB
Raw Blame
import { bindDeferredRpcOperation, defineRpcOperation } from '../transport/rpc-operation'
import { rpcResultVariant } from '../transport/rpc-operation-result-reader'
import {
  fileOwnershipSshStateSchema,
  fileOwnershipWorktreeSchema
} from './file-ownership-reply-schema'

// All ownership reads must succeed before a write: refusal or malformed replies abort with a named error rather than risking the wrong host.

// Reuse the Tasks runtime-status operation; this gate needs the same fields.
export { taskRuntimeStatusRead as fileOwnershipRuntimeStatusRead } from '../tasks/mobile-task-runtime-operations'

export const fileOwnershipWorktreeRead = bindDeferredRpcOperation(
  defineRpcOperation({
    name: 'worktree.file-mutation-owner',
    method: 'worktree.show',
    acceptance: 'require-result-or-throw-message',
    barrier: 'after-caller-barrier',
    read: rpcResultVariant('worktree-summary', fileOwnershipWorktreeSchema)
  })
)

export const fileOwnershipSshStateRead = bindDeferredRpcOperation(
  defineRpcOperation({
    name: 'ssh.file-mutation-owner-state',
    method: 'ssh.getState',
    acceptance: 'require-result-or-throw-message',
    barrier: 'after-caller-barrier',
    read: rpcResultVariant('ssh-connection-state', fileOwnershipSshStateSchema)
  })
)

export type MobileFileOwnershipRpcSender = Parameters<typeof fileOwnershipWorktreeRead.request>[0]