(messages: Message[])
| 63 | export function modelSupportsSoftSwitch(modelId: string): boolean { |
| 64 | return /qwen-?3/i.test(modelId); |
| 65 | } |
| 66 | |
| 67 | /** Count error results in the contiguous block of tool messages at the tail. |
| 68 | * QodeX tools conventionally prefix failures with "[ERROR]". Pure. */ |
| 69 | export function countTrailingToolErrors(messages: Message[]): number { |
| 70 | let n = 0; |
| 71 | for (let i = messages.length - 1; i >= 0; i--) { |
| 72 | const m = messages[i]!; |
| 73 | if (m.role !== 'tool') break; |
| 74 | const c = typeof m.content === 'string' ? m.content : ''; |
| 75 | if (/^\s*\[ERROR\]/i.test(c) || /^Error:/m.test(c.slice(0, 200))) n++; |
| 76 | } |
| 77 | return n; |
no outgoing calls
no test coverage detected