(messages: Message[])
| 3952 | * interval fires every ~10 tool calls instead of ~10 human turns. |
| 3953 | */ |
| 3954 | export function getVerifyPlanReminderTurnCount(messages: Message[]): number { |
| 3955 | let turnCount = 0 |
| 3956 | for (let i = messages.length - 1; i >= 0; i--) { |
| 3957 | const message = messages[i] |
| 3958 | if (message && isHumanTurn(message)) { |
| 3959 | turnCount++ |
| 3960 | } |
| 3961 | // Stop counting at plan_mode_exit attachment (marks when implementation started) |
| 3962 | if ( |
| 3963 | message?.type === 'attachment' && |
| 3964 | message.attachment!.type === 'plan_mode_exit' |
| 3965 | ) { |
| 3966 | return turnCount |
| 3967 | } |
| 3968 | } |
| 3969 | // No plan_mode_exit found |
| 3970 | return 0 |
| 3971 | } |
| 3972 | |
| 3973 | /** |
| 3974 | * Get verify plan reminder attachment if the model hasn't called VerifyPlanExecution yet. |
no test coverage detected