(...lists: CollabAgentStatus[][])
| 140 | } |
| 141 | |
| 142 | function mergeCollabAgentStatuses(...lists: CollabAgentStatus[][]) { |
| 143 | const byThreadId = new Map<string, CollabAgentStatus>(); |
| 144 | lists.forEach((list) => { |
| 145 | list.forEach((entry) => { |
| 146 | const existing = byThreadId.get(entry.threadId); |
| 147 | if (!existing) { |
| 148 | byThreadId.set(entry.threadId, { ...entry }); |
| 149 | return; |
| 150 | } |
| 151 | byThreadId.set(entry.threadId, { |
| 152 | threadId: existing.threadId, |
| 153 | status: existing.status || entry.status, |
| 154 | nickname: existing.nickname ?? entry.nickname, |
| 155 | role: existing.role ?? entry.role, |
| 156 | }); |
| 157 | }); |
| 158 | }); |
| 159 | return Array.from(byThreadId.values()); |
| 160 | } |
| 161 | |
| 162 | function withCollabAgentMetadata( |
| 163 | statuses: CollabAgentStatus[], |
no outgoing calls
no test coverage detected