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 { isClipboardTextByteLengthOverLimit } from './clipboard-text'
/** Explorer name-filter matching, shared so the host can filter a scan exactly like the renderer. */
export const FILE_NAME_FILTER_QUERY_MAX_BYTES = 2 * 1024
export function isFileNameFilterQueryTooLarge(
query: string,
maxBytes = FILE_NAME_FILTER_QUERY_MAX_BYTES
): boolean {
return isClipboardTextByteLengthOverLimit(query, maxBytes)
}
// Scan whitespace without a split array on the renderer’s pasted-query hot path.
export function splitFileNameFilterTokens(query: string): string[] {
const tokens: string[] = []
let tokenStart = -1
for (let index = 0; index <= query.length; index += 1) {
const isEnd = index === query.length
if (!isEnd && !isFileNameFilterWhitespace(query.charCodeAt(index))) {
if (tokenStart === -1) {
tokenStart = index
}
continue
}
if (tokenStart !== -1) {
tokens.push(query.slice(tokenStart, index).toLowerCase())
tokenStart = -1
}
}
return tokens
}
function isFileNameFilterWhitespace(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
)
}
export function pathMatchesFileNameFilterTokens(
relativePath: string,
tokens: readonly string[]
): boolean {
if (tokens.length === 0) {
return true
}
// Locale-independent folding keeps host/renderer matching aligned; paths arrive normalized.
const haystack = relativePath.toLowerCase()
return tokens.every((token) => haystack.includes(token))
}