/** * `SlackIntegration` — Slack as a `FactoryIntegration`. * * Slack contributes two things to a factory: the chat channels that carry * inbound messages into agent runs (`channels()`), and the browser-facing * account-link routes that bind a Slack sender to a Mastra tenant (`routes()`). * Both used to be assembled by hand in the deploy entry, which had to reach * into the prepared agent controller by string key, resolve storage domains * itself, mint its own state signer, and splice routes onto the factory's * assembled server config. Implementing the integration interface instead means * the factory does all of that the same way it already does for GitHub and * Linear, and the entry's job shrinks to reading Slack's env vars once. * * Slack ships as a factory built-in alongside GitHub and Linear (it originally * lived in `mastracode/web` to keep `@mastra/slack`/`chat` out of this package; * the team reversed that so `create-factory` consumers get Slack channels out * of the box). The integration interface remains open — third parties still add * capabilities by implementing `FactoryIntegration` from outside the package. */ import type { ApiRoute } from '@mastra/core/server'; import type { SlackAdapterChannelConfig } from '@mastra/slack'; import type { WorkItemFeedPublisher } from '../../storage/domains/comments/feed-sync.js'; import type { FactoryChannelsConfig, FactoryIntegration, IntegrationContext } from '../base.js'; /** * Slack app credentials, read from env ONCE by the deploy entry. `signingSecret` * is required because the Slack adapter validates it at construction — an * integration constructed without it would throw during `prepare()` rather than * reporting itself unconfigured. */ export interface SlackIntegrationConfig { /** Verifies inbound Slack request signatures. Required. */ signingSecret: string; /** Bot token used to post replies and ephemeral cards. */ botToken?: string; /** * OAuth client credentials. Required for account linking: "Sign in with * Slack" (OIDC) is the only flow that writes a link, so without these the * settings surface reports `canConnect: false` and no sender can link. */ clientId?: string; clientSecret?: string; /** * HTTPS origin Slack redirects back to. Slack requires HTTPS, so locally this * is the tunnel origin rather than the app's own public URL. */ oidcRedirectBaseUrl?: string; /** SPA origin the post-connect redirect returns to. */ uiOrigin?: string; /** * Overrides for the Slack channel adapter entry. * * @example * ```ts * new SlackIntegration({ * signingSecret, * adapterOptions: { * streaming: true, * toolDisplay: 'grouped', * }, * }); * ``` */ adapterOptions?: SlackAdapterChannelConfig; } export declare class SlackIntegration implements FactoryIntegration { #private; readonly id = "slack"; /** * The OIDC connect flow round-trips a signed `state` through Slack, so the * replica handling the callback must be able to verify a state a different * replica signed. */ readonly requiresStableStateSigner = true; constructor(config: SlackIntegrationConfig); channels(ctx: IntegrationContext): FactoryChannelsConfig; feedPublisher(ctx: IntegrationContext): WorkItemFeedPublisher; routes(ctx: IntegrationContext): ApiRoute[]; diagnostics(): Record; } //# sourceMappingURL=integration.d.ts.map