import { type LLMModelUsage } from '../../LLMService.typedefs'; import { type LLMAgentRoundSpec, type LLMAgentRoundWriter, type LLMAgentRoundStartedListener } from './agentRounds.typedefs'; /** * The per-round generation stream of a single agent run. * * A tool loop is a sequence of model rounds, and each of them is a generation * in its own right: the conversation as it stood when the request went out, and * what the model answered with. Providers put every provider call through * `run`, which is what guarantees a round that throws is traced exactly like a * round that succeeds, and that no round of the loop goes unrecorded. * * The recorder deliberately knows nothing about messages — the provider hands * over its own native array as the round's input. */ export declare class LLMAgentRounds { private readonly writeRound; private readonly onRoundStarted?; private didRecordRound; private runningUsage; private latestRoundUsage; constructor(writeRound: LLMAgentRoundWriter, onRoundStarted?: LLMAgentRoundStartedListener | undefined); /** * Whether any model round reached the tracer. A run that fails while still * preparing its first request has no transcript to show, and its caller falls * back to tracing the failure on its own. */ get hasRecordedRound(): boolean; /** * Everything the loop has been billed for so far, summed over the rounds that * completed. A run that is cancelled or that throws mid-loop still spent the * rounds it had already paid for, and this is the only place they survive: * the provider's own run total is assembled after the loop returns, which a * cancellation never reaches. */ get accumulatedUsage(): LLMModelUsage; /** * The most recent request the loop actually sent, unlike `accumulatedUsage`, * which sums every round's input. */ get lastRoundUsage(): LLMModelUsage; /** * Runs one provider call as a traced round. The provider's response is * returned untouched and its failure rethrown unchanged: tracing never alters * what the loop, or the caller, sees. */ run(round: LLMAgentRoundSpec): Promise; private notifyRoundStarted; private callProvider; private recordSafely; }