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.
TypeScript adeagent-ideai-agentsautomationbotclaude-codecodexghosttygrok-bothermes-agentmobile-appmuseopenclawopencodeorchestrationpiruntimeterminalworktreesyc-backed
import type { AgentSessionLease, AgentSessionRecord } from './agent-session-record'
export type AgentSessionConversationView = Readonly<ReturnType<typeof agentSessionConversationView>>
export type AgentSessionOwnerObservation = AgentSessionConversationView['ownerObservation']
type ConversationFacts = Omit<AgentSessionRecord, 'lease'> & {
lease: Omit<AgentSessionLease, 'minimumNextFence'> & { minimumNextFence?: unknown }
}
export const AGENT_SESSION_FOUNDING_FENCE = 1
export function agentSessionNeverStarted({
lease,
providerHandleChain
}: ConversationFacts): boolean {
return (
lease.claimStatus === 'released' &&
lease.runtimeFence === AGENT_SESSION_FOUNDING_FENCE &&
lease.minimumNextFence === undefined &&
lease.ownerProcess === null &&
lease.reservedSpawnToken === null &&
lease.handoffStage === null &&
providerHandleChain.length === 0
)
}
export function agentSessionConversationView(record: ConversationFacts) {
const { lease, ...conversation } = record
const {
claimStatus,
handoffStage,
handoffOperationId,
ownerProcess,
reservedSpawnToken,
provenHandleLinkId,
leaseDeadlineAt,
lastRenewedAt,
deathEvidence,
unreconciled
} = lease
return {
...conversation,
currentFence: lease.runtimeFence,
neverStarted: agentSessionNeverStarted(record),
ownerObservation: {
claimStatus,
handoffStage,
handoffOperationId,
ownerProcess,
reservedSpawnToken,
provenHandleLinkId,
leaseDeadlineAt,
lastRenewedAt,
deathEvidence,
unreconciled
}
} as const
}