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 { ExecutionHostId } from './execution-host'
import { normalizeRuntimePathForComparison, relativePathInsideRoot } from './cross-platform-path'
export type RuntimeWorkspaceFileRoot = {
workspaceId: string
rootPath: string
executionHostId: ExecutionHostId
}
export type RuntimeWorkspaceFileOwner = RuntimeWorkspaceFileRoot & {
relativePath: string
}
export function findRuntimeWorkspaceFileOwner(
roots: readonly RuntimeWorkspaceFileRoot[],
absolutePath: string,
executionHostId: ExecutionHostId
): RuntimeWorkspaceFileOwner | null {
let best: RuntimeWorkspaceFileOwner | null = null
let bestRootLength = -1
for (const root of roots) {
if (root.executionHostId !== executionHostId) {
continue
}
const relativePath = relativePathInsideRoot(root.rootPath, absolutePath)
if (relativePath === null) {
continue
}
const rootLength = normalizeRuntimePathForComparison(root.rootPath).length
if (
rootLength > bestRootLength ||
(rootLength === bestRootLength &&
best !== null &&
root.workspaceId.localeCompare(best.workspaceId) < 0)
) {
best = { ...root, relativePath }
bestRootLength = rootLength
}
}
return best
}