/** * Streaming Callback Manager * * Coordinates callbacks between ClaudeClient and Discord gateway. * Manages placeholder message creation, text accumulation, and error handling. */ import type { Message } from 'discord.js'; import type { PromptFinalResponse } from './types.js'; /** * Interface for Discord gateway operations */ export interface DiscordGatewayInterface { /** * Edit a message with throttling to prevent rate limits * @param message Discord message to edit * @param content New message content */ editMessageThrottled(message: Message, content: string): Promise; } /** * Manages streaming callbacks and coordinates with Discord gateway * * Responsibilities: * - Create placeholder message before streaming starts * - Accumulate text deltas and update Discord message * - Track tool use events * - Handle errors and update placeholder with error message * - Clean up references after streaming completes */ export declare class StreamingCallbackManager { private discordGateway; private originalMessage; private placeholderMessage; private accumulatedText; /** * Create a new streaming callback manager * @param discordGateway Discord gateway for message operations * @param originalMessage Original message to reply to */ constructor(discordGateway: DiscordGatewayInterface, originalMessage: Message); /** * Create a placeholder message to be updated with streaming content * @throws Error if message creation fails */ createPlaceholder(): Promise; /** * Handle text delta from streaming response * Accumulates text and updates Discord message * @param text Text delta to add */ onDelta(text: string): Promise; /** * Handle tool use event * @param name Tool name * @param _input Tool input */ onToolUse(name: string, _input: unknown): void; /** * Handle final response from streaming * @param _response Final Claude response */ onFinal(_response: PromptFinalResponse): Promise; /** * Handle error during streaming * Updates placeholder message with error information * @param error Error that occurred */ onError(error: Error): Promise; /** * Clean up resources and clear references * Should be called after streaming completes */ cleanup(): Promise; /** * Get the current placeholder message * @returns Placeholder message or null if not created */ getPlaceholderMessage(): Message | null; /** * Get the accumulated text so far * @returns Accumulated text content */ getAccumulatedText(): string; } //# sourceMappingURL=streaming-callback-manager.d.ts.map