/** * Slack {@link Connector} — wraps the @slack/bolt Socket Mode adapter that * used to live in src/slack/serve.ts. Pure handler logic (handler.ts) and * config loader (config.ts) are reused unchanged. * * Lifecycle: * start() → instantiate Bolt App, auth.test for botUserId, subscribe to * app.message (DMs) + app.event("app_mention"), then app.start(). * If anything throws, state.error is recorded and status reports * not ready — the gateway runtime treats it as a failed start. * stop() → idempotent app.stop(). * status()→ derived from internal state; never opens sockets. */ import type { Connector, ConnectorDoctor } from "../connector.js"; import { type SlackConfig } from "../../slack/config.js"; import { type SlackHandlerDeps } from "../../slack/handler.js"; export interface BoltLike { client: { auth: { test: () => Promise<{ user_id?: string; }>; }; }; start: () => Promise; stop: () => Promise; message: (handler: (args: { message: SlackMessage; say: SaySig; }) => Promise) => void; event: (name: "app_mention", handler: (args: { event: SlackMessage; say: SaySig; }) => Promise) => void; } export type AppFactory = (config: SlackConfig) => BoltLike; export type SaySig = (msg: { text: string; thread_ts?: string; }) => Promise; export interface SlackMessage { text?: string; user?: string; bot_id?: string; subtype?: string; channel_type?: string; thread_ts?: string; ts?: string; } export interface SlackConnectorOptions { config: SlackConfig; /** Inject an App factory for testing; default lazy-loads @slack/bolt. */ appFactory?: AppFactory; /** Inject handler deps for testing; default wires comms resolveSession + commsAsk. */ handlerDeps?: Omit; /** Logger; defaults to console.error. */ log?: (msg: string) => void; } export declare const SLACK_CONNECTOR_NAME = "slack"; /** * Build a Slack {@link Connector}. The factory is sync; all I/O happens in * `start()`. */ export declare function createSlackConnector(opts: SlackConnectorOptions): Connector; /** * Static readiness check (no sockets opened). True when both tokens are * present in the loaded config AND a Copilot tmux session can be resolved. */ export declare function slackDoctor(config: SlackConfig | null, errorIfNoConfig?: string): ConnectorDoctor;