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
/** Timeouts and rejections both resolve fallback; callers needing the distinction must handle rejection before passing the promise. */
export function withTimeout<T>(promise: Promise<T>, timeoutMs: number, fallback: T): Promise<T> {
let timeout: ReturnType<typeof setTimeout> | null = null
return new Promise<T>((resolve) => {
timeout = setTimeout(() => resolve(fallback), timeoutMs)
promise.then(
(value) => resolve(value),
() => resolve(fallback)
)
}).finally(() => {
if (timeout) {
clearTimeout(timeout)
}
})
}