import type { ModelMessage } from 'ai'; import type { Session } from '../types/session.js'; import type { RunState } from './durable/types.js'; import type { RunStore } from './durable/RunStore.js'; /** Legacy compaction summaries were stored as the first model message with this prefix. */ export declare const COMPACTION_SUMMARY_PREFIX = "[Conversation summary \u2014 earlier turns were compacted]"; /** * Remove `role: 'system'` entries from a run's model message array. Legacy compaction * summaries and other framework notes are routed into the system-note channel so context * is preserved. Idempotent: already-clean state is not mutated. */ export declare function sanitizeRunStateMessages(runState: RunState): boolean; /** * A caller supplied a message array the runtime refuses. Carries a `name` tag rather than * relying on `instanceof`, which breaks when a consumer resolves two copies of core — the * same reason `FlowDriftError` is tagged. Transports map this to 400, not 500. */ export declare class InvalidCallerMessagesError extends Error { readonly name = "InvalidCallerMessagesError"; readonly field: 'seedMessages' | 'historyDelta'; readonly index: number; constructor(field: 'seedMessages' | 'historyDelta', index: number); } /** Caller-supplied message arrays must not seed system-role entries into the transcript. */ export declare function rejectSystemRoleInCallerMessages(messages: readonly ModelMessage[], context: 'seedMessages' | 'historyDelta'): void; /** * Strip legacy `role: 'system'` entries from a session transcript on read. * Text is dropped here — run state already routes it into system notes for * model calls, and mirroring it in the client transcript would duplicate context * if a consumer round-tripped messages back in. */ export declare function sanitizeSessionMessages(session: Pick): boolean; /** Load run state and strip legacy system-role messages in memory (no write). */ export declare function loadSanitizedRunState(runStore: RunStore, runId: string): Promise;