import type { ModelMessage, ToolSet, TypedToolCall } from "ai";
import type { RuntimeActionRequest, RuntimeActionResult } from "#runtime/actions/types.js";
import type { HarnessEmitFn, HarnessSession, HarnessToolMap, SessionStateMap, StepInput } from "#harness/types.js";
/**
 * Serializable event coordinates for one pending runtime-action batch.
 *
 * Runtime action results are projected back onto the parent stream using the
 * same turn and step identity as the originating `actions.requested` batch.
 */
interface PendingRuntimeActionEventMetadata {
    readonly sequence: number;
    readonly stepIndex: number;
    readonly turnId: string;
}
/**
 * Serializable pending runtime-action batch stored on `session.state`.
 *
 * `childContinuationTokens` maps each `subagent-call` action's
 * `callId` to the deterministic child token minted by dispatch, so
 * the harness can clear proxy-input entries on result resolution
 * without re-deriving the token (keeps `harness/` runtime-agnostic).
 */
interface PendingRuntimeActionBatch {
    readonly actions: readonly RuntimeActionRequest[];
    readonly childContinuationTokens?: Readonly<Record<string, string>>;
    readonly event: PendingRuntimeActionEventMetadata;
    readonly responseMessages: readonly ModelMessage[];
}
/**
 * Outcome of resolving a pending runtime-action batch.
 */
interface ResolvePendingRuntimeActionsResult {
    readonly messages: ModelMessage[];
    readonly outcome: "continue" | "resolved" | "unresolved";
    readonly session: HarnessSession;
}
/** Returns the pending runtime-action batch stored on the session, if any. */
export declare function getPendingRuntimeActionBatch(state: SessionStateMap | undefined): PendingRuntimeActionBatch | undefined;
/**
 * Returns true when the session is parked on a pending runtime-action batch.
 */
export declare function hasPendingRuntimeActionBatch(state: SessionStateMap | undefined): boolean;
export declare function clearPendingRuntimeActionBatch(session: HarnessSession): HarnessSession;
/**
 * Stores one pending runtime-action batch on the session.
 */
export declare function setPendingRuntimeActionBatch(input: {
    readonly actions: readonly RuntimeActionRequest[];
    readonly event: PendingRuntimeActionEventMetadata;
    readonly responseMessages: readonly ModelMessage[];
    readonly session: HarnessSession;
}): HarnessSession;
/**
 * Records the child continuation token for a dispatched subagent-call
 * so {@link resolvePendingRuntimeActions} can clear proxy-input
 * entries when the child finishes.
 */
export declare function recordPendingSubagentChildToken(input: {
    readonly callId: string;
    readonly childContinuationToken: string;
    readonly session: HarnessSession;
}): HarnessSession;
/**
 * Discriminated item consumed by {@link accumulateRuntimeActionResults}
 * so the loop can process interleaved deliveries and results without
 * coupling to a concrete `HookPayload` shape.
 */
type RuntimeActionAccumulatorItem<TDeliver> = {
    readonly kind: "deliver";
    readonly value: TDeliver;
} | {
    readonly kind: "runtime-action-result";
    readonly results: readonly RuntimeActionResult[];
};
/**
 * Accumulates runtime-action results until every pending key has a
 * matching result. The caller passes the ordered key list so the
 * workflow runtime can drive the loop without hydrating a session.
 */
export declare function accumulateRuntimeActionResults<TDeliver>(input: {
    readonly bufferedDeliveries: TDeliver[];
    readonly getNext: () => Promise<RuntimeActionAccumulatorItem<TDeliver> | null>;
    readonly initialResults?: readonly RuntimeActionResult[];
    readonly pendingActionKeys: readonly string[] | undefined;
}): Promise<RuntimeActionResult[] | null>;
/**
 * Resolves one pending runtime-action batch back into model history.
 *
 * When all expected runtime action results are present, this appends the
 * stored assistant tool-call messages plus synthesized tool-result messages to
 * history, clears the pending batch, and emits `subagent.completed` and
 * `action.result` events back onto the parent stream.
 */
export declare function resolvePendingRuntimeActions(input: {
    readonly emit?: HarnessEmitFn;
    readonly session: HarnessSession;
    readonly stepInput?: StepInput;
}): Promise<ResolvePendingRuntimeActionsResult>;
/**
 * Projects one AI SDK tool call into the Eve runtime-action contract.
 */
export declare function createRuntimeActionRequestFromToolCall(input: {
    readonly toolCall: TypedToolCall<ToolSet>;
    readonly tools: HarnessToolMap;
}): RuntimeActionRequest;
export {};
