/** * M1 — session-log projection: DSH surface events → acp-kernel CoreMessage. * * The ARC kernel is message-array based; DSH is event-log based. This module * is the bridge in the direction the engine needs (projectEvent / * eventsToCoreMessages). The reverse direction (CoreMessage[] → session * appends) is the M5 region transaction's job. * Mirrors billion-context-pi's `projectMessage`/`entriesToCoreMessages` * against DSH event shapes (see V-verification: SurfaceEventType = * 'user/message' | 'assistant/message' | 'tool/result'). * @module billion-context-pi-dsh/messages */ import type { CoreMessage } from 'acp-kernel'; import type { SessionEvent } from '@deepseek-ai/dsh-session'; /** * Extract plain text from a DSH content block array or string. * * Recursive: a real DSH `tool-result` block is `{ type: 'tool-result', * toolCallId, content: ContentBlock[] }` — the inner `content` array holds * the actual `text` blocks, so a top-level-only walk would drop every tool * result from the projection (and with it the seq's ref assignment, breaking * compress boundary resolution). Nested arrays are flattened depth-first. */ export declare function extractText(content: unknown): string; /** * Project one surface message event into CoreMessage(s). * - user/message → user text (verbatim content) * - assistant/message → assistant text, or one CoreMessage per tool-call * - tool/result → tool result (toolName/toolCallId, role 'tool') * Non-surface events project to nothing. */ export declare function projectEvent(event: SessionEvent): CoreMessage[]; /** Project a session's message events into CoreMessage[] in log order. */ export declare function eventsToCoreMessages(events: readonly SessionEvent[]): CoreMessage[]; /** The surface-visible message events of a session, in model-visible order. */ export declare function surfaceEventsOf(session: import('@deepseek-ai/dsh-session').Session): SessionEvent[]; /** * ALL message-type events in log order — the visible surface PLUS everything * shadowed by compression. The ARC kernel deactivates any block whose consumed * message ids are absent from the array it is given (syncBlocks), and refuses * to anchor a block boundary that cannot find its messages, so T2/T3 * distillation requires the full log, not just the visible surface. */ export declare function allLogMessages(session: import('@deepseek-ai/dsh-session').Session): CoreMessage[]; /** Extract the model-facing text of any surface message event. */ export declare function extractEventText(event: SessionEvent): string;