(content: readonly ContentPart[])
| 650 | } |
| 651 | |
| 652 | function estimateContentTokens(content: readonly ContentPart[]): number { |
| 653 | let total = 0; |
| 654 | for (const p of content) { |
| 655 | if (p.type === 'text') total += estimateTokens(p.text); |
| 656 | else if (p.type === 'think') total += estimateTokens(p.think); |
| 657 | } |
| 658 | return total; |
| 659 | } |
| 660 | |
| 661 | /** True for messages that correspond to a real agent-core `_history` entry — |
| 662 | * i.e. `append_message` and `compaction_summary` (the summary IS in `_history`). |
no test coverage detected