(messages: Message[])
| 3870 | * interval fires every ~10 tool calls instead of ~10 human turns. |
| 3871 | */ |
| 3872 | export function getVerifyPlanReminderTurnCount(messages: Message[]): number { |
| 3873 | let turnCount = 0 |
| 3874 | for (let i = messages.length - 1; i >= 0; i--) { |
| 3875 | const message = messages[i] |
| 3876 | if (message && isHumanTurn(message)) { |
| 3877 | turnCount++ |
| 3878 | } |
| 3879 | // Stop counting at plan_mode_exit attachment (marks when implementation started) |
| 3880 | if ( |
| 3881 | message?.type === 'attachment' && |
| 3882 | message.attachment.type === 'plan_mode_exit' |
| 3883 | ) { |
| 3884 | return turnCount |
| 3885 | } |
| 3886 | } |
| 3887 | // No plan_mode_exit found |
| 3888 | return 0 |
| 3889 | } |
| 3890 | |
| 3891 | /** |
| 3892 | * Get verify plan reminder attachment if the model hasn't called VerifyPlanExecution yet. |
no test coverage detected