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
const ORPHAN_SGR_RE = /\[(?:\d{1,3}(?:;\d{1,3})*)?m/g
export function cleanCommandCodePromptCandidate(value: string): string {
return foldCommandCodePromptWhitespace(value)
}
export function isCommandCodeIdlePromptCandidate(value: string): boolean {
return equalsCommandCodePromptIgnoringWhitespace(
value.replace(ORPHAN_SGR_RE, ''),
'Askyourquestion...'
)
}
// Collapse display whitespace without regex normalization on every PTY status frame.
function foldCommandCodePromptWhitespace(value: string): string {
let normalized = ''
let pendingWhitespace = false
for (let index = 0; index < value.length; index += 1) {
const code = value.charCodeAt(index)
if (isCommandCodePromptWhitespace(code)) {
pendingWhitespace = normalized.length > 0
continue
}
if (pendingWhitespace) {
normalized += ' '
pendingWhitespace = false
}
normalized += value.charAt(index)
}
return normalized
}
function equalsCommandCodePromptIgnoringWhitespace(value: string, expected: string): boolean {
let expectedIndex = 0
for (let index = 0; index < value.length; index += 1) {
const code = value.charCodeAt(index)
if (isCommandCodePromptWhitespace(code)) {
continue
}
if (value.charAt(index) !== expected.charAt(expectedIndex)) {
return false
}
expectedIndex += 1
}
return expectedIndex === expected.length
}
function isCommandCodePromptWhitespace(code: number): boolean {
return (
code === 32 ||
(code >= 9 && code <= 13) ||
code === 160 ||
code === 5760 ||
(code >= 8192 && code <= 8202) ||
code === 8232 ||
code === 8233 ||
code === 8239 ||
code === 8287 ||
code === 12288 ||
code === 65279
)
}