/** * Managed Slack Events HTTP handler + agent runner. * * Verifies Slack signatures, normalizes Phase 1 events, acknowledges within the * Slack 3s window, then invokes the graph over a trusted loopback and posts an * auto-reply when needed. */ import { InMemoryChannelStore } from "../store.js"; import type { RequiredSlackChannelConfig } from "./index.js"; import { type SlackInstallationContext } from "./normalize.js"; import { type IdentityLinkStore } from "../../identity/slack/links.js"; import { invokeIngressAgent, type SourceThreadExistsInput } from "../../ingress/index.js"; export { ingressSourceThreadExists, invokeIngressAgent, stableThreadId, type InvokeIngressAgentInput, type InvokeIngressAgentResult, type SourceThreadExistsInput, } from "../../ingress/index.js"; /** Env vars for Phase 1 single-workspace Slack install. */ export declare const SLACK_SIGNING_SECRET_ENV = "SLACK_SIGNING_SECRET"; export declare const SLACK_API_APP_ID_ENV = "SLACK_API_APP_ID"; export declare const SLACK_TEAM_ID_ENV = "SLACK_TEAM_ID"; export declare const SLACK_BOT_USER_ID_ENV = "SLACK_BOT_USER_ID"; export interface SlackChannelHttpConfig { name: string; config: RequiredSlackChannelConfig; /** Override store (tests). */ store?: InMemoryChannelStore; /** Override background scheduling (tests can run inline). */ schedule?: (work: () => Promise) => void; /** Override agent invoke (tests). */ invokeAgent?: typeof invokeIngressAgent; /** Override installation/env resolution (tests). */ installation?: SlackInstallationContext; signingSecret?: string; botToken?: string; deploymentId?: string; assistantId?: string; /** * Pre-read raw body. Prefer this when the HTTP framework may have already * consumed `request` (the Hono mount passes `await c.req.text()`). */ rawBody?: string | Uint8Array; /** Override identity link store (tests). */ linkStore?: IdentityLinkStore; /** * Override involvement check for `thread_reply` (tests). Defaults to probing * whether an MDA thread already exists for the source-thread key under the * resolved (post-link) actor. */ sourceThreadExists?: (input: SourceThreadExistsInput) => Promise; } /** * Handle `POST /channels/{name}/events` for a Slack Events API request. * * Verifies signatures before parsing normal events. Until both Slack * credentials are configured, only the inert URL-verification challenge is * accepted. */ export declare function handleSlackEventsRequest(request: Request, channel: SlackChannelHttpConfig): Promise; /** * Build a short user-facing Slack failure message. * * Opaque by default; only allowlisted {@link ChannelError} codes get a fixed * safe string. Raw exception text is never posted to the channel. * * Exported for unit tests. */ export declare function formatSlackFailureReply(error: unknown): string; //# sourceMappingURL=http.d.ts.map