import type { LanguageModelUsage, StepTripwireData } from '../../../../stream/types.js';
import type { DurableAgenticExecutionOutput, RunRegistryEntry } from '../../types.js';
import type { AccumulatedUsage, BaseIterationState } from './schemas.js';
interface SpanClocks {
    completionStartTime?: Date | string;
    timeToFirstTokenMs?: number;
}
/**
 * The first-chunk clocks for spans rebuilt from a run-start snapshot. A
 * resumed segment keeps them on the run registry beside its fresh spans; the
 * originals keep them in the loop state. Undefined when none was captured yet.
 */
export declare function carriedSpanClocks(registry: Pick<RunRegistryEntry, 'resumeModelSpanData' | 'resumeCompletionStartTime' | 'resumeTimeToFirstTokenMs'> | undefined, state: SpanClocks): {
    completionStartTime?: Date;
    timeToFirstTokenMs?: number;
} | undefined;
/**
 * Input for creating iteration state update
 */
export interface IterationStateUpdateInput {
    /** Current iteration state */
    currentState: BaseIterationState;
    /** Output from the current iteration's execution */
    executionOutput: DurableAgenticExecutionOutput;
}
/**
 * Step record for tracking iteration history.
 *
 * Main accumulates full `DefaultStepResult` objects; durable serializes this
 * reduced record across step boundaries instead. `content` is the step's model
 * content, the same value stopWhen and `stream.steps` see. It is absent on
 * records written before it was added, where `buildDurableStepContent`
 * rebuilds it from `text`/`toolCalls`/`toolResults`. Other fields of
 * `DefaultStepResult` (`response`, etc.) are still not carried.
 */
export interface StepRecord {
    text?: string;
    content?: unknown[];
    toolCalls?: unknown[];
    toolResults?: unknown[];
    usage?: LanguageModelUsage;
    finishReason?: string;
    tripwire?: StepTripwireData;
}
/**
 * Calculate accumulated usage from current state and new execution output.
 */
export declare function calculateAccumulatedUsage(currentUsage: AccumulatedUsage, executionUsage?: {
    inputTokens?: number;
    outputTokens?: number;
    totalTokens?: number;
    cachedInputTokens?: number;
    cacheCreationInputTokens?: number;
    reasoningTokens?: number;
}): AccumulatedUsage;
/**
 * Build a step record from execution output.
 */
export declare function buildStepRecord(executionOutput: DurableAgenticExecutionOutput): StepRecord;
/**
 * Create the base iteration state update.
 *
 * This returns the common fields for iteration state updates.
 * Implementations can extend this with their specific fields.
 *
 * @example
 * ```typescript
 * const baseUpdate = createBaseIterationStateUpdate({
 *   currentState: initData,
 *   executionOutput,
 * });
 *
 * // Core extends with modelList
 * const coreState = { ...baseUpdate, modelList: initData.modelList };
 *
 * // Inngest extends with observability
 * const inngestState = {
 *   ...baseUpdate,
 *   agentSpanData: initData.agentSpanData,
 *   modelSpanData: initData.modelSpanData,
 *   stepIndex: initData.stepIndex + 1,
 * };
 * ```
 */
export declare function createBaseIterationStateUpdate(input: IterationStateUpdateInput): BaseIterationState & Required<Pick<BaseIterationState, 'accumulatedSteps'>>;
export {};
//# sourceMappingURL=iteration-state.d.ts.map