/** Modern DSH conversation node that keeps image artifacts outside Tool process folding. */ import type { ImageAttachmentRef } from '@deepseek-ai/dsh-attachment'; export declare const IMAGE_RESULT_NODE_KIND = "dsh-image-result"; export interface ImageResultPresentation { readonly attachment: ImageAttachmentRef; readonly prompt: string; readonly provider: string; readonly channel?: string; readonly model: string; readonly output: string; readonly savedTo?: string; /** Workflow seed reported by the ComfyUI provider, when available. */ readonly seed?: number; /** ComfyUI timing split, when the provider reported it. */ readonly queueMs?: number; readonly execMs?: number; readonly totalMs?: number; readonly queueAhead?: number; readonly comfyVersion?: string; /** Attachment ids of the edit sources when this image came from edit_image; used to rebuild canvas edit chains. */ readonly sourceAttachmentIds?: readonly string[]; } interface ImageResultState { /** Owning conversation turn; PTC (run_code) sub-call results carry no turn. */ readonly turn?: number; readonly results: readonly (ImageResultPresentation & { readonly seq: number; })[]; } interface EventLike { readonly type: string; readonly seq: number; readonly data: Record; } interface MatchLike { readonly event: EventLike; readonly location: unknown; } interface ContextLike { readonly key: string; readonly id: string; readonly matches: readonly MatchLike[]; readonly start?: MatchLike; readonly state?: State; } interface ConversationNodeDefinitionLike { readonly kind: string; readonly target: 'chat'; match(event: EventLike): { id: string; role: 'start' | 'update'; } | null; start(context: ContextLike, match: MatchLike, reader: unknown): State; update(context: ContextLike & { readonly state: State; }, match: MatchLike): State; buildViewNode(context: ContextLike): Record | null; } /** Default definition for the successful images from each Tool invocation. */ export declare const imageResultDefinition: ConversationNodeDefinitionLike; /** * Give each image Tool result its own Chat row at the event that produced it. * PTC (run_code) sub-calls already have their own stable sub-call identity. */ export declare function createImageResultDefinition(): ConversationNodeDefinitionLike; /** Parse the plugin-owned durable presentation metadata from a Tool result event. */ export declare function imageResultFromMeta(value: unknown): ImageResultPresentation | undefined; /** Parse all successful images from either a single or batch Tool result. */ export declare function imageResultsFromMeta(value: unknown): readonly ImageResultPresentation[]; /** * Parse a plugin image result from a tool/ptc-dispatch event (#38). PTC * run_code sub-calls carry neither a turn nor presentationMeta, so the result * is rebuilt from the dispatch payload itself: the image content block for the * attachment, arguments for the prompt (and edit source ids), and the tool's * fixed-format summary text for provider/model/output. Returns undefined for * anything that is not a successful image result from our own image tools. */ export declare function imageResultFromPtcDispatch(event: EventLike): ImageResultPresentation | undefined; /** Pair each rendered image with its own summary, including batches with failed items. */ export declare function imageResultsFromPtcDispatch(event: EventLike): readonly ImageResultPresentation[]; export {};