mirror of
https://github.com/stablyai/orca.git
synced 2026-10-23 00:03:52 +00:00
Extends AI Vault session history to surface Cursor agent sessions with proper isolation across native, WSL, and SSH execution contexts. Implements cursor sidecar discovery and parsing (local and remote), host-matched command resolution, and metadata-only conversation tracking for sessions without readable transcripts. Adds mobile support for Cursor history resume and strengthens execution-context validation to prevent resuming sessions in incompatible target environments.
30 lines
1.2 KiB
TypeScript
30 lines
1.2 KiB
TypeScript
import { resolveEffectiveCursorCommand } from '../../shared/cursor-command'
|
|
import type { TuiAgent } from '../../shared/types'
|
|
import { parseWslUncPath } from '../../shared/wsl-paths'
|
|
import {
|
|
detectInstalledAgentCommandsWithShellPathHydration,
|
|
detectRemoteAgentCommands
|
|
} from '../ipc/tui-agent-inventory-detection'
|
|
|
|
export async function resolveRuntimeAgentCommandOverrides(args: {
|
|
agent: TuiAgent
|
|
cmdOverrides: Partial<Record<TuiAgent, string>>
|
|
connectionId?: string | null
|
|
wslDistro?: string | null
|
|
workspacePath: string
|
|
}): Promise<Partial<Record<TuiAgent, string>>> {
|
|
if (args.agent !== 'cursor' || args.cmdOverrides.cursor?.trim()) {
|
|
return args.cmdOverrides
|
|
}
|
|
try {
|
|
const wslDistro = args.wslDistro?.trim() || parseWslUncPath(args.workspacePath)?.distro
|
|
const inventory = args.connectionId
|
|
? await detectRemoteAgentCommands({ connectionId: args.connectionId })
|
|
: await detectInstalledAgentCommandsWithShellPathHydration(wslDistro ? { wslDistro } : {})
|
|
const command = resolveEffectiveCursorCommand(null, inventory)
|
|
return command ? { ...args.cmdOverrides, cursor: command } : args.cmdOverrides
|
|
} catch {
|
|
return args.cmdOverrides
|
|
}
|
|
}
|