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