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
/** Keep input inserted while a submitted snapshot was in flight; other edits keep the whole draft. */
export function textLeftAfterSubmission(
current: string,
submitted: string
): { text: string; from: number; to: number } | null {
let from = 0
while (from < submitted.length && submitted[from] === current[from]) {
from++
}
const rest = submitted.slice(from)
if (current.length < submitted.length || !current.endsWith(rest)) {
return null
}
const to = current.length - rest.length
return { text: current.slice(from, to), from, to }
}