/** * Deriving one surface node's bounded view from its committed event. Every * string here is cut before it is joined, so a node carrying megabytes of tool * output or a base64 image reference costs at most the configured excerpt. * * @module dsh-context-snapshot-bar/projection/node */ import type { SessionEvent } from '@deepseek-ai/dsh-session/types'; import type { ContentBlock } from '@deepseek-ai/dsh-llm'; import type { NodeView, SectionView, ToolCallView, ToolCallId } from '../shared/types.ts'; import type { Config } from '../shared/config.ts'; /** The unified runtime-context producer this plugin recognises. */ export declare const SNAPSHOT_PRODUCER = "@deepseek-ai/dsh-system-prompt"; /** Body of the producer's clearing message, which means no snapshot is retained. */ export declare const SNAPSHOT_CLEARED_BODY = "Current runtime context: none. Earlier runtime-context snapshots no longer apply."; /** The turn and step a committed event belongs to when the event carries neither. */ export interface OwningBoundary { /** The turn open when the event committed, or null between turns. */ readonly turn: number | null; /** The step open when the event committed, or null outside a step. */ readonly step: number | null; } /** * Build the node view for one committed message-bearing event. * * A `user/message` carries no turn of its own — only the loop's boundary events * do — so it takes the turn that was open when it committed. Without that a * human prompt belongs to no turn at all and reads as a session-level anchor. * The system prompt keeps its null boundary: it is a session anchor, not a * turn's content, even when a later one is rendered mid-turn. * * @param event - the committed surface event. * @param config - the resolved plugin configuration. * @param toolCalls - invocations this node requested, already bounded. * @param owning - the turn and step open at commit time, for events that carry neither. * @returns the bounded node view. */ export declare function nodeFromEvent(event: SessionEvent, config: Config, toolCalls: readonly ToolCallView[], owning?: OwningBoundary): NodeView; /** * Bound one tool invocation for display. * @param callId - the provider-issued call identity. * @param name - the tool name. * @param args - the raw argument JSON string. * @param config - the resolved plugin configuration. * @returns the bounded invocation view. */ export declare function toolCallView(callId: ToolCallId, name: string, args: string, config: Config): ToolCallView; /** * Read the runtime-context snapshot a message records, if it records one. * * A normal snapshot must match the producer, the `snapshot` form, and carry * sections; the clearing message must match the producer and its exact body. * Any other plugin injection is an ordinary trajectory node. * * @param source - the message's source fields. * @param body - the message's assembled text. * @returns the snapshot's sections, `'cleared'`, or null for an ordinary message. */ export declare function snapshotOf(source: { kind: string; plugin?: string; form?: string; sections?: readonly { name: string; text: string; }[]; }, body: string): { sections: readonly SectionView[]; } | 'cleared' | null; /** * Assemble the full text of a message for the snapshot clear-body comparison. * @param blocks - the message content blocks, in order. * @returns every text block joined, without an excerpt limit. */ export declare function fullTextOf(blocks: readonly ContentBlock[]): string; /** * Whether a message-bearing event carries text content worth excerpting. * @param blocks - the message content blocks. * @returns true when the message has at least one block. */ export declare function hasContent(blocks: readonly ContentBlock[]): boolean; //# sourceMappingURL=node.d.ts.map