/** * What one turn spent upstream, summed over the streams a suspended turn is * made of. `costUsd` is Claude Code's own accounting; the API stores it on * the message. Credits for the spend are billed on the sandbox proxy from * the forwarded Anthropic response. */ export type LocalTurnUsage = { costUsd: number; totalTokens: number; inputTokens: number; outputTokens: number; cacheReadTokens: number; cacheWriteTokens: number; reasoningTokens: number; }; /** * Text and usage of a turn in progress, owned by the caller rather than by * `runPromptTurn`: a cancelled or failed turn still spent those tokens, and * they have to reach the API anyway. */ export type LocalTurnAccumulator = { chunks: string[]; usage: LocalTurnUsage; }; /** Exported for tests. */ export declare function createTurnAccumulator(): LocalTurnAccumulator; /** * Whether the turn got as far as Anthropic. `costUsd` and `totalTokens` are * reported independently by the harness, so either alone means it did. */ export declare function didReachAnthropic(usage: LocalTurnUsage): boolean; /** * Add one stream's `finish` totals to the turn. `totalUsage` is the AI SDK * shape; `costUsd` is what Claude Code reports for the same stream under * `harnessMetadata`, and is stored on the ingested message. */ export declare function addTurnUsage(usage: LocalTurnUsage, part: Record): void; /** * What Claude Code says the turn cost, off the `finish` part. * * Two keys, because the value is renamed on its way here: the bridge emits * `harnessMetadata`, and `HarnessAgent` republishes the same object as * `providerMetadata` on the parts this code actually reads. Looking only for * the bridge's name found nothing, so every local turn was ingested at a cost * of zero and priced into no credits at all. * * Exported for tests. */ export declare function readClaudeCodeCostUsd(part: Record): number | undefined; //# sourceMappingURL=usage.d.ts.map