import { type Guild, type ForumChannel, type TextChannel } from "discord.js"; import type { OutgoingMessage, PermissionRequest, NotificationMessage, AgentCommand, OpenACPCore, DisplayVerbosity, AdapterCapabilities, IRenderer, SettingsAPI } from "@openacp/plugin-sdk"; import { MessagingAdapter } from "@openacp/plugin-sdk"; import type { DiscordChannelConfig } from "./types.js"; import { type OutputMode } from "./activity.js"; export declare class DiscordAdapter extends MessagingAdapter { readonly name = "discord"; readonly renderer: IRenderer; readonly capabilities: AdapterCapabilities; readonly core: OpenACPCore; private client; private discordConfig; private settingsAPI; private sendQueue; private draftManager; private _outputModeResolver; private skillManager; private permissionHandler; private sessionTrackers; private guild; private forumChannel; private notificationChannel; private assistantSession; private assistantInitializing; private pendingAssistantSystemPrompt; private fileService; private _sessionContexts; private _configChangedHandler?; private _threadReadyHandler?; constructor(core: OpenACPCore, config: DiscordChannelConfig, settingsAPI: SettingsAPI | undefined); /** * Persists a plugin setting to disk and updates the in-memory config so * subsequent reads within the same session see the new value immediately. */ savePluginSetting(key: string, value: unknown): Promise; /** Returns the adapter-level output mode from plugin settings, or undefined if not set. */ get adapterOutputMode(): OutputMode | undefined; start(): Promise; stop(): Promise; private getCommandRegistry; private setupInteractionHandler; private renderCommandResponse; private setupMessageHandler; private setupAssistant; respawnAssistant(): Promise; private processIncomingAttachments; private getThread; private resolveMode; private getOrCreateTracker; /** Called from button router to switch mode and re-render the current tool card. */ updateSessionOutputMode(sessionId: string, mode: OutputMode): void; /** * Edit the control message to reflect current session state (bypass, voice mode). * No-op if the control message ID is unknown (session created before this fix). */ updateControlMessage(sessionId: string): Promise; private getSessionContext; sendMessage(sessionId: string, content: OutgoingMessage): Promise; protected handleThought(sessionId: string, content: OutgoingMessage, _verbosity: DisplayVerbosity): Promise; protected handleText(sessionId: string, content: OutgoingMessage): Promise; protected handleToolCall(sessionId: string, content: OutgoingMessage, _verbosity: DisplayVerbosity): Promise; protected handleToolUpdate(sessionId: string, content: OutgoingMessage, _verbosity: DisplayVerbosity): Promise; protected handlePlan(sessionId: string, content: OutgoingMessage, _verbosity: DisplayVerbosity): Promise; protected handleUsage(sessionId: string, content: OutgoingMessage, verbosity: DisplayVerbosity): Promise; protected handleSessionEnd(sessionId: string, _content: OutgoingMessage): Promise; protected handleConfigUpdate(sessionId: string, _content: OutgoingMessage): Promise; protected handleError(sessionId: string, content: OutgoingMessage): Promise; protected handleAttachment(sessionId: string, content: OutgoingMessage): Promise; protected handleSystem(sessionId: string, content: OutgoingMessage): Promise; sendPermissionRequest(sessionId: string, request: PermissionRequest): Promise; sendNotification(notification: NotificationMessage): Promise; createSessionThread(sessionId: string, name: string): Promise; renameSessionThread(sessionId: string, newName: string): Promise; deleteSessionThread(sessionId: string): Promise; sendSkillCommands(sessionId: string, commands: AgentCommand[]): Promise; cleanupSkillCommands(sessionId: string): Promise; getForumChannel(): ForumChannel | TextChannel; getGuild(): Guild; getGuildId(): string; getAssistantSessionId(): string | null; getAssistantThreadId(): string | null; /** * Persist the control message ID to the session record so it survives restart. * Called after sending the welcome/control message in new-session.ts. */ persistControlMsgId(sessionId: string, messageId: string): Promise; /** * Retrieve stored control message ID for a session (survives restart via session record). */ getControlMsgId(sessionId: string): string | undefined; }