import { J as JsonRecord } from '../stream-normalizer-DWvtmY6F.js';
export { M as MISSING_TOOL_TERMINAL_ERROR, a as MISSING_TOOL_TERMINAL_REASON, S as StreamEvent, b as asRecord, c as asString, d as attachmentPartKey, e as collapseRedundantTextParts, f as encodeEvent, g as finalizeAssistantParts, h as finalizePendingInteractionParts, i as getPartKey, m as mergePersistedPart, n as normalizePersistedPart, j as normalizeTime, k as normalizeToolEvent, r as resolveToolId, l as resolveToolName, t as terminalizeDanglingAssistantToolUpdates, o as terminalizeDanglingToolPart, p as terminalizeDanglingToolParts } from '../stream-normalizer-DWvtmY6F.js';
export { B as BufferedTurnEvent, a as BufferedTurnOptions, b as BufferedTurnTap, D as D1LikeForTurns, P as PumpBufferedTurnOptions, R as ReplayTurnEventsOptions, T as TURN_EVENTS_MIGRATION_SQL, c as TURN_STATUS_SCOPE_MIGRATION_SQL, d as TurnEventStore, e as TurnStatus, f as coalesceChatStreamEvents, g as coalesceDeltas, h as createBufferedTurnTap, i as createD1TurnEventStore, j as createMemoryTurnEventStore, p as pumpBufferedTurn, r as replayTurnEvents } from '../turn-buffer-C9mEgoop.js';
import '../contract-KfqJh_au.js';
import '@tangle-network/agent-interface';

interface PersistedChatMessageForTurn {
    id: string;
    role: 'user' | 'assistant' | 'system' | 'tool';
    content: string;
    parts: Array<Record<string, unknown>> | null;
}
interface ResolvedChatTurn {
    turnIndex: number;
    shouldInsertUserMessage: boolean;
    priorMessages: PersistedChatMessageForTurn[];
    userParts: JsonRecord[];
}
declare function normalizeClientTurnId(value: unknown): string | undefined;
declare function buildUserTextParts(text: string, turnId: string | undefined): JsonRecord[];
declare function messageHasTurnId(message: PersistedChatMessageForTurn, turnId: string): boolean;
declare function resolveChatTurn(input: {
    existingMessages: PersistedChatMessageForTurn[];
    userContent: string;
    turnId?: string;
}): ResolvedChatTurn;

export { JsonRecord, type PersistedChatMessageForTurn, type ResolvedChatTurn, buildUserTextParts, messageHasTurnId, normalizeClientTurnId, resolveChatTurn };
