diff --git a/src/main/runtime/workspace-session-terminal-membership-authority.ts b/src/main/runtime/workspace-session-terminal-membership-authority.ts index 76cbcdf4dad..7798ae7831c 100644 --- a/src/main/runtime/workspace-session-terminal-membership-authority.ts +++ b/src/main/runtime/workspace-session-terminal-membership-authority.ts @@ -70,7 +70,7 @@ function rebaseUnifiedTabs( (tab) => tab.contentType !== 'terminal' || terminalUnifiedTabMatches(tab, terminalTabIds) ) const representedTerminalIds = new Set( - result.filter((tab) => tab.contentType === 'terminal').flatMap((tab) => [tab.id, tab.entityId]) + result.flatMap((tab) => (tab.contentType === 'terminal' ? [tab.id, tab.entityId] : [])) ) for (const tab of current) { if ( diff --git a/src/relay/preflight-handler.ts b/src/relay/preflight-handler.ts index b84166e76ba..1be1a63f9d4 100644 --- a/src/relay/preflight-handler.ts +++ b/src/relay/preflight-handler.ts @@ -39,10 +39,7 @@ const CONSERVATIVE_SYSTEM_SHELL_DIRS = new Set(['/bin', '/usr/bin']) const AGENT_PATH_PREFIX = '__ORCA_AGENT_PATH__' export class PreflightHandler { - private dispatcher: RelayDispatcher - - constructor(dispatcher: RelayDispatcher) { - this.dispatcher = dispatcher + constructor(private readonly dispatcher: RelayDispatcher) { this.registerHandlers() } @@ -53,9 +50,7 @@ export class PreflightHandler { ) } - // Why: the client sends the command list rather than importing TUI_AGENT_CONFIG - // on the relay side. This keeps the relay bundle minimal and makes the protocol - // self-describing — the relay doesn't need to know the agent catalog. + // Why: client-supplied commands keep the relay independent of the agent catalog. private async detectAgents(params: Record): Promise<{ agents: string[] versions?: Record @@ -66,9 +61,11 @@ export class PreflightHandler { } const probeCommands = [ ...new Set( - commands - .filter((command) => !isDetectionUnsupportedInRuntime(command, process.platform)) - .flatMap((command) => [command.cmd, ...(command.requiredCommands ?? [])]) + commands.flatMap((command) => + isDetectionUnsupportedInRuntime(command, process.platform) + ? [] + : [command.cmd, ...(command.requiredCommands ?? [])] + ) ) ] diff --git a/src/shared/tui-agent-detection-commands.ts b/src/shared/tui-agent-detection-commands.ts index 1d9409a090b..dbce135b4c7 100644 --- a/src/shared/tui-agent-detection-commands.ts +++ b/src/shared/tui-agent-detection-commands.ts @@ -48,9 +48,11 @@ export function getTuiAgentDetectionProbeCommands( ): string[] { return [ ...new Set( - commands - .filter((command) => !isDetectionUnsupportedInRuntime(command, runtime)) - .flatMap((command) => [command.cmd, ...(command.requiredCommands ?? [])]) + commands.flatMap((command) => + isDetectionUnsupportedInRuntime(command, runtime) + ? [] + : [command.cmd, ...(command.requiredCommands ?? [])] + ) ) ] }