( appState: AppState, )
| 57 | * Used by input routing logic to direct user messages to the correct agent. |
| 58 | */ |
| 59 | export function getActiveAgentForInput( |
| 60 | appState: AppState, |
| 61 | ): ActiveAgentForInput { |
| 62 | const viewedTask = getViewedTeammateTask(appState) |
| 63 | if (viewedTask) { |
| 64 | return { type: 'viewed', task: viewedTask } |
| 65 | } |
| 66 | |
| 67 | const { viewingAgentTaskId, tasks } = appState |
| 68 | if (viewingAgentTaskId) { |
| 69 | const task = tasks[viewingAgentTaskId] |
| 70 | if (task?.type === 'local_agent') { |
| 71 | return { type: 'named_agent', task } |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | return { type: 'leader' } |
| 76 | } |
no test coverage detected