( agentId?: AgentId, )
| 1468 | * This ensures the plan is preserved after compaction. |
| 1469 | */ |
| 1470 | export function createPlanAttachmentIfNeeded( |
| 1471 | agentId?: AgentId, |
| 1472 | ): AttachmentMessage | null { |
| 1473 | const planContent = getPlan(agentId) |
| 1474 | |
| 1475 | if (!planContent) { |
| 1476 | return null |
| 1477 | } |
| 1478 | |
| 1479 | const planFilePath = getPlanFilePath(agentId) |
| 1480 | |
| 1481 | return createAttachmentMessage({ |
| 1482 | type: 'plan_file_reference', |
| 1483 | planFilePath, |
| 1484 | planContent, |
| 1485 | }) |
| 1486 | } |
| 1487 | |
| 1488 | /** |
| 1489 | * Creates an attachment for invoked skills to preserve their content across compaction. |
no test coverage detected