mirror of
https://github.com/stablyai/orca.git
synced 2026-10-21 08:03:33 +00:00
* fix(agent-hooks): skip unavailable agent homes * refactor(agent-hooks): separate Pi and OMP home fix * test(agent-hooks): update merged protocol harnesses * fix(agent-hooks): avoid redundant reconciliation * fix(agent-hooks): harden reconciliation and detection * test(agent-hooks): cover settings reconciliation * fix(agent-hooks): hydrate PATH for paired clients
33 lines
1021 B
TypeScript
33 lines
1021 B
TypeScript
import { AGENT_HOOK_TARGETS, type AgentHookTarget } from './agent-hook-types'
|
|
import { getTuiAgentDetectCommands, TUI_AGENT_CONFIG } from './tui-agent-config'
|
|
import type { TuiAgent } from './types'
|
|
|
|
export type ManagedAgentHookTarget = {
|
|
agent: AgentHookTarget
|
|
tuiAgent: TuiAgent
|
|
executableCandidates: readonly string[]
|
|
}
|
|
|
|
function target(agent: AgentHookTarget): ManagedAgentHookTarget {
|
|
return {
|
|
agent,
|
|
tuiAgent: agent,
|
|
executableCandidates: getTuiAgentDetectCommands(TUI_AGENT_CONFIG[agent])
|
|
}
|
|
}
|
|
|
|
export const MANAGED_AGENT_HOOK_TARGETS: readonly ManagedAgentHookTarget[] =
|
|
AGENT_HOOK_TARGETS.map(target)
|
|
|
|
export function getManagedAgentHookTarget(
|
|
agent: AgentHookTarget
|
|
): ManagedAgentHookTarget | undefined {
|
|
return MANAGED_AGENT_HOOK_TARGETS.find((entry) => entry.agent === agent)
|
|
}
|
|
|
|
export function isManagedAgentHookTarget(value: unknown): value is AgentHookTarget {
|
|
return (
|
|
typeof value === 'string' && MANAGED_AGENT_HOOK_TARGETS.some((entry) => entry.agent === value)
|
|
)
|
|
}
|