import { SlackAdapter, type AgentResponder, type SlackAdapterLogger, type SlackAdapterMessages, type SlackAdapterStreamOptions, type SlackAttachmentOptions, type SlackEventHandlingResult, type SlackHomeTabOptions, type SlackRuntimeControls, type SlackRuntimeSlashCommands, type SlackPendingAsks, type SlackShortcutBinding } from "./adapter.js"; import type { SlackThreadContextOptions } from "./thread-context.js"; import { SlackSocketModeRunner, type SlackSocketModeRunnerBackoffOptions, type SlackSocketModeRunnerHeartbeatOptions, type SlackSocketModeRunnerLogger, type SlackWebSocketFactory } from "./socket-mode-runner.js"; import type { SlackChannelId, SlackUserId, SlackWebApi } from "./types.js"; export interface SlackAdapterStartLogger extends SlackAdapterLogger, SlackSocketModeRunnerLogger { } export interface SlackAdapterStartOptions { /** Slack bot token used for chat.postMessage and chat.update. */ readonly botToken: string; /** Slack app-level token with connections:write for Socket Mode. */ readonly appToken: string; /** Optional override for the Slack Web API base URL. */ readonly apiBaseUrl?: string; /** Optional fetch implementation forwarded to the default Slack client. */ readonly fetchImpl?: typeof fetch; /** Optional request timeout (ms) forwarded to the default Slack client. */ readonly requestTimeoutMs?: number; readonly allowedChannelIds?: readonly SlackChannelId[]; readonly allowAllChannels?: boolean; readonly botUserIds?: readonly SlackUserId[]; readonly mentionTextAliases?: readonly string[]; readonly stripMentionText?: boolean; readonly responder: AgentResponder; readonly stream?: SlackAdapterStreamOptions; readonly messages?: SlackAdapterMessages; readonly attachments?: SlackAttachmentOptions; /** Native model/effort choices exposed through message and slash-command Block Kit menus. */ readonly runtimeControls?: SlackRuntimeControls; /** * Exact registered runtime slash commands. Defaults to * `/-model` and `/-effort`. */ readonly runtimeSlashCommands?: SlackRuntimeSlashCommands; /** * Shortcut bindings (callback_id → prompt). When set, the Socket Mode runner * routes shortcut payloads to the adapter, which runs the bound prompt as a * proactive turn. Omitted/empty leaves interactivity ignored. */ readonly shortcuts?: readonly SlackShortcutBinding[]; /** * App Home tab configuration (persistent action buttons). When enabled, the * adapter publishes the tab on open and routes button clicks to their prompts. */ readonly homeTab?: SlackHomeTabOptions; /** * Resolve speaker names via `users.info` (`users:read`). Default `true` in the * adapter; a missing scope degrades to an unnamed speaker. */ readonly resolveUserNames?: boolean; readonly resolveChannelNames?: boolean; /** Best-effort thread/channel turn context. Enabled by default; needs a `*:history` scope. */ readonly threadContext?: SlackThreadContextOptions; readonly logger?: SlackAdapterStartLogger; /** Resolve an in-thread reply back to the conversation that produced the message it threads off. */ readonly resolvePostIndex?: (channelId: string, ts: string) => Promise; /** Record a posted message `(channel, ts) → conversationId` for later reply resolution. */ readonly recordPostedMessage?: (channelId: string, ts: string, conversationId: string) => void; readonly pendingAsks?: SlackPendingAsks; /** Reconnect backoff bounds (and jitter/stability/startup-grace/drain tuning) forwarded to the Socket Mode runner. */ readonly reconnect?: SlackSocketModeRunnerBackoffOptions; /** Heartbeat watchdog for detecting and recycling a silently dead socket. */ readonly heartbeat?: SlackSocketModeRunnerHeartbeatOptions; /** Observe every Socket Mode event handling result. */ readonly onEventResult?: (result: SlackEventHandlingResult) => void | Promise; /** * Called once when the connection drops into the reconnect/backoff loop * (degraded). Credential-like reason material is redacted, and callback * failures are isolated from reconnect recovery. Wire to the app's onDegraded. */ readonly onConnectionLost?: (reason: string) => void; /** * Called once a reconnect has stayed up for the stability window after a * prior loss (recovered). Callback failures are isolated from recovery. * Wire to onRecovered. */ readonly onConnectionRestored?: () => void; /** Injected RNG for backoff jitter; defaults to Math.random. Tests inject a deterministic value. */ readonly random?: () => number; /** * Injected Slack Web API factory. Defaults to constructing a real * {@link SlackWebApiClient}. Tests can supply a fake transport here. */ readonly createApi?: (input: SlackApiFactoryInput) => SlackWebApi; /** * Injected WebSocket factory forwarded to the Socket Mode runner. Tests can * supply a fake socket so the start path runs without a real connection. */ readonly webSocketFactory?: SlackWebSocketFactory; } export interface SlackApiFactoryInput { readonly botToken: string; readonly appToken: string; readonly apiBaseUrl?: string; readonly fetchImpl?: typeof fetch; readonly requestTimeoutMs?: number; } export interface SlackAdapterStartResult { /** The Slack Web API client driving the adapter and Socket Mode runner. */ readonly api: SlackWebApi; /** The constructed adapter, exposed for advanced inspection. */ readonly adapter: SlackAdapter; /** The Socket Mode runner driving the connection. */ readonly runner: SlackSocketModeRunner; /** Cleanly aborts the Socket Mode connection and awaits the runner loop. */ stop(): Promise; } export declare function startSlackAdapter(options: SlackAdapterStartOptions): Promise; //# sourceMappingURL=start.d.ts.map