UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

20 lines • 923 B
import type { TokenUsageSnapshot } from "./types.ts"; export declare function emptyUsage(): TokenUsageSnapshot; export declare function collectAssistantUsage(messages: unknown[]): TokenUsageSnapshot; /** * Accumulates assistant token usage streamed during the current agent run so * goal accounting can checkpoint mid-turn (tool calls, commands, shutdown) * without waiting for `agent_end` and without double counting when it fires. */ export declare class TurnUsageTracker { private pending; private flushed; reset(): void; noteMessageEnd(message: unknown): void; takePending(): TokenUsageSnapshot; /** Drop usage streamed before a new accounting window opened mid-turn. */ discardPending(): void; /** Return the run's total usage minus what checkpoints already accounted. */ takeRemaining(agentRunMessages: unknown[]): TokenUsageSnapshot; } //# sourceMappingURL=turn-usage.d.ts.map