| 4495 | * uses a random agentId for transcript storage. |
| 4496 | */ |
| 4497 | export function extractTeammateTranscriptsFromTasks(tasks: { |
| 4498 | [taskId: string]: { |
| 4499 | type: string |
| 4500 | identity?: { agentId: string } |
| 4501 | messages?: Message[] |
| 4502 | } |
| 4503 | }): { [agentId: string]: Message[] } { |
| 4504 | const transcripts: { [agentId: string]: Message[] } = {} |
| 4505 | |
| 4506 | for (const task of Object.values(tasks)) { |
| 4507 | if ( |
| 4508 | task.type === 'in_process_teammate' && |
| 4509 | task.identity?.agentId && |
| 4510 | task.messages && |
| 4511 | task.messages.length > 0 |
| 4512 | ) { |
| 4513 | transcripts[task.identity.agentId] = task.messages |
| 4514 | } |
| 4515 | } |
| 4516 | |
| 4517 | return transcripts |
| 4518 | } |
| 4519 | |
| 4520 | /** |
| 4521 | * Load subagent transcripts for the given agent IDs |