eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
10 lines (9 loc) • 450 B
TypeScript
/**
* Rough token estimate: serialized JSON length / 4. Good enough for
* deciding whether compaction is needed; the real token count comes back
* from the model each step via `CompactionConfig.lastKnownInputTokens`.
*
* Accepts any JSON-serializable value so callers can apply the same heuristic
* to whole message arrays or individual content parts on one consistent ruler.
*/
export declare function estimateTokens(value: unknown): number;