( setAppState: (updater: (prev: AppState) => AppState) => void, )
| 86 | * schedules eviction via evictAfter so the row lingers briefly. |
| 87 | */ |
| 88 | export function exitTeammateView( |
| 89 | setAppState: (updater: (prev: AppState) => AppState) => void, |
| 90 | ): void { |
| 91 | logEvent('tengu_transcript_view_exit', {}) |
| 92 | setAppState(prev => { |
| 93 | const id = prev.viewingAgentTaskId |
| 94 | const cleared = { |
| 95 | ...prev, |
| 96 | viewingAgentTaskId: undefined, |
| 97 | viewSelectionMode: 'none' as const, |
| 98 | } |
| 99 | if (id === undefined) { |
| 100 | return prev.viewSelectionMode === 'none' ? prev : cleared |
| 101 | } |
| 102 | const task = prev.tasks[id] |
| 103 | if (!isLocalAgent(task) || !task.retain) return cleared |
| 104 | return { |
| 105 | ...cleared, |
| 106 | tasks: { ...prev.tasks, [id]: release(task) }, |
| 107 | } |
| 108 | }) |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * Context-sensitive x: running → abort, terminal → dismiss. |
no test coverage detected