( attachment: Attachment, )
| 3451 | } |
| 3452 | |
| 3453 | export function normalizeAttachmentForAPI( |
| 3454 | attachment: Attachment, |
| 3455 | ): UserMessage[] { |
| 3456 | if (isAgentSwarmsEnabled()) { |
| 3457 | if (attachment.type === 'teammate_mailbox') { |
| 3458 | return [ |
| 3459 | createUserMessage({ |
| 3460 | content: getTeammateMailbox().formatTeammateMessages( |
| 3461 | attachment.messages, |
| 3462 | ), |
| 3463 | isMeta: true, |
| 3464 | }), |
| 3465 | ] |
| 3466 | } |
| 3467 | if (attachment.type === 'team_context') { |
| 3468 | return [ |
| 3469 | createUserMessage({ |
| 3470 | content: `<system-reminder> |
| 3471 | # Team Coordination |
| 3472 | |
| 3473 | You are a teammate in team "${attachment.teamName}". |
| 3474 | |
| 3475 | **Your Identity:** |
| 3476 | - Name: ${attachment.agentName} |
| 3477 | |
| 3478 | **Team Resources:** |
| 3479 | - Team config: ${attachment.teamConfigPath} |
| 3480 | - Task list: ${attachment.taskListPath} |
| 3481 | |
| 3482 | **Team Leader:** The team lead's name is "team-lead". Send updates and completion notifications to them. |
| 3483 | |
| 3484 | Read the team config to discover your teammates' names. Check the task list periodically. Create new tasks when work should be divided. Mark tasks resolved when complete. |
| 3485 | |
| 3486 | **IMPORTANT:** Always refer to teammates by their NAME (e.g., "team-lead", "analyzer", "researcher"), never by UUID. When messaging, use the name directly: |
| 3487 | |
| 3488 | \`\`\`json |
| 3489 | { |
| 3490 | "to": "team-lead", |
| 3491 | "message": "Your message here", |
| 3492 | "summary": "Brief 5-10 word preview" |
| 3493 | } |
| 3494 | \`\`\` |
| 3495 | </system-reminder>`, |
| 3496 | isMeta: true, |
| 3497 | }), |
| 3498 | ] |
| 3499 | } |
| 3500 | } |
| 3501 | |
| 3502 | |
| 3503 | // skill_discovery handled here (not in the switch) so the 'skill_discovery' |
| 3504 | // string literal lives inside a feature()-guarded block. A case label can't |
| 3505 | // be gated, but this pattern can — same approach as teammate_mailbox above. |
| 3506 | if (feature('EXPERIMENTAL_SKILL_SEARCH')) { |
| 3507 | if (attachment.type === 'skill_discovery') { |
| 3508 | if (attachment.skills.length === 0) return [] |
| 3509 | const lines = attachment.skills.map(s => `- ${s.name}: ${s.description}`) |
| 3510 | return wrapMessagesInSystemReminder([ |
no test coverage detected