import { type ParsedAppHomeOpened, type ParsedSlashCommand, type ParsedThreadStarted } from "../../slack-access.js"; import { type SlackIngressGuardSettings } from "../../helpers.js"; import { type ReactionCommandSettings } from "../../reaction-triggers.js"; import type { AdapterCapabilityRequest, AdapterCapabilityResult, InboundMessage, OutboundMessage, MessageAdapter } from "./types.js"; export { classifyMessage, extractAppHomeOpened, extractThreadStarted, parseMemberJoinedChannel, parseSocketFrame, RECONNECT_DELAY_MS, } from "../../slack-access.js"; export interface SlackAdapterConfig { botToken: string; appToken: string; allowedUsers?: string[]; allowAllWorkspaceUsers?: boolean; ingressGuard?: SlackIngressGuardSettings; suggestedPrompts?: { title: string; message: string; }[]; reactionCommands?: ReactionCommandSettings; /** Check whether a thread_ts belongs to a known thread in the broker DB. */ isKnownThread?: (threadTs: string) => boolean; /** Load durable thread metadata from the broker DB after cache eviction. */ getKnownThread?: (threadTs: string) => { channelId: string; context?: ParsedThreadStarted["context"] | null; } | null; /** Persist thread metadata in the broker DB without claiming ownership. */ rememberKnownThread?: (threadTs: string, channelId: string, context?: ParsedThreadStarted["context"] | null) => void; /** * Gate reaction-trigger handling after the reacted message thread is known. * Use this to require an already authorized/Pinet-owned thread before an * opt-in reaction command can enqueue work or mutate durable thread state. * * Reaction triggers are denied by default: when this callback is not * configured, opt-in reaction commands never route, even for threads the * adapter has merely seen/cached. Authorization must be explicit so that * reactions pass the same invoked/owned-thread admission bar as normal * Slack messages (#812). */ isReactionThreadAuthorized?: (threadTs: string, channelId: string) => boolean; /** Check whether a known Slack thread is Pinet-owned for mixed-participant mention gating. */ isPinetOwnedThread?: (threadTs: string, channelId: string) => boolean; /** Best-effort callback for Home tab opens. */ onAppHomeOpened?: (event: ParsedAppHomeOpened) => Promise | void; /** Best-effort callback for Slack slash commands handled by the broker process. */ onSlashCommand?: (event: ParsedSlashCommand) => Promise | string | null; } export declare const SLACK_THREAD_CACHE_MAX_SIZE = 5000; export declare const SLACK_THREAD_CACHE_TTL_MS: number; export declare const SLACK_PENDING_ATTENTION_MAX_THREADS = 1000; export declare const SLACK_PENDING_ATTENTION_TTL_MS: number; export declare const SLACK_PENDING_ATTENTION_MAX_MESSAGES_PER_THREAD = 50; export declare const SLACK_INGRESS_GUARD_THREAD_PARTICIPANT_LIMIT = 200; export declare class SlackAdapter implements MessageAdapter { readonly name = "slack"; private readonly config; private readonly allowlist; private slackRequests; private botUserId; private socketMode; private shuttingDown; private inboundHandler; private readonly reactionCommands; private readonly threads; private readonly userNames; private readonly processedSocketDeliveries; private readonly pendingEyes; private readonly threadStatuses; constructor(config: SlackAdapterConfig); private callSlack; connect(): Promise; disconnect(): Promise; onInbound(handler: (msg: InboundMessage) => void): void; invokeCapability(request: AdapterCapabilityRequest): Promise; send(msg: OutboundMessage): Promise; private buildSlackApiCapabilityEffects; getBotUserId(): string | null; getTrackedThreadIds(): Set; isConnected(): boolean; private resolveScopeForThread; private onThreadStarted; private onContextChanged; private sendSlashCommandResponse; private onSlashCommand; private onAppHomeOpened; private fetchMessageByTs; private onReactionAdded; private getCachedThread; private isReactionThreadAuthorized; private messageMentionsBot; private requiresMentionInChannel; private shouldRequireMentionForMixedParticipantThread; private isPinetOwnedThreadForIngressGuard; private fetchThreadParticipantUserIds; private shouldRequireExplicitMention; private onMessage; private emitInteractiveInbound; private onMemberJoined; private shouldSuppressLegacyThreadedDm; private getThread; private addReaction; private removeReaction; private resolveUser; private clearThreadStatus; private setSuggestedPrompts; }