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