export interface SlackSlashCommand {
    type: 'slash_command';
    command: string;
    text: string;
    userId: string;
    userName: string;
    channelId: string;
    channelName: string;
    teamId: string;
    responseUrl: string;
}
export interface SlackInteraction {
    type: 'interaction';
    interactionType: string;
    payload: Record<string, unknown>;
    userId: string;
    channelId: string;
    responseUrl?: string | undefined;
}
export interface SlackEventCallback {
    type: 'event_callback';
    eventType: string;
    text: string;
    userId: string;
    channelId: string;
    teamId: string;
    threadTs?: string | undefined;
    eventTs?: string | undefined;
    raw: Record<string, unknown>;
}
export type SlackEvent = SlackSlashCommand | SlackInteraction | SlackEventCallback;
export interface SlackOAuthAuthorizeOptions {
    readonly clientId: string;
    readonly redirectUri?: string | undefined;
    readonly scopes?: readonly string[] | undefined;
    readonly userScopes?: readonly string[] | undefined;
    readonly state?: string | undefined;
    readonly teamId?: string | undefined;
}
export interface SlackOAuthExchangeOptions {
    readonly clientId: string;
    readonly clientSecret: string;
    readonly code: string;
    readonly redirectUri?: string | undefined;
}
export interface SlackOAuthExchangeResult {
    readonly ok: boolean;
    readonly access_token?: string | undefined;
    readonly bot_user_id?: string | undefined;
    readonly app_id?: string | undefined;
    readonly team?: {
        readonly id?: string;
        readonly name?: string;
    };
    readonly authed_user?: Record<string, unknown> | undefined;
    readonly error?: string | undefined;
    readonly [key: string]: unknown;
}
export interface SlackAuthTestResult {
    readonly ok: boolean;
    readonly url?: string | undefined;
    readonly team?: string | undefined;
    readonly user?: string | undefined;
    readonly team_id?: string | undefined;
    readonly user_id?: string | undefined;
    readonly bot_id?: string | undefined;
    readonly error?: string | undefined;
    readonly [key: string]: unknown;
}
export interface SlackSocketModeConnection {
    readonly ok: boolean;
    readonly url?: string | undefined;
    readonly error?: string | undefined;
    readonly [key: string]: unknown;
}
export interface SlackConversationRecord {
    readonly id: string;
    readonly name?: string | undefined;
    readonly is_channel?: boolean | undefined;
    readonly is_group?: boolean | undefined;
    readonly is_im?: boolean | undefined;
    readonly is_mpim?: boolean | undefined;
    readonly is_archived?: boolean | undefined;
    readonly num_members?: number | undefined;
    readonly [key: string]: unknown;
}
export interface SlackUserRecord {
    readonly id: string;
    readonly name?: string | undefined;
    readonly real_name?: string | undefined;
    readonly is_bot?: boolean | undefined;
    readonly deleted?: boolean | undefined;
    readonly profile?: Record<string, unknown> | undefined;
    readonly [key: string]: unknown;
}
export interface SlackCursorPage<T> {
    readonly ok: boolean;
    readonly entries: readonly T[];
    readonly nextCursor: string;
    readonly error?: string | undefined;
}
export interface SlackSocketModeEnvelope {
    readonly envelope_id?: string | undefined;
    readonly type?: string | undefined;
    readonly accepts_response_payload?: boolean | undefined;
    readonly payload?: Record<string, unknown> | undefined;
    readonly [key: string]: unknown;
}
export interface SlackSocketModeClientOptions {
    readonly appToken: string;
    readonly integration: SlackIntegration;
    readonly onEnvelope: (envelope: SlackSocketModeEnvelope, client: SlackSocketModeClient) => void | Promise<void>;
    readonly WebSocketImpl?: typeof WebSocket | undefined;
}
/**
 * SlackIntegration — handles inbound webhook verification/parsing and outbound
 * message posting for Slack slash commands and interactions.
 *
 * Env vars:
 *   SLACK_WEBHOOK_URL      — incoming webhook URL for outbound posting
 *   SLACK_BOT_TOKEN        — Bot User OAuth token (xoxb-…) for API calls
 *   SLACK_SIGNING_SECRET   — used to verify X-Slack-Signature on inbound
 */
export declare class SlackIntegration {
    private webhookUrl?;
    private botToken?;
    constructor(webhookUrl?: string | undefined, botToken?: string | undefined);
    static buildOAuthAuthorizeUrl(options: SlackOAuthAuthorizeOptions): string;
    authTest(token?: string | undefined): Promise<SlackAuthTestResult>;
    appsConnectionsOpen(appToken: string): Promise<SlackSocketModeConnection>;
    exchangeOAuthCode(options: SlackOAuthExchangeOptions): Promise<SlackOAuthExchangeResult>;
    listConversations(options?: {
        readonly token?: string | undefined;
        readonly cursor?: string | undefined;
        readonly limit?: number | undefined;
        readonly types?: readonly string[] | undefined;
        readonly excludeArchived?: boolean | undefined;
        readonly teamId?: string | undefined;
    }): Promise<SlackCursorPage<SlackConversationRecord>>;
    listUsers(options?: {
        readonly token?: string | undefined;
        readonly cursor?: string | undefined;
        readonly limit?: number | undefined;
        readonly teamId?: string | undefined;
    }): Promise<SlackCursorPage<SlackUserRecord>>;
    /**
     * Verify an inbound Slack request using HMAC-SHA256.
     * Slack signs requests with: v0={HMAC-SHA256("v0:{timestamp}:{body}")}
     */
    verifySignature(body: string, timestamp: string, signature: string, signingSecret: string): boolean;
    /**
     * Parse an inbound Slack payload into a typed SlackEvent.
     * Supports slash commands (application/x-www-form-urlencoded) and
     * interaction payloads (JSON-encoded in a "payload" field).
     */
    parseEvent(body: Record<string, unknown>): SlackEvent;
    private callApi;
    /**
     * Post a message to a channel using the Slack Web API (chat.postMessage).
     * Requires SLACK_BOT_TOKEN.
     */
    postMessage(channel: string, text: string, blocks?: unknown[]): Promise<void>;
    /**
     * Post a message via an Incoming Webhook URL.
     * Requires SLACK_WEBHOOK_URL or a URL passed at call time.
     */
    postWebhook(text: string, blocks?: unknown[], url?: string): Promise<void>;
    /**
     * Format an agent result as Slack Block Kit blocks.
     */
    formatAgentResult(agentId: string, task: string, result: string): unknown[];
    /**
     * Format a session summary as Slack Block Kit blocks.
     */
    formatSessionSummary(sessionId: string, messageCount: number, tokensUsed: number): unknown[];
}
export declare class SlackSocketModeClient {
    private readonly options;
    private socket;
    private started;
    private readonly WebSocketImpl;
    constructor(options: SlackSocketModeClientOptions);
    start(): Promise<SlackSocketModeConnection>;
    stop(): void;
    ack(envelopeId: string, payload?: Record<string, unknown>): void;
    send(payload: Record<string, unknown>): void;
    get isStarted(): boolean;
    private handleMessage;
}
//# sourceMappingURL=slack.d.ts.map