/** * Pure helpers for the notifications extension. * * Kept side-effect-free so the mapping logic (ask extraction, idle summary, * dedupe keys) is unit-testable without a live session or the native server. */ import { type RedactableAction } from "./config"; /** A pending ask derived from an `ask` tool call. */ export interface PendingAsk { /** Action id: `${toolCallId}:${questionId}`. */ id: string; /** Question text. */ question: string; /** Option labels (may be empty for free-text questions). */ options: string[]; } /** Truncate text to `max` chars, appending an ellipsis when cut. */ export declare function truncate(text: string, max?: number): string; /** Stable per-turn idle dedupe key so exactly one idle action fires per turn. */ export declare function idleDedupeKey(sessionId: string, turnIndex: number): string; /** * Extract pending asks from an `ask` tool call input. * * Defensive: tolerates partial/unknown shapes and always returns an array. */ export declare function asksFromAskInput(toolCallId: string, input: unknown): PendingAsk[]; /** Prepare an action JSON payload for remote notification delivery. */ export declare function notificationActionPayload(action: T, opts: { redact: boolean; }): RedactableAction; /** Extract a plain-text summary from an agent message's content, if any. */ export declare function summaryFromMessage(message: unknown, max?: number): string | undefined; /** * Extract an idle summary from an `agent_end` event's settled message list: the * last message that yields text (i.e. the final assistant message; tool-result * messages have no text and are skipped). * * `agent_end` fires exactly once when the agent loop settles to await the user, * so emitting idle from this — instead of per-`turn_end` — produces exactly one * idle notification per genuine idle, eliminating the multi-turn flood. */ export declare function summaryFromMessages(messages: unknown, max?: number): string | undefined; /** An agent-produced image extracted from a message's content. */ export interface ExtractedImage { source: string; mime: string; data: string; } /** * Extract agent-produced images (`{ type: "image", data, mimeType }` blocks) * from a message's content — e.g. computer-use/browser screenshots or tool * image outputs — for `image_attachment` delivery. */ export declare function imageAttachmentsFromMessage(message: unknown, source?: string): ExtractedImage[];