/** * 内置 extension:在 turn_start / turn_end 和 compaction 相关事件时打印 context 用量与 compaction 信息, * 便于分析 token 占用。仅打 log,不改变行为。 * 若 agent-manager 在 session 创建后调用了 setTokenUsageInitialStats,则每轮会打印 systemPrompt/skills/tools/conversation 的估算占比。 */ import type { ExtensionFactory } from "@mariozechner/pi-coding-agent"; export interface TokenUsageInitialStats { systemPromptEstTokens: number; skillsBlockEstTokens: number; toolsDefsEstTokens: number; } /** 由 agent-manager 在 session 创建并算完 systemPrompt/skills/tools 后调用,供本 extension 在 turn 时打印占比 */ export declare function setTokenUsageInitialStats(compositeKey: string, stats: TokenUsageInitialStats): void; export declare function createTokenUsageLogExtensionFactory(compositeKey: string): ExtensionFactory;