( appState: Pick<AppState, 'viewingAgentTaskId' | 'tasks'>, )
| 16 | * - The task is not an in-process teammate task |
| 17 | */ |
| 18 | export function getViewedTeammateTask( |
| 19 | appState: Pick<AppState, 'viewingAgentTaskId' | 'tasks'>, |
| 20 | ): InProcessTeammateTaskState | undefined { |
| 21 | const { viewingAgentTaskId, tasks } = appState |
| 22 | |
| 23 | // Not viewing any teammate |
| 24 | if (!viewingAgentTaskId) { |
| 25 | return undefined |
| 26 | } |
| 27 | |
| 28 | // Look up the task |
| 29 | const task = tasks[viewingAgentTaskId] |
| 30 | if (!task) { |
| 31 | return undefined |
| 32 | } |
| 33 | |
| 34 | // Verify it's an in-process teammate task |
| 35 | if (!isInProcessTeammateTask(task)) { |
| 36 | return undefined |
| 37 | } |
| 38 | |
| 39 | return task |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Return type for getActiveAgentForInput selector. |
no test coverage detected