/**
 * slack:// adapter — outbound via @slack/web-api (`chat.postMessage`),
 * inbound via @slack/socket-mode (`SocketModeClient`).
 *
 * URI scheme: `slack://<workspace>/<channel>` where both segments are
 * `[\w-]+`. The workspace segment is informational — Slack routes by
 * the bot token's workspace, not by URI — but we keep it in the URI so
 * users can spot the destination without resolving credentials.
 *
 * Dependencies: both Slack SDKs are OPTIONAL peerDependencies, loaded
 * lazily on `start()` / `send()`. Users who never configure a Slack
 * channel never install them.
 *
 * Critical SLA: Slack requires `ack()` within 3 seconds on every inbound
 * event. The runtime contract here is "ack first, work async": the
 * adapter wraps every event listener so `ack()` is called synchronously
 * before the user-supplied handler runs, and the handler is then
 * scheduled on the next microtask. This makes it impossible for a slow
 * handler to miss the SLA.
 *
 * Security: bot + app tokens are closed over by this function and
 * scrubbed from any error path that might surface them.
 */
import type { InboundChannelEvent } from '../../runtime/event.js';
import type { ChannelAdapter, InboundSubscription } from '../types.js';
export interface SlackAdapterOpts {
    /** Bot token (xoxb-...) for chat.postMessage and other web-api calls. */
    botToken: string;
    /** App-level token (xapp-...) for socket-mode connection. */
    appToken: string;
    /** Optional inbound event handler. Adapter acks BEFORE invoking. */
    onEvent?: (event: SlackInboundEvent) => void | Promise<void>;
    /** Workspace segment to embed in `InboundChannelEvent.channelUri` — Slack
     *  routes by token, not URI, but we keep the segment so audit logs +
     *  channel mapping read identifiably. Defaults to `'workspace'`. */
    workspace?: string;
}
export interface SlackInboundEvent {
    type: string;
    body: unknown;
}
export interface SlackAdapter extends ChannelAdapter {
    start(): Promise<void>;
    stop(): Promise<void>;
    /** Test/inspection hook — process a single inbound envelope as if it
     * arrived from Slack. ACKs synchronously, runs the user handler async. */
    handleInbound(envelope: SlackInboundEnvelope): Promise<void>;
    /**
     * AUTO.6 — attach an inbound handler that maps Slack `message` events
     * to a unified `InboundChannelEvent`. Auto-starts Socket Mode if not
     * already running. ACK still fires synchronously before any handler
     * runs (3s SLA).
     */
    subscribeInbound(handler: (event: InboundChannelEvent) => Promise<void>): Promise<InboundSubscription>;
}
export interface SlackInboundEnvelope {
    type: string;
    body: unknown;
    /** Slack SDK supplies this; the adapter MUST call it within 3s. */
    ack: () => Promise<void> | void;
}
export declare function slackAdapter(opts: SlackAdapterOpts): SlackAdapter;
//# sourceMappingURL=slack.d.ts.map