Graphorin API reference v0.4.0
Graphorin API reference / @graphorin/memory / / countMessageTokens
Function: countMessageTokens()
ts
function countMessageTokens(messages, counter): Promise<number>;Defined in: packages/memory/src/context-engine/token-counter.ts:72
Count tokens across a message list using a TokenCounter (or the heuristic fallback). Used by the trigger-evaluation hot path of the auto-compaction subsystem (RB-46) at the top of every step.
Parameters
| Parameter | Type |
|---|---|
messages | readonly Message[] |
counter | | ContextTokenCounter | TokenCounter |
Returns
Promise<number>