import { type XopcTranscriptContextEntry, type XopcTranscriptSideChatOriginEntry } from './session-context-for-llm.js'; import type { TranscriptSourceEntry } from '../storage/sqlite/transcript-repository.js'; export declare const DEFAULT_HANDOFF_TOKEN_CAP = 16000; export declare const DEFAULT_HANDOFF_CHAR_CAP = 64000; export declare const MAX_SINGLE_HANDOFF_ENTRY_CHARS = 8000; export declare const MAX_OMITTED_HANDOFF_ENTRY_IDS = 20; export declare const SESSION_HANDOFF_CONTEXT_TYPE: "session_handoff"; export interface PortableHandoffItem { entryId: string; role: 'user' | 'assistant' | 'summary'; text: string; estimatedTokens: number; truncated: boolean; isBoundaryAnchor?: boolean; } export interface BuildPortableSessionHandoffInput { sourceConversationId: string; sourceTranscriptId: string; sourceSessionName?: string; sourceAgentId: string; sourceAgentName?: string; targetConversationId: string; targetAgentId: string; targetAgentName?: string; entries: ReadonlyArray; throughTurnId?: string; maxTokens?: number; maxChars?: number; createdAt?: string; } export interface PortableSessionHandoffStats { totalCandidateCount: number; selectedCount: number; omittedCount: number; omittedEntryIds: string[]; estimatedTokens: number; contentHash: string; contextPreview?: string; } export interface PortableSessionHandoffResult { originEntry: XopcTranscriptSideChatOriginEntry; externalPromptBlock: string; incomingContextEntry: XopcTranscriptContextEntry; outgoingContextEntry: XopcTranscriptContextEntry; stats: PortableSessionHandoffStats; } /** * Extract portable, provider-neutral items from active transcript entries. * Strips raw foreign toolCall/toolResult blocks so heterogeneous models/runtimes never fail schema validation. */ export declare function extractPortableHandoffItems(entries: ReadonlyArray, options?: { throughTurnId?: string; }): PortableHandoffItem[]; /** * Intact message selection within token/character budget: * 1. Latest user turn * 2. Latest assistant turn * 3. Original first user turn * 4. Compaction / prior handoff summary anchor (if any) * 5. Remaining turns from newest to oldest */ export declare function selectPortableHandoffItems(items: ReadonlyArray, options?: { maxTokens?: number; maxChars?: number; }): { selected: PortableHandoffItem[]; omittedCount: number; omittedEntryIds: string[]; estimatedTokens: number; }; export declare function renderPortableHandoffPrompt(params: { sourceConversationId: string; sourceSessionName?: string; sourceAgentId: string; sourceAgentName?: string; targetAgentId: string; targetAgentName?: string; selected: ReadonlyArray; omittedCount: number; omittedEntryIds: ReadonlyArray; }): string; export declare function buildPortableSessionHandoff(input: BuildPortableSessionHandoffInput): PortableSessionHandoffResult | null;