* Get verify plan reminder attachment if the model hasn't called VerifyPlanExecution yet.
( messages: Message[] | undefined, toolUseContext: ToolUseContext, )
| 3892 | * Get verify plan reminder attachment if the model hasn't called VerifyPlanExecution yet. |
| 3893 | */ |
| 3894 | async function getVerifyPlanReminderAttachment( |
| 3895 | messages: Message[] | undefined, |
| 3896 | toolUseContext: ToolUseContext, |
| 3897 | ): Promise<Attachment[]> { |
| 3898 | if ( |
| 3899 | process.env.USER_TYPE !== 'ant' || |
| 3900 | !isEnvTruthy(process.env.CLAUDE_CODE_VERIFY_PLAN) |
| 3901 | ) { |
| 3902 | return [] |
| 3903 | } |
| 3904 | |
| 3905 | const appState = toolUseContext.getAppState() |
| 3906 | const pending = appState.pendingPlanVerification |
| 3907 | |
| 3908 | // Only remind if plan exists and verification not started or completed |
| 3909 | if ( |
| 3910 | !pending || |
| 3911 | pending.verificationStarted || |
| 3912 | pending.verificationCompleted |
| 3913 | ) { |
| 3914 | return [] |
| 3915 | } |
| 3916 | |
| 3917 | // Only remind every N turns |
| 3918 | if (messages && messages.length > 0) { |
| 3919 | const turnCount = getVerifyPlanReminderTurnCount(messages) |
| 3920 | if ( |
| 3921 | turnCount === 0 || |
| 3922 | turnCount % VERIFY_PLAN_REMINDER_CONFIG.TURNS_BETWEEN_REMINDERS !== 0 |
| 3923 | ) { |
| 3924 | return [] |
| 3925 | } |
| 3926 | } |
| 3927 | |
| 3928 | return [{ type: 'verify_plan_reminder' }] |
| 3929 | } |
| 3930 | |
| 3931 | export function getCompactionReminderAttachment( |
| 3932 | messages: Message[], |
no test coverage detected