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 { AgentType } from './agent-status-types'
import type { SessionOptionValue } from './native-chat/input/native-chat-session-options'
import {
cloneNativeChatSessionOptionRecord,
createNativeChatSessionOptionRecord,
type NativeChatSessionOptionRecord,
type TrackedNativeChatSessionOption
} from './native-chat/input/native-chat-session-option-state'
import { setBoundedScopeCacheEntry } from './native-chat/native-chat-scope-cache'
const sessionOptionCache = new Map<string, NativeChatSessionOptionRecord>()
export function readNativeChatSessionOptionCache(
scopeKey: string,
fallbackScopeKey?: string
): NativeChatSessionOptionRecord | null {
const record = sessionOptionCache.get(scopeKey) ?? sessionOptionCache.get(fallbackScopeKey ?? '')
return record ? cloneNativeChatSessionOptionRecord(record) : null
}
export function writeNativeChatSessionOptionCache(
scopeKey: string,
record: NativeChatSessionOptionRecord
): void {
setBoundedScopeCacheEntry(
sessionOptionCache,
scopeKey,
cloneNativeChatSessionOptionRecord(record)
)
}
export function seedNativeChatAppliedSessionOptions(
scopeKey: string,
agent: AgentType,
values: Record<string, SessionOptionValue> | null | undefined
): void {
const modelId = typeof values?.model === 'string' ? values.model : null
if (!modelId) {
return
}
const record = createNativeChatSessionOptionRecord(agent)
record.model = { value: modelId, source: 'applied' }
const modelValues: Record<string, TrackedNativeChatSessionOption> = {}
for (const [id, value] of Object.entries(values ?? {})) {
if (id !== 'model') {
modelValues[id] = { value, source: 'applied' }
}
}
record.valuesByModel[modelId] = modelValues
writeNativeChatSessionOptionCache(scopeKey, record)
}
export function clearNativeChatSessionOptionCacheForTests(): void {
sessionOptionCache.clear()
}