import type { TextChannel, ThreadChannel } from "discord.js"; import { type OutputMode, type ToolDisplaySpec, type ToolCardSnapshot, type PlanEntry } from "./formatting.js"; export type { OutputMode, ToolDisplaySpec, ToolCardSnapshot, PlanEntry }; export interface ToolCallMeta { id: string; name: string; kind?: string; status?: string; content?: unknown; rawInput?: unknown; viewerLinks?: ViewerLinks; viewerFilePath?: string; displaySummary?: string; displayTitle?: string; displayKind?: string; } export interface ViewerLinks { file?: string; diff?: string; } export interface TunnelServiceInterface { getPublicUrl(): string | null; outputUrl(id: string): string; getStore(): { storeOutput(sessionId: string, label: string, content: string): string | null; }; } /** Minimal SendQueue interface — the real one comes from @openacp/plugin-sdk */ export interface SendQueue { enqueue(fn: () => Promise, opts?: { type?: string; }): Promise; } export interface ToolEntry { id: string; name: string; kind: string; rawInput: unknown; content: string | null; status: string; viewerLinks?: ViewerLinks; diffStats?: { added: number; removed: number; }; displaySummary?: string; displayTitle?: string; displayKind?: string; isNoise: boolean; } /** * Manages the transient "💭 Thinking..." message shown while the agent is reasoning. * * Sends a message on `show()`, periodically edits it with elapsed time, and * dismisses it (leaving the message in chat) when text output begins. Leaving * the message avoids an extra API delete call; the indicator is just no longer updated. */ export declare class ThinkingIndicator { private channel; private sendQueue; private msg?; private sending; private dismissed; private refreshTimer?; private showTime; constructor(channel: TextChannel | ThreadChannel, sendQueue: SendQueue); show(): Promise; /** * Edit the indicator to append a viewer link for thinking content, then dismiss. * Used in high output mode when a tunnel is available. */ finalizeWithViewerLink(url: string): Promise; /** Dismiss indicator: stops refresh timer. Message stays in chat to reduce API calls. */ dismiss(): Promise; /** Reset for a new prompt cycle. */ reset(): void; private startRefreshTimer; private stopRefreshTimer; } export declare class ToolStateMap { private entries; private pendingUpdates; upsert(meta: ToolCallMeta, kind: string, rawInput: unknown): ToolEntry; merge(id: string, status: string, rawInput?: unknown, content?: string | null, viewerLinks?: ViewerLinks, diffStats?: { added: number; removed: number; }): ToolEntry | undefined; get(id: string): ToolEntry | undefined; forEach(cb: (entry: ToolEntry) => void): void; clear(): void; } export declare class ThoughtBuffer { private chunks; private sealed; append(chunk: string): void; seal(): string; getText(): string; isSealed(): boolean; reset(): void; } export declare class DisplaySpecBuilder { private tunnelService?; constructor(tunnelService?: TunnelServiceInterface | undefined); buildToolSpec(entry: ToolEntry, mode: OutputMode, sessionContext?: { id: string; workingDirectory: string; }): ToolDisplaySpec; } interface ToolCardStateConfig { onFlush: (snapshot: ToolCardSnapshot) => void; } export declare class ToolCardState { private specs; private planEntries?; private finalized; private isFirstFlush; private debounceTimer?; private onFlush; constructor(config: ToolCardStateConfig); updateFromSpec(spec: ToolDisplaySpec): void; updatePlan(entries: PlanEntry[]): void; finalize(): void; destroy(): void; hasContent(): boolean; private snapshot; private flush; private scheduleFlush; private clearDebounce; } export declare class ActivityTracker { private _outputMode; private sessionId; private channel; private sendQueue; private tunnelService?; private sessionContext?; private toolStateMap; private previousToolStateMap?; private specBuilder; private toolCard?; private previousToolCard?; private thoughtBuffer; private toolCardMsg?; private previousToolCardMsg?; private _currentPlanEntries?; private _prevThoughtViewerLink?; private thinkingIndicator; private typingDismissed; private typingRefreshTimer?; private flushPromise; private previousFlushPromise; private _currentCardRef?; constructor(channel: TextChannel | ThreadChannel, sendQueue: SendQueue, outputMode?: OutputMode, sessionId?: string, tunnelService?: TunnelServiceInterface, sessionContext?: { id: string; workingDirectory: string; }); setOutputMode(mode: OutputMode): void; /** Re-render the current tool card with the current outputMode. * Called when the user switches output mode mid-prompt via action row buttons. */ rerender(): void; onNewPrompt(): Promise; onThought(text: string): Promise; onTextStart(): Promise; onToolCall(meta: ToolCallMeta, kind: string, rawInput: unknown): Promise; onToolUpdate(id: string, status: string, viewerLinks?: ViewerLinks, content?: string | null, rawInput?: unknown, diffStats?: { added: number; removed: number; }): Promise; onPlan(entries: PlanEntry[]): Promise; cleanup(): Promise; destroy(): void; private ensureToolCard; private sealToolCard; private flushToolCard; private startTyping; private stopTyping; private stopTypingTimer; }