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