| 4269 | * uses a random agentId for transcript storage. |
| 4270 | */ |
| 4271 | export function extractTeammateTranscriptsFromTasks(tasks: { |
| 4272 | [taskId: string]: { |
| 4273 | type: string |
| 4274 | identity?: { agentId: string } |
| 4275 | messages?: Message[] |
| 4276 | } |
| 4277 | }): { [agentId: string]: Message[] } { |
| 4278 | const transcripts: { [agentId: string]: Message[] } = {} |
| 4279 | |
| 4280 | for (const task of Object.values(tasks)) { |
| 4281 | if ( |
| 4282 | task.type === 'in_process_teammate' && |
| 4283 | task.identity?.agentId && |
| 4284 | task.messages && |
| 4285 | task.messages.length > 0 |
| 4286 | ) { |
| 4287 | transcripts[task.identity.agentId] = task.messages |
| 4288 | } |
| 4289 | } |
| 4290 | |
| 4291 | return transcripts |
| 4292 | } |
| 4293 | |
| 4294 | /** |
| 4295 | * Load subagent transcripts for the given agent IDs |