( context: ToolUseContext, )
| 1540 | * normally only injected on tool-use turns via getAttachmentMessages). |
| 1541 | */ |
| 1542 | export async function createPlanModeAttachmentIfNeeded( |
| 1543 | context: ToolUseContext, |
| 1544 | ): Promise<AttachmentMessage | null> { |
| 1545 | const appState = context.getAppState() |
| 1546 | if (appState.toolPermissionContext.mode !== 'plan') { |
| 1547 | return null |
| 1548 | } |
| 1549 | |
| 1550 | const planFilePath = getPlanFilePath(context.agentId) |
| 1551 | const planExists = getPlan(context.agentId) !== null |
| 1552 | |
| 1553 | return createAttachmentMessage({ |
| 1554 | type: 'plan_mode', |
| 1555 | reminderType: 'full', |
| 1556 | isSubAgent: !!context.agentId, |
| 1557 | planFilePath, |
| 1558 | planExists, |
| 1559 | }) |
| 1560 | } |
| 1561 | |
| 1562 | /** |
| 1563 | * Creates attachments for async agents so the model knows about them after |
no test coverage detected