Skip to content

Open-source status page, incident response and uptime monitoring

feat: Slack agent (#1872)

Thibault Le Ouay4803ce96aaa9
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index d66aa1443..77888252b 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -27,7 +27,7 @@ jobs:
DATABASE_AUTH_TOKEN: "basic:token"
steps:
- name: ⬇️ Checkout repo
- uses: actions/checkout@v4
+ uses: actions/checkout@v6
- name: Set up pnpm
uses: pnpm/action-setup@v4
@@ -35,7 +35,7 @@ jobs:
version: 10.26.0
- name: ⎔ Setup node
- uses: actions/setup-node@v4
+ uses: actions/setup-node@v6
with:
node-version: 24
cache: "pnpm"
diff --git a/apps/dashboard/src/app/(dashboard)/settings/(list)/page.tsx b/apps/dashboard/src/app/(dashboard)/settings/(list)/page.tsx
index 25a063214..236a01436 100644
--- a/apps/dashboard/src/app/(dashboard)/settings/(list)/page.tsx
+++ b/apps/dashboard/src/app/(dashboard)/settings/(list)/page.tsx
@@ -30,6 +30,11 @@ const settings = [
description: "Manage your account information.",
href: "/settings/account",
},
+ {
+ title: "Integrations",
+ description: "Connect third-party services to your workspace.",
+ href: "/settings/integrations",
+ },
];
export default function Page() {
return (
diff --git a/apps/dashboard/src/app/(dashboard)/settings/account/breadcrumb.tsx b/apps/dashboard/src/app/(dashboard)/settings/account/breadcrumb.tsx
index 22f35c219..897100e1c 100644
--- a/apps/dashboard/src/app/(dashboard)/settings/account/breadcrumb.tsx
+++ b/apps/dashboard/src/app/(dashboard)/settings/account/breadcrumb.tsx
@@ -1,7 +1,7 @@
"use client";
import { NavBreadcrumb } from "@/components/nav/nav-breadcrumb";
-import { Cog, CreditCard, User } from "lucide-react";
+import { Blocks, Cog, CreditCard, User } from "lucide-react";
export function Breadcrumb() {
return (
@@ -14,6 +14,7 @@ export function Breadcrumb() {
{ value: "general", label: "General", icon: Cog },
{ value: "account", label: "Account", icon: User },
{ value: "billing", label: "Billing", icon: CreditCard },
+ { value: "integrations", label: "Integrations", icon: Blocks },
],
},
]}
diff --git a/apps/dashboard/src/app/(dashboard)/settings/billing/breadcrumb.tsx b/apps/dashboard/src/app/(dashboard)/settings/billing/breadcrumb.tsx
index 22f35c219..897100e1c 100644
--- a/apps/dashboard/src/app/(dashboard)/settings/billing/breadcrumb.tsx
+++ b/apps/dashboard/src/app/(dashboard)/settings/billing/breadcrumb.tsx
@@ -1,7 +1,7 @@
"use client";
import { NavBreadcrumb } from "@/components/nav/nav-breadcrumb";
-import { Cog, CreditCard, User } from "lucide-react";
+import { Blocks, Cog, CreditCard, User } from "lucide-react";
export function Breadcrumb() {
return (
@@ -14,6 +14,7 @@ export function Breadcrumb() {
{ value: "general", label: "General", icon: Cog },
{ value: "account", label: "Account", icon: User },
{ value: "billing", label: "Billing", icon: CreditCard },
+ { value: "integrations", label: "Integrations", icon: Blocks },
],
},
]}
diff --git a/apps/dashboard/src/app/(dashboard)/settings/general/breadcrumb.tsx b/apps/dashboard/src/app/(dashboard)/settings/general/breadcrumb.tsx
index 112011f36..78465cfe0 100644
--- a/apps/dashboard/src/app/(dashboard)/settings/general/breadcrumb.tsx
+++ b/apps/dashboard/src/app/(dashboard)/settings/general/breadcrumb.tsx
@@ -1,7 +1,7 @@
"use client";
import { NavBreadcrumb } from "@/components/nav/nav-breadcrumb";
-import { Cog, CreditCard, User } from "lucide-react";
+import { Blocks, Cog, CreditCard, User } from "lucide-react";
export function Breadcrumb() {
return (
@@ -14,6 +14,7 @@ export function Breadcrumb() {
{ value: "general", label: "General", icon: Cog },
{ value: "account", label: "Account", icon: User },
{ value: "billing", label: "Billing", icon: CreditCard },
+ { value: "integrations", label: "Integrations", icon: Blocks },
],
},
]}
diff --git a/apps/dashboard/src/app/(dashboard)/settings/integrations/breadcrumb.tsx b/apps/dashboard/src/app/(dashboard)/settings/integrations/breadcrumb.tsx
new file mode 100644
index 000000000..78465cfe0
--- /dev/null
+++ b/apps/dashboard/src/app/(dashboard)/settings/integrations/breadcrumb.tsx
@@ -0,0 +1,23 @@
+"use client";
+
+import { NavBreadcrumb } from "@/components/nav/nav-breadcrumb";
+import { Blocks, Cog, CreditCard, User } from "lucide-react";
+
+export function Breadcrumb() {
+ return (
+ <NavBreadcrumb
+ items={[
+ { type: "page", label: "Settings", icon: Cog },
+ {
+ type: "select",
+ items: [
+ { value: "general", label: "General", icon: Cog },
+ { value: "account", label: "Account", icon: User },
+ { value: "billing", label: "Billing", icon: CreditCard },
+ { value: "integrations", label: "Integrations", icon: Blocks },
+ ],
+ },
+ ]}
+ />
+ );
+}
diff --git a/apps/dashboard/src/app/(dashboard)/settings/integrations/layout.tsx b/apps/dashboard/src/app/(dashboard)/settings/integrations/layout.tsx
new file mode 100644
index 000000000..99f492983
--- /dev/null
+++ b/apps/dashboard/src/app/(dashboard)/settings/integrations/layout.tsx
@@ -0,0 +1,37 @@
+import {
+ AppHeader,
+ AppHeaderActions,
+ AppHeaderContent,
+} from "@/components/nav/app-header";
+import { AppSidebarTrigger } from "@/components/nav/app-sidebar";
+
+import { HydrateClient, getQueryClient, trpc } from "@/lib/trpc/server";
+import { Breadcrumb } from "./breadcrumb";
+import { NavActions } from "./nav-actions";
+
+export default async function Layout({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ const queryClient = getQueryClient();
+ await queryClient.prefetchQuery(trpc.integration.list.queryOptions());
+ await queryClient.prefetchQuery(trpc.workspace.get.queryOptions());
+
+ return (
+ <HydrateClient>
+ <div>
+ <AppHeader>
+ <AppHeaderContent>
+ <AppSidebarTrigger />
+ <Breadcrumb />
+ </AppHeaderContent>
+ <AppHeaderActions>
+ <NavActions />
+ </AppHeaderActions>
+ </AppHeader>
+ <main className="w-full flex-1">{children}</main>
+ </div>
+ </HydrateClient>
+ );
+}
diff --git a/apps/dashboard/src/app/(dashboard)/settings/integrations/nav-actions.tsx b/apps/dashboard/src/app/(dashboard)/settings/integrations/nav-actions.tsx
new file mode 100644
index 000000000..768c5c97f
--- /dev/null
+++ b/apps/dashboard/src/app/(dashboard)/settings/integrations/nav-actions.tsx
@@ -0,0 +1,9 @@
+import { NavFeedback } from "@/components/nav/nav-feedback";
+
+export function NavActions() {
+ return (
+ <div className="flex items-center gap-2 text-sm">
+ <NavFeedback />
+ </div>
+ );
+}
diff --git a/apps/dashboard/src/app/(dashboard)/settings/integrations/page.tsx b/apps/dashboard/src/app/(dashboard)/settings/integrations/page.tsx
new file mode 100644
index 000000000..7a4b2cf66
--- /dev/null
+++ b/apps/dashboard/src/app/(dashboard)/settings/integrations/page.tsx
@@ -0,0 +1,70 @@
+"use client";
+
+import {
+ Section,
+ SectionDescription,
+ SectionGroup,
+ SectionHeader,
+ SectionTitle,
+} from "@/components/content/section";
+import { FormCardGroup } from "@/components/forms/form-card";
+import { useFeature } from "@/hooks/use-feature";
+import { useTRPC } from "@/lib/trpc/client";
+import {
+ Card,
+ CardContent,
+ CardHeader,
+ CardTitle,
+} from "@openstatus/ui/components/ui/card";
+import { useQuery } from "@tanstack/react-query";
+import { SlackIntegrationCard } from "./slack-card";
+
+export default function Page() {
+ const trpc = useTRPC();
+ const isSlackAgentEnabled = useFeature("slack-agent");
+ const { data: integrations } = useQuery(trpc.integration.list.queryOptions());
+
+ if (!integrations) return null;
+
+ const slackIntegration = integrations.find((i) => i.name === "slack-agent");
+
+ return (
+ <SectionGroup>
+ <Section>
+ <SectionHeader>
+ <SectionTitle>Integrations</SectionTitle>
+ <SectionDescription>
+ Connect third-party services to your workspace.
+ </SectionDescription>
+ </SectionHeader>
+ <FormCardGroup>
+ {isSlackAgentEnabled ? (
+ <SlackIntegrationCard
+ integration={
+ slackIntegration
+ ? {
+ id: slackIntegration.id,
+ externalId: slackIntegration.externalId,
+ data: slackIntegration.data as {
+ teamName?: string;
+ },
+ }
+ : null
+ }
+ />
+ ) : (
+ <Card>
+ <CardHeader>
+ <CardTitle>No integrations available</CardTitle>
+ </CardHeader>
+ <CardContent>
+ Slack integration is coming soon; send us a message if you want
+ to try it.
+ </CardContent>
+ </Card>
+ )}
+ </FormCardGroup>
+ </Section>
+ </SectionGroup>
+ );
+}
diff --git a/apps/dashboard/src/app/(dashboard)/settings/integrations/slack-card.tsx b/apps/dashboard/src/app/(dashboard)/settings/integrations/slack-card.tsx
new file mode 100644
index 000000000..e7c940b68
--- /dev/null
+++ b/apps/dashboard/src/app/(dashboard)/settings/integrations/slack-card.tsx
@@ -0,0 +1,112 @@
+"use client";
+
+import {
+ FormCard,
+ FormCardContent,
+ FormCardDescription,
+ FormCardFooter,
+ FormCardHeader,
+ FormCardTitle,
+} from "@/components/forms/form-card";
+import { useTRPC } from "@/lib/trpc/client";
+import { Badge } from "@openstatus/ui/components/ui/badge";
+import { Button } from "@openstatus/ui/components/ui/button";
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import { useRouter } from "next/navigation";
+
+const SERVER_URL =
+ process.env.NODE_ENV === "production"
+ ? "https://api.openstatus.dev"
+ : "http://localhost:3000";
+
+interface SlackIntegrationCardProps {
+ integration: {
+ id: number;
+ externalId: string;
+ data: { teamName?: string };
+ } | null;
+}
+
+export function SlackIntegrationCard({
+ integration,
+}: SlackIntegrationCardProps) {
+ const router = useRouter();
+ const trpc = useTRPC();
+ const queryClient = useQueryClient();
+ const isConnected = !!integration;
+
+ const deleteIntegration = useMutation(
+ trpc.integration.deleteIntegration.mutationOptions({
+ onSuccess: () => {
+ queryClient.invalidateQueries({
+ queryKey: trpc.integration.list.queryKey(),
+ });
+ router.refresh();
+ },
+ }),
+ );
+
+ const generateToken = useMutation(
+ trpc.integration.generateInstallToken.mutationOptions({
+ onSuccess: (data) => {
+ window.location.href = `${SERVER_URL}/slack/install?token=${data.token}`;
+ },
+ }),
+ );
+
+ const handleInstall = () => {
+ generateToken.mutate();
+ };
+
+ const handleDisconnect = () => {
+ if (!integration) return;
+ deleteIntegration.mutate({ integrationId: integration.id });
+ };
+
+ return (
+ <FormCard>
+ <FormCardHeader>
+ <div className="flex items-center gap-2">
+ <FormCardTitle>Slack</FormCardTitle>
+ {isConnected && <Badge variant="secondary">Connected</Badge>}
+ </div>
+ <FormCardDescription>
+ Manage status reports directly from Slack. Mention the bot in a
+ channel to create and update incidents.
+ </FormCardDescription>
+ </FormCardHeader>
+ <FormCardContent>
+ {isConnected ? (
+ <p className="text-muted-foreground text-sm">
+ Connected to{" "}
+ <strong>{integration.data?.teamName ?? "Slack workspace"}</strong>
+ </p>
+ ) : (
+ <p className="text-muted-foreground text-sm">
+ Connect your Slack workspace to get started.
+ </p>
+ )}
+ </FormCardContent>
+ <FormCardFooter>
+ {isConnected ? (
+ <Button
+ variant="destructive"
+ size="sm"
+ onClick={handleDisconnect}
+ disabled={deleteIntegration.isPending}
+ >
+ {deleteIntegration.isPending ? "Disconnecting..." : "Disconnect"}
+ </Button>
+ ) : (
+ <Button
+ size="sm"
+ onClick={handleInstall}
+ disabled={generateToken.isPending}
+ >
+ {generateToken.isPending ? "Connecting..." : "Add to Slack"}
+ </Button>
+ )}
+ </FormCardFooter>
+ </FormCard>
+ );
+}
diff --git a/apps/dashboard/src/hooks/use-feature.ts b/apps/dashboard/src/hooks/use-feature.ts
index 4e7983ee1..d48b0bcd3 100644
--- a/apps/dashboard/src/hooks/use-feature.ts
+++ b/apps/dashboard/src/hooks/use-feature.ts
@@ -5,7 +5,7 @@ import { useQuery } from "@tanstack/react-query";
* Record<feature, [workspaceId, ...]>
*/
const features = {
- "dns-checker": [1],
+ "slack-agent": [1, 6850],
};
export function useFeature(feature: keyof typeof features) {
diff --git a/apps/server/package.json b/apps/server/package.json
index 2f8b01478..5428b5bcf 100644
--- a/apps/server/package.json
+++ b/apps/server/package.json
@@ -54,6 +54,9 @@
"nanoid": "5.0.7",
"percentile": "1.6.0",
"validator": "13.12.0",
+ "@slack/web-api": "^7.8.0",
+ "@ai-sdk/anthropic": "^1.2.0",
+ "ai": "6.0.94",
"zod": "4.1.13"
},
"devDependencies": {
diff --git a/apps/server/src/env.ts b/apps/server/src/env.ts
index ca469110c..e26c50190 100644
--- a/apps/server/src/env.ts
+++ b/apps/server/src/env.ts
@@ -18,6 +18,11 @@ export const env = createEnv({
RESEND_API_KEY: z.string(),
AXIOM_TOKEN: z.string(),
AXIOM_DATASET: z.string(),
+ SLACK_SIGNING_SECRET: z.string().optional(),
+ SLACK_CLIENT_ID: z.string().optional(),
+ SLACK_CLIENT_SECRET: z.string().optional(),
+ SLACK_REDIRECT_URI: z.string().optional(),
+ AI_GATEWAY_API_KEY: z.string().optional(),
},
/**
diff --git a/apps/server/src/index.ts b/apps/server/src/index.ts
index efae348d5..f1baaebc0 100644
--- a/apps/server/src/index.ts
+++ b/apps/server/src/index.ts
@@ -24,6 +24,7 @@ import { env } from "./env";
import { handleError } from "./libs/errors";
import { publicRoute } from "./routes/public";
import { mountRpcRoutes } from "./routes/rpc";
+import { slackRoute } from "./routes/slack";
import { api } from "./routes/v1";
type Env = {
@@ -234,6 +235,11 @@ app.get(
*/
app.route("/v1", api);
+/**
+ * Slack Agent Routes
+ */
+app.route("/slack", slackRoute);
+
/**
* TODO: move to `workflows` app
* This route is used by our checker to update the status of the monitors,
diff --git a/apps/server/src/libs/test/preload.ts b/apps/server/src/libs/test/preload.ts
index fc6731f61..aa1a088bb 100644
--- a/apps/server/src/libs/test/preload.ts
+++ b/apps/server/src/libs/test/preload.ts
@@ -1,11 +1,30 @@
import { mock } from "bun:test";
+const testRedisStore = new Map<string, string>();
+(globalThis as Record<string, unknown>).__testRedisStore = testRedisStore;
+
mock.module("@openstatus/upstash", () => ({
Redis: {
fromEnv() {
return {
- get: () => Promise.resolve(undefined),
- set: () => Promise.resolve([]),
+ get: (key: string) => Promise.resolve(testRedisStore.get(key) ?? null),
+ set: (key: string, value: string) => {
+ testRedisStore.set(key, value);
+ return Promise.resolve("OK");
+ },
+ del: (key: string) => {
+ const existed = testRedisStore.has(key) ? 1 : 0;
+ testRedisStore.delete(key);
+ return Promise.resolve(existed);
+ },
+ getdel: (key: string) => {
+ const value = testRedisStore.get(key) ?? null;
+ testRedisStore.delete(key);
+ return Promise.resolve(value);
+ },
+ expire: (_key: string, _seconds: number) => {
+ return Promise.resolve(1);
+ },
};
},
},
diff --git a/apps/server/src/routes/public/status.test.ts b/apps/server/src/routes/public/status.test.ts
index f1261efb6..750ca03c4 100644
--- a/apps/server/src/routes/public/status.test.ts
+++ b/apps/server/src/routes/public/status.test.ts
@@ -1,6 +1,16 @@
-import { afterAll, beforeAll, describe, expect, test } from "bun:test";
+import {
+ afterAll,
+ beforeAll,
+ beforeEach,
+ describe,
+ expect,
+ test,
+} from "bun:test";
import { app } from "@/index";
import { db, eq } from "@openstatus/db";
+
+const testRedisStore = (globalThis as Record<string, unknown>)
+ .__testRedisStore as Map<string, string> | undefined;
import {
incidentTable,
maintenance,
@@ -106,6 +116,10 @@ beforeAll(async () => {
});
});
+beforeEach(() => {
+ testRedisStore?.clear();
+});
+
afterAll(async () => {
// Clean up test data
if (testIncidentId) {
diff --git a/apps/server/src/routes/rpc/services/monitor/__tests__/monitor.test.ts b/apps/server/src/routes/rpc/services/monitor/__tests__/monitor.test.ts
index 9f6ce9754..e6318feac 100644
--- a/apps/server/src/routes/rpc/services/monitor/__tests__/monitor.test.ts
+++ b/apps/server/src/routes/rpc/services/monitor/__tests__/monitor.test.ts
@@ -1989,11 +1989,11 @@ describe("MonitorService.GetMonitor", () => {
// Insert a monitor with invalid data that will fail selectMonitorSchema parsing
const corruptedMon = await db
.insert(monitor)
+ // @ts-expect-error - intentionally invalid periodicity to test parse failure
.values({
workspaceId: 1,
name: `${TEST_PREFIX}-corrupted-data`,
url: "https://corrupted.example.com",
- // @ts-expect-error - intentionally invalid periodicity to test parse failure
periodicity: "invalid-periodicity",
active: true,
regions: "ams",
diff --git a/apps/server/src/routes/rpc/services/status-report/index.ts b/apps/server/src/routes/rpc/services/status-report/index.ts
index 841306fd6..8d17c5571 100644
--- a/apps/server/src/routes/rpc/services/status-report/index.ts
+++ b/apps/server/src/routes/rpc/services/status-report/index.ts
@@ -49,7 +49,7 @@ const emailClient = new EmailClient({ apiKey: env.RESEND_API_KEY });
/**
* Helper to send status report notifications to page subscribers.
*/
-async function sendStatusReportNotification(params: {
+export async function sendStatusReportNotification(params: {
statusReportId: number;
pageId: number;
reportTitle: string;
@@ -132,7 +132,7 @@ async function sendStatusReportNotification(params: {
/**
* Helper to get a status report by ID with workspace scope.
*/
-async function getStatusReportById(id: number, workspaceId: number) {
+export async function getStatusReportById(id: number, workspaceId: number) {
return db
.select()
.from(statusReport)
@@ -145,7 +145,7 @@ async function getStatusReportById(id: number, workspaceId: number) {
/**
* Helper to get page component IDs for a status report.
*/
-async function getPageComponentIdsForReport(statusReportId: number) {
+export async function getPageComponentIdsForReport(statusReportId: number) {
const components = await db
.select({ pageComponentId: statusReportsToPageComponents.pageComponentId })
.from(statusReportsToPageComponents)
@@ -179,7 +179,7 @@ interface ValidatedPageComponents {
* Helper to validate page component IDs belong to the workspace and same page.
* Accepts an optional transaction to ensure atomicity with subsequent operations.
*/
-async function validatePageComponentIds(
+export async function validatePageComponentIds(
pageComponentIds: string[],
workspaceId: number,
tx: DB | Transaction = db,
@@ -227,7 +227,7 @@ async function validatePageComponentIds(
* Helper to update page component associations for a status report.
* Accepts an optional transaction to ensure atomicity.
*/
-async function updatePageComponentAssociations(
+export async function updatePageComponentAssociations(
statusReportId: number,
pageComponentIds: number[],
tx: DB | Transaction = db,
diff --git a/apps/server/src/routes/slack/agent.ts b/apps/server/src/routes/slack/agent.ts
new file mode 100644
index 000000000..7fc3aca71
--- /dev/null
+++ b/apps/server/src/routes/slack/agent.ts
@@ -0,0 +1,107 @@
+import type { Workspace } from "@openstatus/db/src/schema/workspaces/validation";
+import { generateText, stepCountIs } from "ai";
+import type { ModelMessage } from "ai";
+import { createTools } from "./tools";
+
+interface SlackThreadMessage {
+ user?: string;
+ bot_id?: string;
+ text?: string;
+}
+
+interface AgentResult {
+ text: string;
+ toolResults: Array<{ toolName: string; result: unknown }>;
+}
+
+function buildSystemPrompt(workspaceName: string): string {
+ return `You are the OpenStatus assistant for workspace "${workspaceName}".
+You help teams create and manage status reports through Slack.
+
+IMPORTANT: You have NO knowledge of this workspace's data. NEVER guess or make up status pages, components, or reports. ALWAYS call the appropriate tool first to get real data.
+- Questions about pages or components -> call listStatusPages
+- Questions about reports -> call listStatusReports
+- Creating a report -> call listStatusPages first, then createStatusReport
+
+Capabilities:
+- Create status reports on status pages (createStatusReport)
+- Publish progress updates to existing reports (addStatusReportUpdate)
+- Edit report metadata like title or components (updateStatusReport)
+- List active status reports and status pages
+
+Lifecycle: createStatusReport once -> addStatusReportUpdate repeatedly -> resolved.
+- "provide an update", "we found the cause", "resolve it" -> addStatusReportUpdate
+- "rename the report", "add a component" -> updateStatusReport (metadata only)
+
+Guidelines:
+- If multiple status pages exist, ask which one to use. If only one, use it automatically.
+- Infer the status from conversation context:
+ "we have an incident" -> investigating
+ "we found the root cause" -> identified
+ "we're watching it" -> monitoring
+ "it's fixed" -> resolved
+- Draft professional status page updates. Don't repeat the user verbatim.
+- When tagged in a thread, synthesize the full thread into a status report draft.
+- Status progression: investigating -> identified -> monitoring -> resolved
+- Be concise. Use Slack mrkdwn formatting (*bold*, _italic_).
+- For any mutation, always call the tool so the user sees a confirmation.`;
+}
+
+function convertThreadToMessages(
+ thread: SlackThreadMessage[],
+ botUserId: string,
+): ModelMessage[] {
+ const messages: ModelMessage[] = [];
+ for (const msg of thread) {
+ if (!msg.text) continue;
+ if (msg.bot_id || msg.user === botUserId) {
+ messages.push({ role: "assistant", content: msg.text });
+ } else {
+ messages.push({ role: "user", content: msg.text });
+ }
+ }
+ // The API requires the first message to have role "user".
+ // Drop any leading assistant messages (e.g. bot confirmations from a prior turn).
+ while (messages.length > 0 && messages[0].role !== "user") {
+ messages.shift();
+ }
+ return messages;
+}
+
+export async function runAgent(
+ workspace: Workspace,
+ thread: SlackThreadMessage[],
+ botUserId: string,
+ userText?: string,
+): Promise<AgentResult> {
+ const tools = createTools(workspace);
+ let messages = convertThreadToMessages(thread, botUserId);
+
+ if (messages.length === 0 && userText) {
+ messages = [{ role: "user" as const, content: userText }];
+ }
+
+ if (messages.length === 0) {
+ return {
+ text: "I couldn't read your message. Please try again.",
+ toolResults: [],
+ };
+ }
+
+ const result = await generateText({
+ model: "anthropic/claude-sonnet-4.5",
+ system: buildSystemPrompt(workspace.name ?? "Unknown"),
+ messages,
+ tools,
+ stopWhen: stepCountIs(5),
+ });
+
+ const toolResults: AgentResult["toolResults"] = [];
+ for (const step of result.steps) {
+ for (const tc of step.toolResults) {
+ toolResults.push({ toolName: tc.toolName, result: tc.output });
+ }
+ }
+
+ return { text: result.text, toolResults };
+}
diff --git a/apps/server/src/routes/slack/blocks.test.ts b/apps/server/src/routes/slack/blocks.test.ts
new file mode 100644
index 000000000..a1a0bcfd6
--- /dev/null
+++ b/apps/server/src/routes/slack/blocks.test.ts
@@ -0,0 +1,141 @@
+import { describe, expect, test } from "bun:test";
+import { buildConfirmationBlocks } from "./blocks";
+import type { PendingAction } from "./confirmation-store";
+
+describe("buildConfirmationBlocks", () => {
+ test("createStatusReport includes 3 buttons", () => {
+ const action: PendingAction["action"] = {
+ type: "createStatusReport",
+ params: {
+ title: "API Outage",
+ status: "investigating",
+ message: "API is returning 500 errors",
+ pageId: 1,
+ },
+ };
+
+ const blocks = buildConfirmationBlocks("abc123", action);
+
+ const section = blocks.find((b) => b.type === "section");
+ expect(section).toBeDefined();
+ expect((section as { text: { text: string } }).text.text).toContain(
+ "API Outage",
+ );
+ expect((section as { text: { text: string } }).text.text).toContain(
+ "Investigating",
+ );
+
+ const actions = blocks.find((b) => b.type === "actions") as {
+ elements: { action_id: string }[];
+ };
+ expect(actions.elements).toHaveLength(3);
+ expect(actions.elements[0].action_id).toBe("approve_abc123");
+ expect(actions.elements[1].action_id).toBe("approve_notify_abc123");
+ expect(actions.elements[2].action_id).toBe("cancel_abc123");
+ });
+
+ test("createStatusReport shows components when provided", () => {
+ const action: PendingAction["action"] = {
+ type: "createStatusReport",
+ params: {
+ title: "Test",
+ status: "investigating",
+ message: "msg",
+ pageId: 1,
+ pageComponentIds: ["comp-1", "comp-2"],
+ },
+ };
+
+ const blocks = buildConfirmationBlocks("id1", action);
+ const section = blocks.find((b) => b.type === "section") as {
+ text: { text: string };
+ };
+ expect(section.text.text).toContain("comp-1, comp-2");
+ });
+
+ test("addStatusReportUpdate includes 3 buttons", () => {
+ const action: PendingAction["action"] = {
+ type: "addStatusReportUpdate",
+ params: {
+ statusReportId: 42,
+ status: "identified",
+ message: "Root cause found",
+ },
+ };
+
+ const blocks = buildConfirmationBlocks("abc", action);
+
+ const section = blocks.find((b) => b.type === "section") as {
+ text: { text: string };
+ };
+ expect(section.text.text).toContain("42");
+ expect(section.text.text).toContain("Identified");
+
+ const actions = blocks.find((b) => b.type === "actions") as {
+ elements: { action_id: string }[];
+ };
+ expect(actions.elements).toHaveLength(3);
+ });
+
+ test("updateStatusReport includes 2 buttons (no notify)", () => {
+ const action: PendingAction["action"] = {
+ type: "updateStatusReport",
+ params: {
+ statusReportId: 10,
+ title: "Updated Title",
+ },
+ };
+
+ const blocks = buildConfirmationBlocks("xyz", action);
+
+ const section = blocks.find((b) => b.type === "section") as {
+ text: { text: string };
+ };
+ expect(section.text.text).toContain("Updated Title");
+
+ const actions = blocks.find((b) => b.type === "actions") as {
+ elements: { action_id: string }[];
+ };
+ expect(actions.elements).toHaveLength(2);
+ expect(actions.elements[0].action_id).toBe("approve_xyz");
+ expect(actions.elements[1].action_id).toBe("cancel_xyz");
+ });
+
+ test("resolveStatusReport includes 3 buttons", () => {
+ const action: PendingAction["action"] = {
+ type: "resolveStatusReport",
+ params: {
+ statusReportId: 5,
+ message: "Issue has been resolved",
+ },
+ };
+
+ const blocks = buildConfirmationBlocks("res1", action);
+
+ const section = blocks.find((b) => b.type === "section") as {
+ text: { text: string };
+ };
+ expect(section.text.text).toContain("5");
+ expect(section.text.text).toContain("Issue has been resolved");
+
+ const actions = blocks.find((b) => b.type === "actions") as {
+ elements: { action_id: string }[];
+ };
+ expect(actions.elements).toHaveLength(3);
+ });
+
+ test("all blocks include a divider", () => {
+ const action: PendingAction["action"] = {
+ type: "createStatusReport",
+ params: {
+ title: "T",
+ status: "investigating",
+ message: "m",
+ pageId: 1,
+ },
+ };
+
+ const blocks = buildConfirmationBlocks("d1", action);
+ expect(blocks.some((b) => b.type === "divider")).toBe(true);
+ });
+});
diff --git a/apps/server/src/routes/slack/blocks.ts b/apps/server/src/routes/slack/blocks.ts
new file mode 100644
index 000000000..0efdb33a1
--- /dev/null
+++ b/apps/server/src/routes/slack/blocks.ts
@@ -0,0 +1,196 @@
+import type { PendingAction } from "./confirmation-store";
+
+interface TextObject {
+ type: "plain_text" | "mrkdwn";
+ text: string;
+ emoji?: boolean;
+}
+
+interface SectionBlock {
+ type: "section";
+ text: TextObject;
+}
+
+interface ActionsBlock {
+ type: "actions";
+ elements: ButtonElement[];
+}
+
+interface DividerBlock {
+ type: "divider";
+}
+
+interface ButtonElement {
+ type: "button";
+ text: TextObject;
+ action_id: string;
+ value?: string;
+ style?: "primary" | "danger";
+}
+
+type Block = SectionBlock | ActionsBlock | DividerBlock;
+
+export function buildConfirmationBlocks(
+ actionId: string,
+ action: PendingAction["action"],
+): Block[] {
+ const blocks: Block[] = [];
+
+ switch (action.type) {
+ case "createStatusReport": {
+ const { title, status, message, pageId, pageComponentIds } =
+ action.params;
+ blocks.push({
+ type: "section",
+ text: {
+ type: "mrkdwn",
+ text: `*Create Status Report*\n\n*Title:* ${title}\n*Status:* ${capitalize(status)}\n*Page ID:* ${pageId}${
+ pageComponentIds?.length
+ ? `\n*Components:* ${pageComponentIds.join(", ")}`
+ : ""
+ }\n*Message:* ${message}`,
+ },
+ });
+ blocks.push({ type: "divider" });
+ blocks.push({
+ type: "actions",
+ elements: [
+ {
+ type: "button",
+ text: { type: "plain_text", text: "Approve", emoji: true },
+ action_id: `approve_${actionId}`,
+ style: "primary",
+ },
+ {
+ type: "button",
+ text: {
+ type: "plain_text",
+ text: "Approve & Notify",
+ emoji: true,
+ },
+ action_id: `approve_notify_${actionId}`,
+ style: "primary",
+ },
+ {
+ type: "button",
+ text: { type: "plain_text", text: "Cancel", emoji: true },
+ action_id: `cancel_${actionId}`,
+ style: "danger",
+ },
+ ],
+ });
+ break;
+ }
+ case "addStatusReportUpdate": {
+ const { statusReportId, status, message } = action.params;
+ blocks.push({
+ type: "section",
+ text: {
+ type: "mrkdwn",
+ text: `*Add Status Report Update*\n\n*Report ID:* ${statusReportId}\n*New Status:* ${capitalize(status)}\n*Message:* ${message}`,
+ },
+ });
+ blocks.push({ type: "divider" });
+ blocks.push({
+ type: "actions",
+ elements: [
+ {
+ type: "button",
+ text: { type: "plain_text", text: "Approve", emoji: true },
+ action_id: `approve_${actionId}`,
+ style: "primary",
+ },
+ {
+ type: "button",
+ text: {
+ type: "plain_text",
+ text: "Approve & Notify",
+ emoji: true,
+ },
+ action_id: `approve_notify_${actionId}`,
+ style: "primary",
+ },
+ {
+ type: "button",
+ text: { type: "plain_text", text: "Cancel", emoji: true },
+ action_id: `cancel_${actionId}`,
+ style: "danger",
+ },
+ ],
+ });
+ break;
+ }
+ case "updateStatusReport": {
+ const { statusReportId, title, pageComponentIds } = action.params;
+ let text = `*Update Status Report*\n\n*Report ID:* ${statusReportId}`;
+ if (title) text += `\n*New Title:* ${title}`;
+ if (pageComponentIds?.length)
+ text += `\n*Components:* ${pageComponentIds.join(", ")}`;
+ blocks.push({ type: "section", text: { type: "mrkdwn", text } });
+ blocks.push({ type: "divider" });
+ blocks.push({
+ type: "actions",
+ elements: [
+ {
+ type: "button",
+ text: { type: "plain_text", text: "Approve", emoji: true },
+ action_id: `approve_${actionId}`,
+ style: "primary",
+ },
+ {
+ type: "button",
+ text: { type: "plain_text", text: "Cancel", emoji: true },
+ action_id: `cancel_${actionId}`,
+ style: "danger",
+ },
+ ],
+ });
+ break;
+ }
+ case "resolveStatusReport": {
+ const { statusReportId, message } = action.params;
+ blocks.push({
+ type: "section",
+ text: {
+ type: "mrkdwn",
+ text: `*Resolve Status Report*\n\n*Report ID:* ${statusReportId}\n*Message:* ${message}`,
+ },
+ });
+ blocks.push({ type: "divider" });
+ blocks.push({
+ type: "actions",
+ elements: [
+ {
+ type: "button",
+ text: { type: "plain_text", text: "Approve", emoji: true },
+ action_id: `approve_${actionId}`,
+ style: "primary",
+ },
+ {
+ type: "button",
+ text: {
+ type: "plain_text",
+ text: "Approve & Notify",
+ emoji: true,
+ },
+ action_id: `approve_notify_${actionId}`,
+ style: "primary",
+ },
+ {
+ type: "button",
+ text: { type: "plain_text", text: "Cancel", emoji: true },
+ action_id: `cancel_${actionId}`,
+ style: "danger",
+ },
+ ],
+ });
+ break;
+ }
+ }
+
+ return blocks;
+}
+
+function capitalize(s: string): string {
+ return s.charAt(0).toUpperCase() + s.slice(1);
+}
diff --git a/apps/server/src/routes/slack/confirmation-store.test.ts b/apps/server/src/routes/slack/confirmation-store.test.ts
new file mode 100644
index 000000000..c9d8b2bce
--- /dev/null
+++ b/apps/server/src/routes/slack/confirmation-store.test.ts
@@ -0,0 +1,244 @@
+import { beforeEach, describe, expect, test } from "bun:test";
+import {
+ consume,
+ findByThread,
+ get,
+ replace,
+ store,
+} from "./confirmation-store";
+import type { PendingAction } from "./confirmation-store";
+
+const redisStore = (globalThis as Record<string, unknown>)
+ .__testRedisStore as Map<string, string>;
+
+function makePendingInput(): Omit<PendingAction, "id" | "createdAt"> {
+ return {
+ workspaceId: 1,
+ limits: {},
+ botToken: "xoxb-test-token",
+ channelId: "C123",
+ threadTs: "1234567890.123456",
+ messageTs: "1234567890.654321",
+ userId: "U123",
+ action: {
+ type: "createStatusReport",
+ params: {
+ title: "Test Incident",
+ status: "investigating",
+ message: "We are investigating",
+ pageId: 1,
+ },
+ },
+ };
+}
+
+describe("confirmation-store", () => {
+ beforeEach(() => {
+ redisStore.clear();
+ });
+
+ describe("store", () => {
+ test("returns an action id", async () => {
+ const id = await store(makePendingInput());
+ expect(typeof id).toBe("string");
+ expect(id.length).toBeGreaterThan(0);
+ });
+
+ test("saves action and thread index to redis", async () => {
+ const input = makePendingInput();
+ const id = await store(input);
+
+ const actionKey = `slack:action:${id}`;
+ const threadKey = `slack:thread:${input.threadTs}`;
+
+ expect(redisStore.has(actionKey)).toBe(true);
+ expect(redisStore.has(threadKey)).toBe(true);
+
+ const stored = JSON.parse(redisStore.get(actionKey) as string);
+ expect(stored.id).toBe(id);
+ expect(stored.workspaceId).toBe(1);
+ expect(stored.action.type).toBe("createStatusReport");
+
+ expect(redisStore.get(threadKey)).toBe(id);
+ });
+ });
+
+ describe("get", () => {
+ test("returns stored action without deleting it", async () => {
+ const input = makePendingInput();
+ const id = await store(input);
+
+ const result = await get(id);
+ expect(result).toBeDefined();
+ expect(result?.id).toBe(id);
+ expect(result?.action.type).toBe("createStatusReport");
+
+ // Keys should still exist
+ expect(redisStore.has(`slack:action:${id}`)).toBe(true);
+ expect(redisStore.has(`slack:thread:${input.threadTs}`)).toBe(true);
+ });
+
+ test("returns undefined for unknown id", async () => {
+ const result = await get("nonexistent");
+ expect(result).toBeUndefined();
+ });
+
+ test("returns undefined for invalid data in redis", async () => {
+ redisStore.set("slack:action:bad", JSON.stringify({ invalid: true }));
+
+ const result = await get("bad");
+ expect(result).toBeUndefined();
+ });
+ });
+
+ describe("consume", () => {
+ test("returns stored action and deletes it", async () => {
+ const input = makePendingInput();
+ const id = await store(input);
+
+ const result = await consume(id);
+ expect(result).toBeDefined();
+ expect(result?.id).toBe(id);
+ expect(result?.action.type).toBe("createStatusReport");
+
+ expect(redisStore.has(`slack:action:${id}`)).toBe(false);
+ expect(redisStore.has(`slack:thread:${input.threadTs}`)).toBe(false);
+ });
+
+ test("returns undefined for unknown id", async () => {
+ const result = await consume("nonexistent");
+ expect(result).toBeUndefined();
+ });
+
+ test("returns undefined for invalid data in redis", async () => {
+ redisStore.set("slack:action:bad", JSON.stringify({ invalid: true }));
+
+ const result = await consume("bad");
+ expect(result).toBeUndefined();
+ });
+ });
+
+ describe("findByThread", () => {
+ test("finds action by thread timestamp", async () => {
+ const input = makePendingInput();
+ const id = await store(input);
+
+ const result = await findByThread(input.threadTs);
+ expect(result).toBeDefined();
+ expect(result?.id).toBe(id);
+ });
+
+ test("returns undefined for unknown thread", async () => {
+ const result = await findByThread("unknown.thread");
+ expect(result).toBeUndefined();
+ });
+
+ test("cleans up orphaned thread index", async () => {
+ redisStore.set("slack:thread:orphan.ts", "missing-id");
+
+ const result = await findByThread("orphan.ts");
+ expect(result).toBeUndefined();
+ expect(redisStore.has("slack:thread:orphan.ts")).toBe(false);
+ });
+ });
+
+ describe("replace", () => {
+ test("replaces the action on an existing pending", async () => {
+ const input = makePendingInput();
+ const id = await store(input);
+
+ const newAction: PendingAction["action"] = {
+ type: "addStatusReportUpdate",
+ params: {
+ statusReportId: 42,
+ status: "identified",
+ message: "Root cause found",
+ },
+ };
+
+ await replace(id, newAction);
+
+ const result = await consume(id);
+ expect(result).toBeDefined();
+ expect(result?.action.type).toBe("addStatusReportUpdate");
+ if (result?.action.type === "addStatusReportUpdate") {
+ expect(result?.action.params.statusReportId).toBe(42);
+ }
+ });
+
+ test("does nothing for unknown id", async () => {
+ await replace("nonexistent", {
+ type: "resolveStatusReport",
+ params: { statusReportId: 1, message: "fixed" },
+ });
+ expect(redisStore.size).toBe(0);
+ });
+ });
+
+ describe("zod validation", () => {
+ test("validates all action types", async () => {
+ const actions: PendingAction["action"][] = [
+ {
+ type: "createStatusReport",
+ params: {
+ title: "Test",
+ status: "investigating",
+ message: "msg",
+ pageId: 1,
+ },
+ },
+ {
+ type: "addStatusReportUpdate",
+ params: {
+ statusReportId: 1,
+ status: "identified",
+ message: "update",
+ },
+ },
+ {
+ type: "updateStatusReport",
+ params: { statusReportId: 1, title: "New Title" },
+ },
+ {
+ type: "resolveStatusReport",
+ params: { statusReportId: 1, message: "resolved" },
+ },
+ ];
+
+ for (const action of actions) {
+ const input = { ...makePendingInput(), action };
+ const id = await store(input);
+ const result = await consume(id);
+ expect(result).toBeDefined();
+ expect(result?.action.type).toBe(action.type);
+ }
+ });
+
+ test("rejects invalid status values", async () => {
+ const raw = JSON.stringify({
+ id: "test",
+ workspaceId: 1,
+ limits: makePendingInput().limits,
+ botToken: "tok",
+ channelId: "C1",
+ threadTs: "1.1",
+ messageTs: "1.2",
+ userId: "U1",
+ createdAt: Date.now(),
+ action: {
+ type: "createStatusReport",
+ params: {
+ title: "T",
+ status: "invalid_status",
+ message: "m",
+ pageId: 1,
+ },
+ },
+ });
+
+ redisStore.set("slack:action:bad-status", raw);
+ const result = await consume("bad-status");
+ expect(result).toBeUndefined();
+ });
+ });
+});
diff --git a/apps/server/src/routes/slack/confirmation-store.ts b/apps/server/src/routes/slack/confirmation-store.ts
new file mode 100644
index 000000000..49fb546e3
--- /dev/null
+++ b/apps/server/src/routes/slack/confirmation-store.ts
@@ -0,0 +1,162 @@
+import { redis } from "@/libs/clients";
+import { limitsSchema } from "@openstatus/db/src/schema/plan/schema";
+import { nanoid } from "nanoid";
+import { z } from "zod";
+
+const statusEnum = z.enum([
+ "investigating",
+ "identified",
+ "monitoring",
+ "resolved",
+]);
+
+const createStatusReportActionSchema = z.object({
+ type: z.literal("createStatusReport"),
+ params: z.object({
+ title: z.string(),
+ status: statusEnum,
+ message: z.string(),
+ pageId: z.number(),
+ pageComponentIds: z.array(z.string()).optional(),
+ }),
+});
+
+const addStatusReportUpdateActionSchema = z.object({
+ type: z.literal("addStatusReportUpdate"),
+ params: z.object({
+ statusReportId: z.number(),
+ status: statusEnum,
+ message: z.string(),
+ }),
+});
+
+const updateStatusReportActionSchema = z.object({
+ type: z.literal("updateStatusReport"),
+ params: z.object({
+ statusReportId: z.number(),
+ title: z.string().optional(),
+ pageComponentIds: z.array(z.string()).optional(),
+ }),
+});
+
+const resolveStatusReportActionSchema = z.object({
+ type: z.literal("resolveStatusReport"),
+ params: z.object({
+ statusReportId: z.number(),
+ message: z.string(),
+ }),
+});
+
+const actionSchema = z.discriminatedUnion("type", [
+ createStatusReportActionSchema,
+ addStatusReportUpdateActionSchema,
+ updateStatusReportActionSchema,
+ resolveStatusReportActionSchema,
+]);
+
+const pendingActionSchema = z.object({
+ id: z.string(),
+ workspaceId: z.number(),
+ limits: limitsSchema,
+ botToken: z.string(),
+ channelId: z.string(),
+ threadTs: z.string(),
+ messageTs: z.string(),
+ userId: z.string(),
+ createdAt: z.number(),
+ action: actionSchema,
+});
+
+export type PendingAction = z.infer<typeof pendingActionSchema>;
+
+const TTL_SECONDS = 5 * 60;
+const ACTION_PREFIX = "slack:action:";
+const THREAD_PREFIX = "slack:thread:";
+
+function parse(raw: unknown): PendingAction | undefined {
+ const data = typeof raw === "string" ? JSON.parse(raw) : raw;
+ const result = pendingActionSchema.safeParse(data);
+ if (!result.success) {
+ console.error("[slack confirmation-store] invalid data:", result.error);
+ return undefined;
+ }
+ return result.data;
+}
+
+export async function store(
+ action: Omit<PendingAction, "id" | "createdAt">,
+): Promise<string> {
+ const id = nanoid();
+ const pending: PendingAction = { ...action, id, createdAt: Date.now() };
+
+ await Promise.all([
+ redis.set(`${ACTION_PREFIX}${id}`, JSON.stringify(pending), {
+ ex: TTL_SECONDS,
+ }),
+ redis.set(`${THREAD_PREFIX}${action.threadTs}`, id, {
+ ex: TTL_SECONDS,
+ }),
+ ]);
+
+ return id;
+}
+
+export async function get(
+ actionId: string,
+): Promise<PendingAction | undefined> {
+ const raw = await redis.get<string>(`${ACTION_PREFIX}${actionId}`);
+ if (!raw) return undefined;
+ return parse(raw);
+}
+
+export async function consume(
+ actionId: string,
+): Promise<PendingAction | undefined> {
+ // Atomic read+delete to prevent double execution from concurrent requests
+ const raw = await redis.getdel<string>(`${ACTION_PREFIX}${actionId}`);
+ if (!raw) return undefined;
+
+ const action = parse(raw);
+ if (!action) return undefined;
+
+ // Clean up the thread mapping (best-effort, not critical for atomicity)
+ await redis.del(`${THREAD_PREFIX}${action.threadTs}`);
+
+ return action;
+}
+
+export async function findByThread(
+ threadTs: string,
+): Promise<PendingAction | undefined> {
+ const actionId = await redis.get<string>(`${THREAD_PREFIX}${threadTs}`);
+ if (!actionId) return undefined;
+
+ const raw = await redis.get<string>(`${ACTION_PREFIX}${actionId}`);
+ if (!raw) {
+ await redis.del(`${THREAD_PREFIX}${threadTs}`);
+ return undefined;
+ }
+
+ return parse(raw);
+}
+
+export async function replace(
+ actionId: string,
+ newAction: PendingAction["action"],
+): Promise<void> {
+ const raw = await redis.get<string>(`${ACTION_PREFIX}${actionId}`);
+ if (!raw) return;
+
+ const existing = parse(raw);
+ if (!existing) return;
+
+ existing.action = newAction;
+ existing.createdAt = Date.now();
+
+ await Promise.all([
+ redis.set(`${ACTION_PREFIX}${actionId}`, JSON.stringify(existing), {
+ ex: TTL_SECONDS,
+ }),
+ redis.expire(`${THREAD_PREFIX}${existing.threadTs}`, TTL_SECONDS),
+ ]);
+}
diff --git a/apps/server/src/routes/slack/handler.test.ts b/apps/server/src/routes/slack/handler.test.ts
new file mode 100644
index 000000000..dbb86e36e
--- /dev/null
+++ b/apps/server/src/routes/slack/handler.test.ts
@@ -0,0 +1,349 @@
+import { beforeEach, describe, expect, mock, test } from "bun:test";
+import crypto from "node:crypto";
+import { Hono } from "hono";
+
+const SIGNING_SECRET = "test-signing-secret";
+
+process.env.SLACK_SIGNING_SECRET = SIGNING_SECRET;
+process.env.AI_GATEWAY_API_KEY = "test-key";
+
+mock.module("./workspace-resolver", () => ({
+ resolveWorkspace: (teamId: string) => {
+ if (teamId === "T_KNOWN") {
+ return Promise.resolve({
+ workspace: {
+ id: 1,
+ name: "Test Workspace",
+ slug: "test",
+ plan: "free",
+ limits: {},
+ },
+ botToken: "xoxb-test",
+ botUserId: "UBOT",
+ });
+ }
+ return Promise.resolve(null);
+ },
+}));
+
+let slackMessages: Array<{ method: string; args: unknown }> = [];
+
+mock.module("@slack/web-api", () => ({
+ WebClient: class {
+ chat = {
+ postMessage: (args: unknown) => {
+ slackMessages.push({ method: "postMessage", args });
+ return Promise.resolve({ ts: "msg.ts" });
+ },
+ update: (args: unknown) => {
+ slackMessages.push({ method: "update", args });
+ return Promise.resolve({ ts: "msg.ts" });
+ },
+ };
+ conversations = {
+ replies: () =>
+ Promise.resolve({
+ messages: [{ user: "U1", text: "test message", ts: "1.1" }],
+ }),
+ };
+ },
+}));
+
+mock.module("./agent", () => ({
+ runAgent: () =>
+ Promise.resolve({
+ text: "Here is my response",
+ toolResults: [],
+ }),
+}));
+
+const { handleSlackEvent } = await import("./handler");
+const { verifySlackSignature } = await import("./verify");
+
+function createTestApp() {
+ const app = new Hono<{ Variables: { slackBody: unknown } }>();
+ app.post("/slack/events", verifySlackSignature, handleSlackEvent);
+ return app;
+}
+
+function signAndPost(
+ app: ReturnType<typeof createTestApp>,
+ body: Record<string, unknown>,
+) {
+ const rawBody = JSON.stringify(body);
+ const timestamp = Math.floor(Date.now() / 1000);
+ const basestring = `v0:${timestamp}:${rawBody}`;
+ const sig = crypto
+ .createHmac("sha256", SIGNING_SECRET)
+ .update(basestring)
+ .digest("hex");
+
+ return app.request("/slack/events", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ "x-slack-request-timestamp": String(timestamp),
+ "x-slack-signature": `v0=${sig}`,
+ },
+ body: rawBody,
+ });
+}
+
+describe("handleSlackEvent", () => {
+ const app = createTestApp();
+
+ beforeEach(() => {
+ slackMessages = [];
+ });
+
+ test("responds to url_verification challenge", async () => {
+ const res = await signAndPost(app, {
+ type: "url_verification",
+ challenge: "test-challenge-123",
+ });
+
+ expect(res.status).toBe(200);
+ const json = (await res.json()) as { challenge: string };
+ expect(json.challenge).toBe("test-challenge-123");
+ });
+
+ test("returns ok for non-event_callback types", async () => {
+ const res = await signAndPost(app, {
+ type: "app_rate_limited",
+ });
+
+ expect(res.status).toBe(200);
+ const json = (await res.json()) as { ok: boolean };
+ expect(json.ok).toBe(true);
+ });
+
+ test("returns ok for event_callback", async () => {
+ const res = await signAndPost(app, {
+ type: "event_callback",
+ team_id: "T_KNOWN",
+ event_id: `evt_${Date.now()}_1`,
+ event: {
+ type: "app_mention",
+ text: "<@UBOT> create an incident",
+ user: "U1",
+ channel: "C1",
+ ts: "100.1",
+ },
+ });
+
+ expect(res.status).toBe(200);
+ const json = (await res.json()) as { ok: boolean };
+ expect(json.ok).toBe(true);
+ });
+
+ test("handles app_uninstalled event", async () => {
+ const res = await signAndPost(app, {
+ type: "event_callback",
+ team_id: "T_KNOWN",
+ event_id: `evt_uninstall_${Date.now()}`,
+ event: {
+ type: "app_uninstalled",
+ },
+ });
+
+ expect(res.status).toBe(200);
+ });
+
+ test("handles tokens_revoked event", async () => {
+ const res = await signAndPost(app, {
+ type: "event_callback",
+ team_id: "T_KNOWN",
+ event_id: `evt_revoked_${Date.now()}`,
+ event: {
+ type: "tokens_revoked",
+ },
+ });
+
+ expect(res.status).toBe(200);
+ });
+
+ test("deduplicates events with same event_id", async () => {
+ const eventId = `evt_dedup_${Date.now()}`;
+ const body = {
+ type: "event_callback",
+ team_id: "T_KNOWN",
+ event_id: eventId,
+ event: {
+ type: "app_mention",
+ text: "<@UBOT> hello",
+ user: "U1",
+ channel: "C1",
+ ts: `${Date.now()}.1`,
+ },
+ };
+
+ await signAndPost(app, body);
+ await new Promise((r) => setTimeout(r, 50));
+
+ slackMessages = [];
+ await signAndPost(app, body);
+ await new Promise((r) => setTimeout(r, 50));
+
+ expect(slackMessages.length).toBe(0);
+ });
+
+ test("ignores events from unknown teams", async () => {
+ const res = await signAndPost(app, {
+ type: "event_callback",
+ team_id: "T_UNKNOWN",
+ event_id: `evt_unknown_${Date.now()}`,
+ event: {
+ type: "app_mention",
+ text: "<@UBOT> hello",
+ user: "U1",
+ channel: "C1",
+ ts: `${Date.now()}.2`,
+ },
+ });
+
+ expect(res.status).toBe(200);
+ await new Promise((r) => setTimeout(r, 50));
+ expect(slackMessages.length).toBe(0);
+ });
+
+ test("ignores message events from bots", async () => {
+ const res = await signAndPost(app, {
+ type: "event_callback",
+ team_id: "T_KNOWN",
+ event_id: `evt_bot_${Date.now()}`,
+ event: {
+ type: "message",
+ text: "bot message",
+ bot_id: "B123",
+ channel: "C1",
+ ts: `${Date.now()}.3`,
+ },
+ });
+
+ expect(res.status).toBe(200);
+ await new Promise((r) => setTimeout(r, 50));
+ expect(slackMessages.length).toBe(0);
+ });
+
+ test("ignores channel message without bot mention", async () => {
+ const res = await signAndPost(app, {
+ type: "event_callback",
+ team_id: "T_KNOWN",
+ event_id: `evt_nomention_${Date.now()}`,
+ event: {
+ type: "message",
+ text: "just a regular message",
+ user: "U1",
+ channel: "C1",
+ channel_type: "channel",
+ ts: `${Date.now()}.4`,
+ },
+ });
+
+ expect(res.status).toBe(200);
+ await new Promise((r) => setTimeout(r, 50));
+ expect(slackMessages.length).toBe(0);
+ });
+
+ test("processes DM messages without bot mention", async () => {
+ const res = await signAndPost(app, {
+ type: "event_callback",
+ team_id: "T_KNOWN",
+ event_id: `evt_dm_${Date.now()}`,
+ event: {
+ type: "message",
+ text: "hello in DM",
+ user: "U1",
+ channel: "D1",
+ channel_type: "im",
+ ts: `${Date.now()}.5`,
+ },
+ });
+
+ expect(res.status).toBe(200);
+ await new Promise((r) => setTimeout(r, 50));
+ // DM should trigger a response (postMessage for "Thinking...")
+ expect(slackMessages.length).toBeGreaterThan(0);
+ });
+
+ test("ignores events without channel", async () => {
+ const res = await signAndPost(app, {
+ type: "event_callback",
+ team_id: "T_KNOWN",
+ event_id: `evt_nochan_${Date.now()}`,
+ event: {
+ type: "app_mention",
+ text: "<@UBOT> hello",
+ user: "U1",
+ ts: `${Date.now()}.6`,
+ },
+ });
+
+ expect(res.status).toBe(200);
+ await new Promise((r) => setTimeout(r, 50));
+ expect(slackMessages.length).toBe(0);
+ });
+
+ test("ignores events without timestamp", async () => {
+ const res = await signAndPost(app, {
+ type: "event_callback",
+ team_id: "T_KNOWN",
+ event_id: `evt_nots_${Date.now()}`,
+ event: {
+ type: "app_mention",
+ text: "<@UBOT> hello",
+ user: "U1",
+ channel: "C1",
+ },
+ });
+
+ expect(res.status).toBe(200);
+ await new Promise((r) => setTimeout(r, 50));
+ expect(slackMessages.length).toBe(0);
+ });
+
+ test("ignores events without team_id", async () => {
+ const res = await signAndPost(app, {
+ type: "event_callback",
+ event_id: `evt_noteam_${Date.now()}`,
+ event: {
+ type: "app_mention",
+ text: "<@UBOT> hello",
+ user: "U1",
+ channel: "C1",
+ ts: `${Date.now()}.7`,
+ },
+ });
+
+ expect(res.status).toBe(200);
+ await new Promise((r) => setTimeout(r, 50));
+ expect(slackMessages.length).toBe(0);
+ });
+
+ test("ignores unsupported event types", async () => {
+ const res = await signAndPost(app, {
+ type: "event_callback",
+ team_id: "T_KNOWN",
+ event_id: `evt_unsupported_${Date.now()}`,
+ event: {
+ type: "channel_created",
+ },
+ });
+
+ expect(res.status).toBe(200);
+ await new Promise((r) => setTimeout(r, 50));
+ expect(slackMessages.length).toBe(0);
+ });
+
+ test("ignores events with no event payload", async () => {
+ const res = await signAndPost(app, {
+ type: "event_callback",
+ team_id: "T_KNOWN",
+ event_id: `evt_noevent_${Date.now()}`,
+ });
+
+ expect(res.status).toBe(200);
+ await new Promise((r) => setTimeout(r, 50));
+ expect(slackMessages.length).toBe(0);
+ });
+});
diff --git a/apps/server/src/routes/slack/handler.ts b/apps/server/src/routes/slack/handler.ts
new file mode 100644
index 000000000..debce9f1c
--- /dev/null
+++ b/apps/server/src/routes/slack/handler.ts
@@ -0,0 +1,248 @@
+import { and, db, eq } from "@openstatus/db";
+import { integration } from "@openstatus/db/src/schema";
+import { WebClient } from "@slack/web-api";
+import type { Context } from "hono";
+import { runAgent } from "./agent";
+import { buildConfirmationBlocks } from "./blocks";
+import { findByThread, replace, store } from "./confirmation-store";
+import type { PendingAction } from "./confirmation-store";
+import { resolveWorkspace } from "./workspace-resolver";
+
+const processedEvents = new Map<string, number>();
+
+function dedup(eventId: string): boolean {
+ const now = Date.now();
+ for (const [id, ts] of processedEvents) {
+ if (now - ts > 300_000) processedEvents.delete(id);
+ }
+ if (processedEvents.has(eventId)) return true;
+ processedEvents.set(eventId, now);
+ return false;
+}
+
+interface SlackEvent {
+ type: string;
+ event?: {
+ type: string;
+ text?: string;
+ user?: string;
+ channel?: string;
+ channel_type?: string;
+ ts?: string;
+ thread_ts?: string;
+ bot_id?: string;
+ };
+ event_id?: string;
+ team_id?: string;
+ challenge?: string;
+}
+
+interface ThreadMessage {
+ user?: string;
+ bot_id?: string;
+ text?: string;
+ ts?: string;
+}
+
+export async function handleSlackEvent(c: Context) {
+ const body = c.get("slackBody") as SlackEvent;
+
+ if (body.type === "url_verification") {
+ return c.json({ challenge: body.challenge });
+ }
+
+ if (body.type !== "event_callback") {
+ return c.json({ ok: true });
+ }
+
+ if (body.event_id && dedup(body.event_id)) {
+ return c.json({ ok: true });
+ }
+
+ const promise = processEvent(body);
+ promise.catch((err) => console.error("[slack] event processing error:", err));
+
+ return c.json({ ok: true });
+}
+
+async function processEvent(body: SlackEvent) {
+ const event = body.event;
+ if (!event) return;
+
+ if (event.type === "app_uninstalled" || event.type === "tokens_revoked") {
+ const teamId = body.team_id;
+ if (teamId) {
+ await db
+ .delete(integration)
+ .where(
+ and(
+ eq(integration.name, "slack-agent"),
+ eq(integration.externalId, teamId),
+ ),
+ );
+ console.log(`[slack] cleaned up integration for team ${teamId}`);
+ }
+ return;
+ }
+
+ if (event.type !== "app_mention" && event.type !== "message") return;
+ if (event.type === "message" && event.bot_id) return;
+
+ const teamId = body.team_id;
+ if (!teamId || !event.channel || !event.ts) return;
+
+ const resolved = await resolveWorkspace(teamId);
+ if (!resolved) {
+ console.warn(`[slack] no integration found for team ${teamId}`);
+ return;
+ }
+
+ const slack = new WebClient(resolved.botToken);
+ const botUserId = resolved.botUserId;
+ const threadTs = event.thread_ts ?? event.ts;
+
+ if (event.type === "message" && event.channel_type !== "im") {
+ if (!event.text?.includes(`<@${botUserId}>`)) return;
+ }
+
+ const thinkingMsg = await slack.chat.postMessage({
+ channel: event.channel,
+ thread_ts: threadTs,
+ text: ":hourglass_flowing_sand: Thinking...",
+ });
+ const thinkingTs = thinkingMsg.ts;
+
+ if (!thinkingTs) {
+ console.error("[slack] failed to post thinking message — no ts returned");
+ return;
+ }
+
+ try {
+ let thread: ThreadMessage[] = [];
+ if (event.thread_ts) {
+ const replies = await slack.conversations.replies({
+ channel: event.channel,
+ ts: event.thread_ts,
+ limit: 100,
+ });
+ thread = ((replies.messages ?? []) as ThreadMessage[]).filter(
+ (msg) => msg.ts !== thinkingTs,
+ );
+ } else {
+ thread = [{ user: event.user, text: event.text, ts: event.ts }];
+ }
+
+ const result = await runAgent(
+ resolved.workspace,
+ thread,
+ botUserId,
+ event.text,
+ );
+
+ const confirmationResult = result.toolResults.find(
+ (tr) =>
+ tr.result &&
+ typeof tr.result === "object" &&
+ "needsConfirmation" in tr.result &&
+ (tr.result as { needsConfirmation: boolean }).needsConfirmation,
+ );
+
+ if (confirmationResult) {
+ await handleConfirmation(
+ slack,
+ event.channel,
+ threadTs,
+ thinkingTs,
+ event.user ?? "",
+ resolved.workspace,
+ resolved.botToken,
+ confirmationResult,
+ );
+ } else {
+ await slack.chat.update({
+ channel: event.channel,
+ ts: thinkingTs,
+ text: result.text || "Done!",
+ });
+ }
+ } catch (err) {
+ const errMsg = err instanceof Error ? err.message : "Unknown error";
+ console.error("[slack] agent error:", err);
+ await slack.chat.update({
+ channel: event.channel,
+ ts: thinkingTs,
+ text: `:x: Something went wrong: ${errMsg}`,
+ });
+ }
+}
+
+async function handleConfirmation(
+ slack: WebClient,
+ channel: string,
+ threadTs: string,
+ thinkingTs: string,
+ userId: string,
+ workspace: { id: number; limits: PendingAction["limits"] },
+ botToken: string,
+ confirmationResult: { toolName: string; result: unknown },
+) {
+ const { params } = confirmationResult.result as {
+ needsConfirmation: boolean;
+ params: Record<string, unknown>;
+ };
+
+ const actionType =
+ confirmationResult.toolName as PendingAction["action"]["type"];
+ const action = { type: actionType, params } as PendingAction["action"];
+
+ const existing = await findByThread(threadTs);
+ if (existing) {
+ await replace(existing.id, action);
+
+ const blocks = buildConfirmationBlocks(existing.id, action);
+ await slack.chat.update({
+ channel,
+ ts: thinkingTs,
+ text: getConfirmationText(action),
+ blocks,
+ });
+ await slack.chat.update({
+ channel,
+ ts: existing.messageTs,
+ text: getConfirmationText(action),
+ blocks,
+ });
+ } else {
+ const actionId = await store({
+ workspaceId: workspace.id,
+ limits: workspace.limits,
+ botToken,
+ channelId: channel,
+ threadTs,
+ messageTs: thinkingTs,
+ userId,
+ action,
+ });
+
+ const blocks = buildConfirmationBlocks(actionId, action);
+ await slack.chat.update({
+ channel,
+ ts: thinkingTs,
+ text: getConfirmationText(action),
+ blocks,
+ });
+ }
+}
+
+function getConfirmationText(action: PendingAction["action"]): string {
+ switch (action.type) {
+ case "createStatusReport":
+ return `Create Status Report: ${action.params.title}`;
+ case "addStatusReportUpdate":
+ return `Add Status Report Update (${action.params.status})`;
+ case "updateStatusReport":
+ return `Update Status Report${action.params.title ? `: ${action.params.title}` : ""}`;
+ case "resolveStatusReport":
+ return "Resolve Status Report";
+ }
+}
diff --git a/apps/server/src/routes/slack/index.test.ts b/apps/server/src/routes/slack/index.test.ts
new file mode 100644
index 000000000..4b4f7dd31
--- /dev/null
+++ b/apps/server/src/routes/slack/index.test.ts
@@ -0,0 +1,136 @@
+import { describe, expect, test } from "bun:test";
+import crypto from "node:crypto";
+import { Hono } from "hono";
+
+const SIGNING_SECRET = "test-signing-secret";
+
+process.env.SLACK_SIGNING_SECRET = SIGNING_SECRET;
+process.env.AI_GATEWAY_API_KEY = "test-key";
+
+function signRequest(body: string, timestamp: number): string {
+ const basestring = `v0:${timestamp}:${body}`;
+ const hmac = crypto
+ .createHmac("sha256", SIGNING_SECRET)
+ .update(basestring)
+ .digest("hex");
+ return `v0=${hmac}`;
+}
+
+function makeInstallToken(workspaceId: number): string {
+ const payload = JSON.stringify({ workspaceId, ts: Date.now() });
+ const sig = crypto
+ .createHmac("sha256", SIGNING_SECRET)
+ .update(payload)
+ .digest("hex");
+ return Buffer.from(`${payload}.${sig}`).toString("base64url");
+}
+
+describe("slack route middleware", () => {
+ test("returns 503 when SLACK_SIGNING_SECRET is missing", async () => {
+ const originalSecret = process.env.SLACK_SIGNING_SECRET;
+ process.env.SLACK_SIGNING_SECRET = "";
+
+ // Import a fresh route since env is read at request time
+ const { slackRoute } = await import("./index");
+ const app = new Hono();
+ app.route("/slack", slackRoute);
+
+ const res = await app.request("/slack/install?token=invalid");
+ // Restore
+ process.env.SLACK_SIGNING_SECRET = originalSecret;
+
+ expect(res.status).toBe(503);
+ const json = (await res.json()) as { error: string };
+ expect(json.error).toBe("Slack agent not configured");
+ });
+
+ test("returns 503 when AI_GATEWAY_API_KEY is missing", async () => {
+ const originalKey = process.env.AI_GATEWAY_API_KEY;
+ process.env.AI_GATEWAY_API_KEY = "";
+
+ const { slackRoute } = await import("./index");
+ const app = new Hono();
+ app.route("/slack", slackRoute);
+
+ const res = await app.request("/slack/install?token=invalid");
+ process.env.AI_GATEWAY_API_KEY = originalKey;
+
+ expect(res.status).toBe(503);
+ });
+
+ test("GET /install is accessible with valid token", async () => {
+ const { slackRoute } = await import("./index");
+ const app = new Hono();
+ app.route("/slack", slackRoute);
+
+ const token = makeInstallToken(1);
+ const res = await app.request(`/slack/install?token=${token}`);
+ // Should redirect (302) to Slack OAuth, not 404
+ expect(res.status).toBe(302);
+ });
+
+ test("GET /install rejects invalid token", async () => {
+ const { slackRoute } = await import("./index");
+ const app = new Hono();
+ app.route("/slack", slackRoute);
+
+ const res = await app.request("/slack/install?token=invalid");
+ expect(res.status).toBe(403);
+ });
+
+ test("POST /events requires signature verification", async () => {
+ const { slackRoute } = await import("./index");
+ const app = new Hono();
+ app.route("/slack", slackRoute);
+
+ // POST without signature headers should fail
+ const res = await app.request("/slack/events", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ type: "url_verification", challenge: "test" }),
+ });
+
+ expect(res.status).toBe(401);
+ });
+
+ test("POST /events accepts valid signed request", async () => {
+ const { slackRoute } = await import("./index");
+ const app = new Hono();
+ app.route("/slack", slackRoute);
+
+ const body = JSON.stringify({
+ type: "url_verification",
+ challenge: "test-challenge",
+ });
+ const timestamp = Math.floor(Date.now() / 1000);
+ const signature = signRequest(body, timestamp);
+
+ const res = await app.request("/slack/events", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ "x-slack-request-timestamp": String(timestamp),
+ "x-slack-signature": signature,
+ },
+ body,
+ });
+
+ expect(res.status).toBe(200);
+ const json = (await res.json()) as { challenge: string };
+ expect(json.challenge).toBe("test-challenge");
+ });
+
+ test("POST /interactions requires signature verification", async () => {
+ const { slackRoute } = await import("./index");
+ const app = new Hono();
+ app.route("/slack", slackRoute);
+
+ const res = await app.request("/slack/interactions", {
+ method: "POST",
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
+ body: "payload={}",
+ });
+
+ expect(res.status).toBe(401);
+ });
+});
diff --git a/apps/server/src/routes/slack/index.ts b/apps/server/src/routes/slack/index.ts
new file mode 100644
index 000000000..ea01c11d5
--- /dev/null
+++ b/apps/server/src/routes/slack/index.ts
@@ -0,0 +1,30 @@
+import { env } from "@/env";
+import { Hono } from "hono";
+import { handleSlackEvent } from "./handler";
+import { handleSlackInteraction } from "./interactions";
+import { handleSlackInstall, handleSlackOAuthCallback } from "./oauth";
+import { verifySlackSignature } from "./verify";
+
+type SlackEnv = {
+ Variables: {
+ slackBody: unknown;
+ event: Record<string, unknown>;
+ };
+};
+
+const slack = new Hono<SlackEnv>();
+
+slack.use("*", async (c, next) => {
+ if (!env.SLACK_SIGNING_SECRET || !env.AI_GATEWAY_API_KEY) {
+ return c.json({ error: "Slack agent not configured" }, 503);
+ }
+ await next();
+});
+
+slack.get("/install", handleSlackInstall);
+slack.get("/oauth/callback", handleSlackOAuthCallback);
+
+slack.post("/events", verifySlackSignature, handleSlackEvent);
+slack.post("/interactions", verifySlackSignature, handleSlackInteraction);
+
+export { slack as slackRoute };
diff --git a/apps/server/src/routes/slack/interactions.test.ts b/apps/server/src/routes/slack/interactions.test.ts
new file mode 100644
index 000000000..561047b3f
--- /dev/null
+++ b/apps/server/src/routes/slack/interactions.test.ts
@@ -0,0 +1,292 @@
+import { beforeEach, describe, expect, mock, test } from "bun:test";
+import crypto from "node:crypto";
+import { Hono } from "hono";
+
+const SIGNING_SECRET = "test-signing-secret";
+
+process.env.SLACK_SIGNING_SECRET = SIGNING_SECRET;
+process.env.AI_GATEWAY_API_KEY = "test-key";
+
+const redisStore = (globalThis as Record<string, unknown>)
+ .__testRedisStore as Map<string, string>;
+
+const pendingData = {
+ id: "pending-123",
+ workspaceId: 1,
+ limits: {},
+ botToken: "xoxb-test",
+ channelId: "C1",
+ threadTs: "1.1",
+ messageTs: "1.2",
+ userId: "U_OWNER",
+ createdAt: Date.now(),
+ action: {
+ type: "createStatusReport" as const,
+ params: {
+ title: "Test Incident",
+ status: "investigating" as const,
+ message: "Investigating the issue",
+ pageId: 1,
+ },
+ },
+};
+
+mock.module("./workspace-resolver", () => ({
+ resolveWorkspace: (teamId: string) => {
+ if (teamId === "T_KNOWN") {
+ return Promise.resolve({ botToken: "xoxb-fallback" });
+ }
+ return Promise.resolve(null);
+ },
+}));
+
+let slackCalls: Array<{ method: string; args: Record<string, unknown> }> = [];
+
+mock.module("@slack/web-api", () => ({
+ WebClient: class {
+ chat = {
+ update: (args: Record<string, unknown>) => {
+ slackCalls.push({ method: "update", args });
+ return Promise.resolve();
+ },
+ postEphemeral: (args: Record<string, unknown>) => {
+ slackCalls.push({ method: "postEphemeral", args });
+ return Promise.resolve();
+ },
+ };
+ },
+}));
+
+const { handleSlackInteraction } = await import("./interactions");
+const { verifySlackSignature } = await import("./verify");
+
+function createTestApp() {
+ const app = new Hono<{ Variables: { slackBody: unknown } }>();
+ app.post("/slack/interactions", verifySlackSignature, handleSlackInteraction);
+ return app;
+}
+
+function seedPendingAction() {
+ redisStore.set(`slack:action:${pendingData.id}`, JSON.stringify(pendingData));
+ redisStore.set(`slack:thread:${pendingData.threadTs}`, pendingData.id);
+}
+
+function signAndPost(
+ app: ReturnType<typeof createTestApp>,
+ payload: Record<string, unknown>,
+) {
+ const payloadStr = JSON.stringify(payload);
+ const body = `payload=${encodeURIComponent(payloadStr)}`;
+ const timestamp = Math.floor(Date.now() / 1000);
+ const basestring = `v0:${timestamp}:${body}`;
+ const sig = crypto
+ .createHmac("sha256", SIGNING_SECRET)
+ .update(basestring)
+ .digest("hex");
+
+ return app.request("/slack/interactions", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/x-www-form-urlencoded",
+ "x-slack-request-timestamp": String(timestamp),
+ "x-slack-signature": `v0=${sig}`,
+ },
+ body,
+ });
+}
+
+describe("handleSlackInteraction", () => {
+ const app = createTestApp();
+
+ beforeEach(() => {
+ slackCalls = [];
+ redisStore.clear();
+ });
+
+ test("returns ok for non-block_actions", async () => {
+ const res = await signAndPost(app, {
+ type: "message_action",
+ actions: [],
+ });
+
+ expect(res.status).toBe(200);
+ expect(slackCalls).toHaveLength(0);
+ });
+
+ test("returns ok for unknown action_id prefix", async () => {
+ const res = await signAndPost(app, {
+ type: "block_actions",
+ user: { id: "U1" },
+ channel: { id: "C1" },
+ message: { ts: "1.1" },
+ team: { id: "T_KNOWN" },
+ actions: [{ action_id: "unknown_action" }],
+ });
+
+ expect(res.status).toBe(200);
+ expect(slackCalls).toHaveLength(0);
+ });
+
+ test("cancel updates message to cancelled", async () => {
+ seedPendingAction();
+
+ const res = await signAndPost(app, {
+ type: "block_actions",
+ user: { id: "U_OWNER" },
+ channel: { id: "C1" },
+ message: { ts: "1.2" },
+ team: { id: "T_KNOWN" },
+ actions: [{ action_id: "cancel_pending-123" }],
+ });
+
+ expect(res.status).toBe(200);
+ const cancelCall = slackCalls.find(
+ (c) =>
+ c.method === "update" && (c.args.text as string).includes("Cancelled"),
+ );
+ expect(cancelCall).toBeDefined();
+ });
+
+ test("rejects action from wrong user", async () => {
+ seedPendingAction();
+
+ const res = await signAndPost(app, {
+ type: "block_actions",
+ user: { id: "U_OTHER" },
+ channel: { id: "C1" },
+ message: { ts: "1.2" },
+ team: { id: "T_KNOWN" },
+ actions: [{ action_id: "approve_pending-123" }],
+ });
+
+ expect(res.status).toBe(200);
+ const ephemeral = slackCalls.find((c) => c.method === "postEphemeral");
+ expect(ephemeral).toBeDefined();
+ expect(ephemeral?.args.text as string).toContain("Only the person");
+
+ // Pending action should NOT be consumed — still available for the real owner
+ expect(redisStore.has(`slack:action:${pendingData.id}`)).toBe(true);
+ });
+
+ test("shows expired message when pending action not found", async () => {
+ const res = await signAndPost(app, {
+ type: "block_actions",
+ user: { id: "U1" },
+ channel: { id: "C1" },
+ message: { ts: "1.2" },
+ team: { id: "T_KNOWN" },
+ actions: [{ action_id: "approve_unknown-id" }],
+ });
+
+ expect(res.status).toBe(200);
+ const expiredCall = slackCalls.find(
+ (c) =>
+ c.method === "update" && (c.args.text as string).includes("expired"),
+ );
+ expect(expiredCall).toBeDefined();
+ });
+
+ test("returns ok when no bot token available", async () => {
+ const res = await signAndPost(app, {
+ type: "block_actions",
+ user: { id: "U1" },
+ channel: { id: "C1" },
+ message: { ts: "1.2" },
+ team: { id: "T_UNKNOWN" },
+ actions: [{ action_id: "approve_some-id" }],
+ });
+
+ expect(res.status).toBe(200);
+ expect(slackCalls).toHaveLength(0);
+ });
+
+ test("falls back to workspace resolver when pending has no botToken", async () => {
+ const noTokenPending = {
+ ...pendingData,
+ id: "pending-notoken",
+ botToken: "",
+ createdAt: Date.now(),
+ };
+ redisStore.set(
+ `slack:action:${noTokenPending.id}`,
+ JSON.stringify(noTokenPending),
+ );
+
+ const res = await signAndPost(app, {
+ type: "block_actions",
+ user: { id: "U_OWNER" },
+ channel: { id: "C1" },
+ message: { ts: "1.2" },
+ team: { id: "T_KNOWN" },
+ actions: [{ action_id: "cancel_pending-notoken" }],
+ });
+
+ expect(res.status).toBe(200);
+ // Should still work via workspace resolver fallback
+ const cancelCall = slackCalls.find(
+ (c) =>
+ c.method === "update" && (c.args.text as string).includes("Cancelled"),
+ );
+ expect(cancelCall).toBeDefined();
+ });
+
+ test("returns ok with empty actions array", async () => {
+ const res = await signAndPost(app, {
+ type: "block_actions",
+ user: { id: "U1" },
+ channel: { id: "C1" },
+ message: { ts: "1.2" },
+ team: { id: "T_KNOWN" },
+ actions: [],
+ });
+
+ expect(res.status).toBe(200);
+ expect(slackCalls).toHaveLength(0);
+ });
+
+ test("parses approve_notify prefix correctly", async () => {
+ seedPendingAction();
+
+ const res = await signAndPost(app, {
+ type: "block_actions",
+ user: { id: "U_OWNER" },
+ channel: { id: "C1" },
+ message: { ts: "1.2" },
+ team: { id: "T_KNOWN" },
+ actions: [{ action_id: "approve_notify_pending-123" }],
+ });
+
+ // approve_notify should extract pending ID as "pending-123"
+ // Since the action exists and user matches, it tries to execute
+ expect(res.status).toBe(200);
+ });
+
+ test("returns ok when no team id and no pending", async () => {
+ const res = await signAndPost(app, {
+ type: "block_actions",
+ user: { id: "U1" },
+ channel: { id: "C1" },
+ message: { ts: "1.2" },
+ actions: [{ action_id: "approve_orphan-id" }],
+ });
+
+ expect(res.status).toBe(200);
+ expect(slackCalls).toHaveLength(0);
+ });
+
+ test("cancel consumes pending action from redis", async () => {
+ seedPendingAction();
+
+ await signAndPost(app, {
+ type: "block_actions",
+ user: { id: "U_OWNER" },
+ channel: { id: "C1" },
+ message: { ts: "1.2" },
+ team: { id: "T_KNOWN" },
+ actions: [{ action_id: "cancel_pending-123" }],
+ });
+
+ // After cancel, the pending action should be consumed from redis
+ expect(redisStore.has(`slack:action:${pendingData.id}`)).toBe(false);
+ });
+});
diff --git a/apps/server/src/routes/slack/interactions.ts b/apps/server/src/routes/slack/interactions.ts
new file mode 100644
index 000000000..8568175a2
--- /dev/null
+++ b/apps/server/src/routes/slack/interactions.ts
@@ -0,0 +1,373 @@
+import { db, eq } from "@openstatus/db";
+import {
+ page,
+ statusReport,
+ statusReportUpdate,
+} from "@openstatus/db/src/schema";
+import { WebClient } from "@slack/web-api";
+import type { Context } from "hono";
+import {
+ getStatusReportById,
+ sendStatusReportNotification,
+ updatePageComponentAssociations,
+ validatePageComponentIds,
+} from "../rpc/services/status-report";
+import { consume, get } from "./confirmation-store";
+import type { PendingAction } from "./confirmation-store";
+import { resolveWorkspace } from "./workspace-resolver";
+
+interface SlackInteractionPayload {
+ type: string;
+ user: { id: string };
+ channel: { id: string };
+ message: { ts: string };
+ team?: { id: string };
+ actions: Array<{ action_id: string; value?: string }>;
+}
+
+export async function handleSlackInteraction(c: Context) {
+ const payload = c.get("slackBody") as SlackInteractionPayload;
+
+ if (payload.type !== "block_actions" || !payload.actions?.length) {
+ return c.json({ ok: true });
+ }
+
+ const actionId = payload.actions[0].action_id;
+ const channelId = payload.channel.id;
+ const messageTs = payload.message.ts;
+ const userId = payload.user.id;
+ const teamId = payload.team?.id;
+
+ let type: "approve" | "approve_notify" | "cancel";
+ let pendingId: string;
+
+ if (actionId.startsWith("approve_notify_")) {
+ type = "approve_notify";
+ pendingId = actionId.replace("approve_notify_", "");
+ } else if (actionId.startsWith("approve_")) {
+ type = "approve";
+ pendingId = actionId.replace("approve_", "");
+ } else if (actionId.startsWith("cancel_")) {
+ type = "cancel";
+ pendingId = actionId.replace("cancel_", "");
+ } else {
+ return c.json({ ok: true });
+ }
+
+ // Non-atomic read for botToken resolution and authorization checks
+ const pending = await get(pendingId);
+
+ let botToken: string | undefined = pending?.botToken;
+ if (!botToken && teamId) {
+ const resolved = await resolveWorkspace(teamId);
+ botToken = resolved?.botToken;
+ }
+
+ if (!botToken) {
+ return c.json({ ok: true });
+ }
+
+ const slack = new WebClient(botToken);
+
+ if (!pending) {
+ await slack.chat.update({
+ channel: channelId,
+ ts: messageTs,
+ text: ":x: This action has expired. Please try again.",
+ blocks: [],
+ });
+ return c.json({ ok: true });
+ }
+
+ if (pending.userId !== userId) {
+ await slack.chat.postEphemeral({
+ channel: channelId,
+ user: userId,
+ text: "Only the person who initiated this action can approve or cancel it.",
+ });
+ return c.json({ ok: true });
+ }
+
+ // Atomic consume — prevents double execution from concurrent requests (e.g. double-click).
+ // If another request already consumed this action, consume() returns undefined.
+ const consumed = await consume(pendingId);
+ if (!consumed) {
+ return c.json({ ok: true });
+ }
+
+ if (type === "cancel") {
+ await slack.chat.update({
+ channel: channelId,
+ ts: messageTs,
+ text: ":no_entry_sign: Cancelled.",
+ blocks: [],
+ });
+ return c.json({ ok: true });
+ }
+
+ const notify = type === "approve_notify";
+
+ try {
+ await executeAction(consumed, notify, slack, channelId, messageTs);
+ } catch (err) {
+ const errMsg = err instanceof Error ? err.message : "Unknown error";
+ await slack.chat.update({
+ channel: channelId,
+ ts: messageTs,
+ text: `:x: Failed: ${errMsg}`,
+ blocks: [],
+ });
+ }
+
+ return c.json({ ok: true });
+}
+
+async function getReportUrl(pageId: number, reportId: number): Promise<string> {
+ const statusPage = await db
+ .select({ slug: page.slug, customDomain: page.customDomain })
+ .from(page)
+ .where(eq(page.id, pageId))
+ .get();
+
+ const baseUrl = statusPage?.customDomain
+ ? `https://${statusPage.customDomain}`
+ : `https://${statusPage?.slug}.openstatus.dev`;
+ return `${baseUrl}/events/report/${reportId}`;
+}
+
+async function executeAction(
+ pending: PendingAction,
+ notify: boolean,
+ slack: WebClient,
+ channelId: string,
+ messageTs: string,
+) {
+ const { action, workspaceId, limits } = pending;
+
+ switch (action.type) {
+ case "createStatusReport": {
+ const { title, status, message, pageId, pageComponentIds } =
+ action.params;
+
+ const result = await db.transaction(async (tx) => {
+ const validated = pageComponentIds?.length
+ ? await validatePageComponentIds(pageComponentIds, workspaceId, tx)
+ : { componentIds: [], pageId: null };
+
+ // Validate that provided pageId matches the components' page
+ if (
+ validated.pageId !== null &&
+ pageId != null &&
+ pageId !== validated.pageId
+ ) {
+ throw new Error(
+ `pageId ${pageId} does not match the page (${validated.pageId}) that the selected components belong to`,
+ );
+ }
+
+ // Prefer the validated pageId derived from components
+ const resolvedPageId = validated.pageId ?? pageId;
+
+ const report = await tx
+ .insert(statusReport)
+ .values({
+ workspaceId,
+ pageId: resolvedPageId,
+ title,
+ status,
+ })
+ .returning()
+ .get();
+
+ if (validated.componentIds.length > 0) {
+ await updatePageComponentAssociations(
+ report.id,
+ validated.componentIds,
+ tx,
+ );
+ }
+
+ await tx
+ .insert(statusReportUpdate)
+ .values({
+ statusReportId: report.id,
+ status,
+ date: new Date(),
+ message,
+ })
+ .returning()
+ .get();
+
+ return report;
+ });
+ if (!result || !result.pageId) {
+ throw new Error("Failed to create status report");
+ }
+ if (notify) {
+ await sendStatusReportNotification({
+ statusReportId: result.id,
+ pageId: result.pageId,
+ reportTitle: title,
+ status,
+ message,
+ date: new Date(),
+ limits,
+ });
+ }
+
+ const reportUrl = await getReportUrl(result.pageId, result.id);
+
+ await slack.chat.update({
+ channel: channelId,
+ ts: messageTs,
+ text: `:white_check_mark: Status report *${title}* created${notify ? " and subscribers notified" : ""}.\n<${reportUrl}|View on status page>`,
+ blocks: [],
+ });
+ break;
+ }
+
+ case "addStatusReportUpdate": {
+ const { statusReportId, status, message } = action.params;
+
+ const report = await getStatusReportById(statusReportId, workspaceId);
+ if (!report) {
+ throw new Error("Status report not found");
+ }
+
+ await db.transaction(async (tx) => {
+ await tx
+ .insert(statusReportUpdate)
+ .values({
+ statusReportId: report.id,
+ status,
+ date: new Date(),
+ message,
+ })
+ .returning()
+ .get();
+
+ await tx
+ .update(statusReport)
+ .set({ status, updatedAt: new Date() })
+ .where(eq(statusReport.id, report.id));
+ });
+
+ if (notify && report.pageId) {
+ await sendStatusReportNotification({
+ statusReportId: report.id,
+ pageId: report.pageId,
+ reportTitle: report.title,
+ status,
+ message,
+ date: new Date(),
+ limits,
+ });
+ }
+
+ const updateReportUrl = report.pageId
+ ? await getReportUrl(report.pageId, report.id)
+ : null;
+
+ await slack.chat.update({
+ channel: channelId,
+ ts: messageTs,
+ text: `:white_check_mark: Update added to *${report.title}* (${status})${notify ? " and subscribers notified" : ""}.\n>${message}${updateReportUrl ? `\n<${updateReportUrl}|View on status page>` : ""}`,
+ blocks: [],
+ });
+ break;
+ }
+
+ case "updateStatusReport": {
+ const { statusReportId, title, pageComponentIds } = action.params;
+
+ const report = await getStatusReportById(statusReportId, workspaceId);
+ if (!report) {
+ throw new Error("Status report not found");
+ }
+
+ await db.transaction(async (tx) => {
+ if (pageComponentIds) {
+ const validated = await validatePageComponentIds(
+ pageComponentIds,
+ workspaceId,
+ tx,
+ );
+ await updatePageComponentAssociations(
+ report.id,
+ validated.componentIds,
+ tx,
+ );
+ }
+
+ const updateValues: Record<string, unknown> = {
+ updatedAt: new Date(),
+ };
+ if (title) updateValues.title = title;
+
+ await tx
+ .update(statusReport)
+ .set(updateValues)
+ .where(eq(statusReport.id, report.id));
+ });
+
+ await slack.chat.update({
+ channel: channelId,
+ ts: messageTs,
+ text: `:white_check_mark: Status report *${title ?? report.title}* updated.`,
+ blocks: [],
+ });
+ break;
+ }
+
+ case "resolveStatusReport": {
+ const { statusReportId, message } = action.params;
+
+ const report = await getStatusReportById(statusReportId, workspaceId);
+ if (!report) {
+ throw new Error("Status report not found");
+ }
+
+ await db.transaction(async (tx) => {
+ await tx
+ .insert(statusReportUpdate)
+ .values({
+ statusReportId: report.id,
+ status: "resolved",
+ date: new Date(),
+ message,
+ })
+ .returning()
+ .get();
+
+ await tx
+ .update(statusReport)
+ .set({ status: "resolved", updatedAt: new Date() })
+ .where(eq(statusReport.id, report.id));
+ });
+
+ if (notify && report.pageId) {
+ await sendStatusReportNotification({
+ statusReportId: report.id,
+ pageId: report.pageId,
+ reportTitle: report.title,
+ status: "resolved",
+ message,
+ date: new Date(),
+ limits,
+ });
+ }
+
+ const resolveReportUrl = report.pageId
+ ? await getReportUrl(report.pageId, report.id)
+ : null;
+
+ await slack.chat.update({
+ channel: channelId,
+ ts: messageTs,
+ text: `:white_check_mark: *${report.title}* resolved${notify ? " and subscribers notified" : ""}.${message ? `\n>${message}` : ""}${resolveReportUrl ? `\n<${resolveReportUrl}|View on status page>` : ""}`,
+ blocks: [],
+ });
+ break;
+ }
+ }
+}
diff --git a/apps/server/src/routes/slack/oauth.test.ts b/apps/server/src/routes/slack/oauth.test.ts
new file mode 100644
index 000000000..cc1b20929
--- /dev/null
+++ b/apps/server/src/routes/slack/oauth.test.ts
@@ -0,0 +1,229 @@
+import { describe, expect, test } from "bun:test";
+import crypto from "node:crypto";
+import { Hono } from "hono";
+import { handleSlackInstall, handleSlackOAuthCallback } from "./oauth";
+
+const SIGNING_SECRET =
+ process.env.SLACK_SIGNING_SECRET ?? "test-signing-secret";
+
+process.env.SLACK_SIGNING_SECRET = SIGNING_SECRET;
+process.env.SLACK_CLIENT_ID = "test-client-id";
+process.env.SLACK_CLIENT_SECRET = "test-client-secret";
+process.env.NODE_ENV = "development";
+
+function createTestApp() {
+ const app = new Hono();
+ app.get("/slack/install", handleSlackInstall);
+ app.get("/slack/oauth/callback", handleSlackOAuthCallback);
+ return app;
+}
+
+function signToken(data: { workspaceId: number; ts: number }): string {
+ const payload = JSON.stringify(data);
+ const signature = crypto
+ .createHmac("sha256", SIGNING_SECRET)
+ .update(payload)
+ .digest("hex");
+ return Buffer.from(`${payload}.${signature}`).toString("base64url");
+}
+
+function encodeState(state: { workspaceId: number; ts: number }): string {
+ return signToken(state);
+}
+
+function makeInstallToken(workspaceId: number): string {
+ return signToken({ workspaceId, ts: Date.now() });
+}
+
+describe("handleSlackInstall", () => {
+ const app = createTestApp();
+
+ test("redirects to Slack OAuth URL with correct params", async () => {
+ const token = makeInstallToken(1);
+ const res = await app.request(`/slack/install?token=${token}`);
+
+ expect(res.status).toBe(302);
+ const location = res.headers.get("location");
+ expect(location).toBeDefined();
+ expect(location).toContain("https://slack.com/oauth/v2/authorize");
+ expect(location).toContain("client_id=test-client-id");
+ expect(location).toContain("scope=");
+ expect(location).toContain("state=");
+ expect(location).toContain("redirect_uri=");
+ });
+
+ test("returns 400 when token is missing", async () => {
+ const res = await app.request("/slack/install");
+
+ expect(res.status).toBe(400);
+ const json = (await res.json()) as { error: string };
+ expect(json.error).toBe("token is required");
+ });
+
+ test("returns 403 for invalid token", async () => {
+ const res = await app.request("/slack/install?token=invalid-token");
+
+ expect(res.status).toBe(403);
+ const json = (await res.json()) as { error: string };
+ expect(json.error).toBe("Invalid or expired token");
+ });
+
+ test("returns 403 for expired token", async () => {
+ const expired = signToken({
+ workspaceId: 1,
+ ts: Date.now() - 10 * 60 * 1000,
+ });
+ const res = await app.request(`/slack/install?token=${expired}`);
+
+ expect(res.status).toBe(403);
+ const json = (await res.json()) as { error: string };
+ expect(json.error).toBe("Invalid or expired token");
+ });
+
+ test("includes all required bot scopes", async () => {
+ const token = makeInstallToken(1);
+ const res = await app.request(`/slack/install?token=${token}`);
+ const location = res.headers.get("location");
+ expect(location).toBeDefined();
+ const url = new URL(location as string);
+ const scope = url.searchParams.get("scope");
+
+ const expectedScopes = [
+ "app_mentions:read",
+ "channels:history",
+ "chat:write",
+ "groups:history",
+ "im:history",
+ "im:read",
+ "im:write",
+ "mpim:history",
+ ];
+
+ for (const s of expectedScopes) {
+ expect(scope).toContain(s);
+ }
+ });
+
+ test("state contains signed workspaceId", async () => {
+ const token = makeInstallToken(42);
+ const res = await app.request(`/slack/install?token=${token}`);
+ const location = res.headers.get("location");
+ expect(location).toBeDefined();
+ const url = new URL(location as string);
+ const state = url.searchParams.get("state");
+ expect(state).toBeDefined();
+
+ const decoded = Buffer.from(state as string, "base64url").toString();
+ const dotIdx = decoded.lastIndexOf(".");
+ const payload = JSON.parse(decoded.slice(0, dotIdx));
+
+ expect(payload.workspaceId).toBe(42);
+ expect(payload.ts).toBeGreaterThan(0);
+ });
+});
+
+describe("handleSlackOAuthCallback", () => {
+ const app = createTestApp();
+
+ test("redirects to error page on Slack error", async () => {
+ const res = await app.request("/slack/oauth/callback?error=access_denied");
+
+ expect(res.status).toBe(302);
+ const location = res.headers.get("location");
+ expect(location).toContain("slack=error");
+ });
+
+ test("returns 400 when code is missing", async () => {
+ const state = encodeState({ workspaceId: 1, ts: Date.now() });
+ const res = await app.request(`/slack/oauth/callback?state=${state}`);
+
+ expect(res.status).toBe(400);
+ });
+
+ test("returns 400 when state is missing", async () => {
+ const res = await app.request("/slack/oauth/callback?code=test-code");
+
+ expect(res.status).toBe(400);
+ });
+
+ test("returns 400 for expired state", async () => {
+ const expiredState = encodeState({
+ workspaceId: 1,
+ ts: Date.now() - 15 * 60 * 1000,
+ });
+ const res = await app.request(
+ `/slack/oauth/callback?code=test-code&state=${expiredState}`,
+ );
+
+ expect(res.status).toBe(400);
+ const json = (await res.json()) as { error: string };
+ expect(json.error).toBe("Invalid or expired state");
+ });
+
+ test("returns 400 for tampered state", async () => {
+ const payload = JSON.stringify({ workspaceId: 1, ts: Date.now() });
+ const tamperedState = Buffer.from(`${payload}.invalidsignature`).toString(
+ "base64url",
+ );
+ const res = await app.request(
+ `/slack/oauth/callback?code=test-code&state=${tamperedState}`,
+ );
+
+ expect(res.status).toBe(400);
+ const json = (await res.json()) as { error: string };
+ expect(json.error).toBe("Invalid or expired state");
+ });
+
+ test("returns 400 for invalid base64 state", async () => {
+ const res = await app.request(
+ "/slack/oauth/callback?code=test-code&state=not-valid-base64!!!",
+ );
+
+ expect(res.status).toBe(400);
+ });
+
+ test("returns 400 for state without dot separator", async () => {
+ const noDotState = Buffer.from("nodothere").toString("base64url");
+ const res = await app.request(
+ `/slack/oauth/callback?code=test-code&state=${noDotState}`,
+ );
+
+ expect(res.status).toBe(400);
+ });
+
+ test("returns 400 for state with valid signature but invalid JSON", async () => {
+ const payload = "not-json";
+ const signature = crypto
+ .createHmac("sha256", SIGNING_SECRET)
+ .update(payload)
+ .digest("hex");
+ const state = Buffer.from(`${payload}.${signature}`).toString("base64url");
+
+ const res = await app.request(
+ `/slack/oauth/callback?code=test-code&state=${state}`,
+ );
+
+ expect(res.status).toBe(400);
+ });
+
+ test("returns 400 when both code and state are missing", async () => {
+ const res = await app.request("/slack/oauth/callback");
+ expect(res.status).toBe(400);
+ });
+
+ test("accepts state within 10 minute window", async () => {
+ const validState = encodeState({
+ workspaceId: 1,
+ ts: Date.now() - 9 * 60 * 1000,
+ });
+ // This will proceed to the token exchange which will fail (no mock for fetch)
+ // but it won't fail on state validation
+ const res = await app.request(
+ `/slack/oauth/callback?code=test-code&state=${validState}`,
+ );
+
+ // Will get a redirect to error page because token exchange fails,
+ // but NOT a 400 for invalid state
+ expect(res.status).not.toBe(400);
+ });
+});
diff --git a/apps/server/src/routes/slack/oauth.ts b/apps/server/src/routes/slack/oauth.ts
new file mode 100644
index 000000000..c3bd8c87a
--- /dev/null
+++ b/apps/server/src/routes/slack/oauth.ts
@@ -0,0 +1,222 @@
+import crypto from "node:crypto";
+import { env } from "@/env";
+import { and, db, eq } from "@openstatus/db";
+import { integration } from "@openstatus/db/src/schema";
+import type { Context } from "hono";
+
+const SLACK_OAUTH_URL = "https://slack.com/oauth/v2/authorize";
+const SLACK_TOKEN_URL = "https://slack.com/api/oauth.v2.access";
+
+const BOT_SCOPES = [
+ "app_mentions:read",
+ "channels:history",
+ "chat:write",
+ "groups:history",
+ "im:history",
+ "im:read",
+ "im:write",
+ "mpim:history",
+].join(",");
+
+interface OAuthState {
+ workspaceId: number;
+ ts: number;
+}
+
+interface SlackOAuthResponse {
+ ok: boolean;
+ error?: string;
+ access_token: string;
+ token_type: string;
+ scope: string;
+ bot_user_id: string;
+ app_id: string;
+ team: { id: string; name: string };
+ authed_user: { id: string };
+ enterprise?: { id: string; name: string } | null;
+}
+
+export async function handleSlackInstall(c: Context) {
+ const token = c.req.query("token");
+ if (!token) {
+ return c.json({ error: "token is required" }, 400);
+ }
+
+ const installPayload = verifyInstallToken(token);
+ if (!installPayload) {
+ return c.json({ error: "Invalid or expired token" }, 403);
+ }
+
+ if (!env.SLACK_CLIENT_ID) {
+ return c.json({ error: "Slack OAuth not configured" }, 503);
+ }
+
+ const state = encodeState({
+ workspaceId: installPayload.workspaceId,
+ ts: Date.now(),
+ });
+
+ const params = new URLSearchParams({
+ client_id: env.SLACK_CLIENT_ID,
+ scope: BOT_SCOPES,
+ redirect_uri: getRedirectUri(c),
+ state,
+ });
+
+ return c.redirect(`${SLACK_OAUTH_URL}?${params.toString()}`);
+}
+
+export async function handleSlackOAuthCallback(c: Context) {
+ const code = c.req.query("code");
+ const stateParam = c.req.query("state");
+ const error = c.req.query("error");
+
+ if (error) {
+ return c.redirect(`${getDashboardUrl()}/settings/integrations?slack=error`);
+ }
+
+ if (!code || !stateParam) {
+ return c.json({ error: "Missing code or state" }, 400);
+ }
+
+ const state = decodeState(stateParam);
+ if (!state || Date.now() - state.ts > 10 * 60 * 1000) {
+ return c.json({ error: "Invalid or expired state" }, 400);
+ }
+
+ if (!env.SLACK_CLIENT_ID || !env.SLACK_CLIENT_SECRET) {
+ return c.json({ error: "Slack OAuth not configured" }, 503);
+ }
+
+ const tokenRes = await fetch(SLACK_TOKEN_URL, {
+ method: "POST",
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
+ body: new URLSearchParams({
+ client_id: env.SLACK_CLIENT_ID,
+ client_secret: env.SLACK_CLIENT_SECRET,
+ code,
+ redirect_uri: getRedirectUri(c),
+ }),
+ });
+
+ const tokenData = (await tokenRes.json()) as SlackOAuthResponse;
+ if (!tokenData.ok) {
+ console.error("[slack oauth] token exchange failed:", tokenData.error);
+ return c.redirect(`${getDashboardUrl()}/settings/integrations?slack=error`);
+ }
+
+ const credential = {
+ botToken: tokenData.access_token,
+ botUserId: tokenData.bot_user_id,
+ };
+
+ const data = {
+ teamId: tokenData.team.id,
+ teamName: tokenData.team.name,
+ appId: tokenData.app_id,
+ scopes: tokenData.scope,
+ installedBy: tokenData.authed_user.id,
+ };
+
+ const existing = await db
+ .select()
+ .from(integration)
+ .where(
+ and(
+ eq(integration.name, "slack-agent"),
+ eq(integration.workspaceId, state.workspaceId),
+ ),
+ )
+ .get();
+
+ if (existing) {
+ await db
+ .update(integration)
+ .set({
+ externalId: tokenData.team.id,
+ credential,
+ data,
+ updatedAt: new Date(),
+ })
+ .where(eq(integration.id, existing.id));
+ } else {
+ await db.insert(integration).values({
+ name: "slack-agent",
+ workspaceId: state.workspaceId,
+ externalId: tokenData.team.id,
+ credential,
+ data,
+ });
+ }
+
+ return c.redirect(`${getDashboardUrl()}/settings/integrations?slack=success`);
+}
+
+function getRedirectUri(c: Context): string {
+ if (env.SLACK_REDIRECT_URI) return env.SLACK_REDIRECT_URI;
+ const url = new URL(c.req.url);
+ return `${url.origin}/slack/oauth/callback`;
+}
+
+function getDashboardUrl(): string {
+ return env.NODE_ENV === "production"
+ ? "https://app.openstatus.dev"
+ : "http://localhost:3000";
+}
+
+function encodeState(state: OAuthState): string {
+ const payload = JSON.stringify(state);
+ const signature = computeHmac(payload);
+ return Buffer.from(`${payload}.${signature}`).toString("base64url");
+}
+
+function decodeState(encoded: string): OAuthState | null {
+ try {
+ const decoded = Buffer.from(encoded, "base64url").toString();
+ const dotIdx = decoded.lastIndexOf(".");
+ if (dotIdx === -1) return null;
+
+ const payload = decoded.slice(0, dotIdx);
+ const signature = decoded.slice(dotIdx + 1);
+
+ if (!verifyHmac(payload, signature)) return null;
+
+ return JSON.parse(payload) as OAuthState;
+ } catch {
+ return null;
+ }
+}
+
+function computeHmac(payload: string): string {
+ const secret = env.SLACK_SIGNING_SECRET;
+ if (!secret) throw new Error("Slack signing secret not configured");
+ return crypto.createHmac("sha256", secret).update(payload).digest("hex");
+}
+
+function verifyHmac(payload: string, signature: string): boolean {
+ const expected = computeHmac(payload);
+ if (expected.length !== signature.length) return false;
+ return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(signature));
+}
+
+const INSTALL_TOKEN_TTL_MS = 5 * 60 * 1000;
+
+function verifyInstallToken(token: string): { workspaceId: number } | null {
+ try {
+ const decoded = Buffer.from(token, "base64url").toString();
+ const dotIdx = decoded.lastIndexOf(".");
+ if (dotIdx === -1) return null;
+
+ const payload = decoded.slice(0, dotIdx);
+ const signature = decoded.slice(dotIdx + 1);
+
+ if (!verifyHmac(payload, signature)) return null;
+
+ const data = JSON.parse(payload) as { workspaceId: number; ts: number };
+ if (Date.now() - data.ts > INSTALL_TOKEN_TTL_MS) return null;
+
+ return { workspaceId: data.workspaceId };
+ } catch {
+ return null;
+ }
+}
diff --git a/apps/server/src/routes/slack/tools/add-status-report-update.ts b/apps/server/src/routes/slack/tools/add-status-report-update.ts
new file mode 100644
index 000000000..631f708c4
--- /dev/null
+++ b/apps/server/src/routes/slack/tools/add-status-report-update.ts
@@ -0,0 +1,21 @@
+import { tool } from "ai";
+import { z } from "zod";
+
+export function createAddStatusReportUpdateTool() {
+ return tool({
+ description:
+ "Add a progress update to an existing status report. This creates a new update entry and changes the report's status. Use for progress updates and resolving incidents.",
+ inputSchema: z.object({
+ statusReportId: z.number().describe("ID of the status report to update"),
+ status: z
+ .enum(["investigating", "identified", "monitoring", "resolved"])
+ .describe("New status for the report"),
+ message: z
+ .string()
+ .describe("Professional update message for the public status page"),
+ }),
+ execute: async (input) => {
+ return { needsConfirmation: true as const, params: input };
+ },
+ });
+}
diff --git a/apps/server/src/routes/slack/tools/create-status-report.ts b/apps/server/src/routes/slack/tools/create-status-report.ts
new file mode 100644
index 000000000..ab321c8cd
--- /dev/null
+++ b/apps/server/src/routes/slack/tools/create-status-report.ts
@@ -0,0 +1,28 @@
+import { tool } from "ai";
+import { z } from "zod";
+
+export function createCreateStatusReportTool() {
+ return tool({
+ description:
+ "Create a new status report. Draft the title and message based on the conversation. The report will be shown to the user for confirmation before publishing.",
+ inputSchema: z.object({
+ title: z.string().describe("Short title for the status report"),
+ status: z
+ .enum(["investigating", "identified", "monitoring", "resolved"])
+ .describe("Current status of the incident"),
+ message: z
+ .string()
+ .describe(
+ "Professional status update message for the public status page",
+ ),
+ pageId: z.number().describe("ID of the status page to post on"),
+ pageComponentIds: z
+ .array(z.string())
+ .optional()
+ .describe("IDs of affected page components (optional)"),
+ }),
+ execute: async (input) => {
+ return { needsConfirmation: true as const, params: input };
+ },
+ });
+}
diff --git a/apps/server/src/routes/slack/tools/index.ts b/apps/server/src/routes/slack/tools/index.ts
new file mode 100644
index 000000000..360f3a39d
--- /dev/null
+++ b/apps/server/src/routes/slack/tools/index.ts
@@ -0,0 +1,18 @@
+import type { Workspace } from "@openstatus/db/src/schema/workspaces/validation";
+import { createAddStatusReportUpdateTool } from "./add-status-report-update";
+import { createCreateStatusReportTool } from "./create-status-report";
+import { createListStatusPagesTool } from "./list-status-pages";
+import { createListStatusReportsTool } from "./list-status-reports";
+import { createResolveStatusReportTool } from "./resolve-status-report";
+import { createUpdateStatusReportTool } from "./update-status-report";
+
+export function createTools(workspace: Workspace) {
+ return {
+ listStatusPages: createListStatusPagesTool(workspace.id),
+ listStatusReports: createListStatusReportsTool(workspace.id),
+ createStatusReport: createCreateStatusReportTool(),
+ addStatusReportUpdate: createAddStatusReportUpdateTool(),
+ updateStatusReport: createUpdateStatusReportTool(),
+ resolveStatusReport: createResolveStatusReportTool(),
+ };
+}
diff --git a/apps/server/src/routes/slack/tools/list-status-pages.ts b/apps/server/src/routes/slack/tools/list-status-pages.ts
new file mode 100644
index 000000000..be79277cd
--- /dev/null
+++ b/apps/server/src/routes/slack/tools/list-status-pages.ts
@@ -0,0 +1,48 @@
+import { db, eq } from "@openstatus/db";
+import { page, pageComponent } from "@openstatus/db/src/schema";
+import { tool } from "ai";
+import { z } from "zod";
+
+export function createListStatusPagesTool(workspaceId: number) {
+ return tool({
+ description:
+ "List all status pages for this workspace, including their components. Use this to find which page and components to use when creating a status report.",
+ inputSchema: z.object({}),
+ execute: async () => {
+ const pages = await db
+ .select({
+ id: page.id,
+ title: page.title,
+ slug: page.slug,
+ })
+ .from(page)
+ .where(eq(page.workspaceId, workspaceId))
+ .all();
+
+ const result = await Promise.all(
+ pages.map(async (p) => {
+ const components = await db
+ .select({
+ id: pageComponent.id,
+ name: pageComponent.name,
+ })
+ .from(pageComponent)
+ .where(eq(pageComponent.pageId, p.id))
+ .all();
+
+ return {
+ id: p.id,
+ title: p.title,
+ slug: p.slug,
+ components: components.map((c) => ({
+ id: String(c.id),
+ name: c.name,
+ })),
+ };
+ }),
+ );
+
+ return { pages: result };
+ },
+ });
+}
diff --git a/apps/server/src/routes/slack/tools/list-status-reports.ts b/apps/server/src/routes/slack/tools/list-status-reports.ts
new file mode 100644
index 000000000..97f1f6d2d
--- /dev/null
+++ b/apps/server/src/routes/slack/tools/list-status-reports.ts
@@ -0,0 +1,65 @@
+import { and, db, desc, eq, ne } from "@openstatus/db";
+import { statusReport, statusReportUpdate } from "@openstatus/db/src/schema";
+import { tool } from "ai";
+import { z } from "zod";
+
+export function createListStatusReportsTool(workspaceId: number) {
+ return tool({
+ description:
+ "List status reports for this workspace. By default returns only active (non-resolved) reports. Use this to find existing reports when adding updates or editing.",
+ inputSchema: z.object({
+ filter: z
+ .enum(["active", "all"])
+ .optional()
+ .describe(
+ "Filter: 'active' for non-resolved reports (default), 'all' for everything",
+ ),
+ }),
+ execute: async ({ filter = "active" }) => {
+ const conditions = [eq(statusReport.workspaceId, workspaceId)];
+ if (filter === "active") {
+ conditions.push(ne(statusReport.status, "resolved"));
+ }
+
+ const reports = await db
+ .select()
+ .from(statusReport)
+ .where(and(...conditions))
+ .orderBy(desc(statusReport.updatedAt))
+ .limit(20)
+ .all();
+
+ const result = await Promise.all(
+ reports.map(async (r) => {
+ const latestUpdate = await db
+ .select({
+ message: statusReportUpdate.message,
+ status: statusReportUpdate.status,
+ date: statusReportUpdate.date,
+ })
+ .from(statusReportUpdate)
+ .where(eq(statusReportUpdate.statusReportId, r.id))
+ .orderBy(desc(statusReportUpdate.date))
+ .limit(1)
+ .get();
+
+ return {
+ id: r.id,
+ title: r.title,
+ status: r.status,
+ pageId: r.pageId,
+ latestUpdate: latestUpdate
+ ? {
+ message: latestUpdate.message,
+ status: latestUpdate.status,
+ date: latestUpdate.date?.toISOString() ?? null,
+ }
+ : null,
+ };
+ }),
+ );
+
+ return { reports: result };
+ },
+ });
+}
diff --git a/apps/server/src/routes/slack/tools/resolve-status-report.ts b/apps/server/src/routes/slack/tools/resolve-status-report.ts
new file mode 100644
index 000000000..81428c602
--- /dev/null
+++ b/apps/server/src/routes/slack/tools/resolve-status-report.ts
@@ -0,0 +1,20 @@
+import { tool } from "ai";
+import { z } from "zod";
+
+export function createResolveStatusReportTool() {
+ return tool({
+ description:
+ "Resolve an active status report. This marks the incident as resolved and adds a final update message to the public status page.",
+ inputSchema: z.object({
+ statusReportId: z.number().describe("ID of the status report to resolve"),
+ message: z
+ .string()
+ .describe(
+ "Resolution message explaining what was fixed, for the public status page",
+ ),
+ }),
+ execute: async (input) => {
+ return { needsConfirmation: true as const, params: input };
+ },
+ });
+}
diff --git a/apps/server/src/routes/slack/tools/tools.test.ts b/apps/server/src/routes/slack/tools/tools.test.ts
new file mode 100644
index 000000000..d935361cc
--- /dev/null
+++ b/apps/server/src/routes/slack/tools/tools.test.ts
@@ -0,0 +1,142 @@
+import { describe, expect, test } from "bun:test";
+import type { Workspace } from "@openstatus/db/src/schema/workspaces/validation";
+import { createAddStatusReportUpdateTool } from "./add-status-report-update";
+import { createCreateStatusReportTool } from "./create-status-report";
+import { createTools } from "./index";
+import { createUpdateStatusReportTool } from "./update-status-report";
+
+const mockWorkspace = {
+ id: 1,
+ name: "Test",
+ slug: "test",
+ plan: "free",
+ limits: {},
+} as Workspace;
+
+describe("createTools", () => {
+ test("returns all expected tool keys", () => {
+ const tools = createTools(mockWorkspace);
+ expect(Object.keys(tools).sort()).toEqual([
+ "addStatusReportUpdate",
+ "createStatusReport",
+ "listStatusPages",
+ "listStatusReports",
+ "resolveStatusReport",
+ "updateStatusReport",
+ ]);
+ });
+});
+
+describe("createCreateStatusReportTool", () => {
+ const tool = createCreateStatusReportTool();
+
+ test("returns needsConfirmation with params", async () => {
+ const input = {
+ title: "API Outage",
+ status: "investigating" as const,
+ message: "We are investigating the issue",
+ pageId: 1,
+ };
+ const result = await tool.execute(input, {
+ toolCallId: "test",
+ messages: [],
+ });
+ expect(result).toEqual({ needsConfirmation: true, params: input });
+ });
+
+ test("includes optional pageComponentIds", async () => {
+ const input = {
+ title: "Outage",
+ status: "investigating" as const,
+ message: "msg",
+ pageId: 1,
+ pageComponentIds: ["comp-1", "comp-2"],
+ };
+ const result = await tool.execute(input, {
+ toolCallId: "test",
+ messages: [],
+ });
+ expect(result.params.pageComponentIds).toEqual(["comp-1", "comp-2"]);
+ });
+});
+
+describe("createAddStatusReportUpdateTool", () => {
+ const tool = createAddStatusReportUpdateTool();
+
+ test("returns needsConfirmation with params", async () => {
+ const input = {
+ statusReportId: 42,
+ status: "identified" as const,
+ message: "Root cause identified",
+ };
+ const result = await tool.execute(input, {
+ toolCallId: "test",
+ messages: [],
+ });
+ expect(result).toEqual({ needsConfirmation: true, params: input });
+ });
+
+ test("works with resolved status", async () => {
+ const input = {
+ statusReportId: 42,
+ status: "resolved" as const,
+ message: "Issue has been fixed",
+ };
+ const result = await tool.execute(input, {
+ toolCallId: "test",
+ messages: [],
+ });
+ expect(result.params.status).toBe("resolved");
+ });
+});
+
+describe("createUpdateStatusReportTool", () => {
+ const tool = createUpdateStatusReportTool();
+
+ test("returns needsConfirmation with title update", async () => {
+ const input = {
+ statusReportId: 10,
+ title: "Updated Title",
+ };
+ const result = await tool.execute(input, {
+ toolCallId: "test",
+ messages: [],
+ });
+ expect(result).toEqual({ needsConfirmation: true, params: input });
+ });
+
+ test("works with only pageComponentIds", async () => {
+ const input = {
+ statusReportId: 10,
+ pageComponentIds: ["comp-1"],
+ };
+ const result = await tool.execute(input, {
+ toolCallId: "test",
+ messages: [],
+ });
+ expect(result.params.pageComponentIds).toEqual(["comp-1"]);
+ });
+
+ test("works with both title and components", async () => {
+ const input = {
+ statusReportId: 10,
+ title: "New Title",
+ pageComponentIds: ["comp-1", "comp-2"],
+ };
+ const result = await tool.execute(input, {
+ toolCallId: "test",
+ messages: [],
+ });
+ expect(result.params.title).toBe("New Title");
+ expect(result.params.pageComponentIds).toEqual(["comp-1", "comp-2"]);
+ });
+
+ test("works with only statusReportId", async () => {
+ const input = { statusReportId: 10 };
+ const result = await tool.execute(input, {
+ toolCallId: "test",
+ messages: [],
+ });
+ expect(result.params.statusReportId).toBe(10);
+ });
+});
diff --git a/apps/server/src/routes/slack/tools/update-status-report.ts b/apps/server/src/routes/slack/tools/update-status-report.ts
new file mode 100644
index 000000000..6ce626360
--- /dev/null
+++ b/apps/server/src/routes/slack/tools/update-status-report.ts
@@ -0,0 +1,20 @@
+import { tool } from "ai";
+import { z } from "zod";
+
+export function createUpdateStatusReportTool() {
+ return tool({
+ description:
+ "Edit a status report's metadata (title, components). This does NOT add a new update message — use addStatusReportUpdate for that. No subscriber notifications are sent.",
+ inputSchema: z.object({
+ statusReportId: z.number().describe("ID of the status report to edit"),
+ title: z.string().optional().describe("New title for the report"),
+ pageComponentIds: z
+ .array(z.string())
+ .optional()
+ .describe("Updated list of affected component IDs"),
+ }),
+ execute: async (input) => {
+ return { needsConfirmation: true as const, params: input };
+ },
+ });
+}
diff --git a/apps/server/src/routes/slack/verify.test.ts b/apps/server/src/routes/slack/verify.test.ts
new file mode 100644
index 000000000..31ab030bb
--- /dev/null
+++ b/apps/server/src/routes/slack/verify.test.ts
@@ -0,0 +1,248 @@
+import { describe, expect, test } from "bun:test";
+import crypto from "node:crypto";
+import { Hono } from "hono";
+import { verifySlackSignature } from "./verify";
+
+const SIGNING_SECRET = "test-signing-secret";
+process.env.SLACK_SIGNING_SECRET = SIGNING_SECRET;
+
+function signRequest(body: string, timestamp: number): string {
+ const basestring = `v0:${timestamp}:${body}`;
+ const hmac = crypto
+ .createHmac("sha256", SIGNING_SECRET)
+ .update(basestring)
+ .digest("hex");
+ return `v0=${hmac}`;
+}
+
+function createTestApp() {
+ const app = new Hono<{ Variables: { slackBody: unknown } }>();
+ app.post("/test", verifySlackSignature, (c) => {
+ return c.json({ body: c.get("slackBody") });
+ });
+ return app;
+}
+
+describe("verifySlackSignature", () => {
+ const app = createTestApp();
+
+ test("accepts valid JSON signature", async () => {
+ const body = JSON.stringify({ type: "event_callback", event: {} });
+ const timestamp = Math.floor(Date.now() / 1000);
+ const signature = signRequest(body, timestamp);
+
+ const res = await app.request("/test", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ "x-slack-request-timestamp": String(timestamp),
+ "x-slack-signature": signature,
+ },
+ body,
+ });
+
+ expect(res.status).toBe(200);
+ const json = (await res.json()) as { body: { type: string } };
+ expect(json.body.type).toBe("event_callback");
+ });
+
+ test("accepts valid form-urlencoded payload", async () => {
+ const payload = JSON.stringify({
+ type: "block_actions",
+ user: { id: "U1" },
+ });
+ const body = `payload=${encodeURIComponent(payload)}`;
+ const timestamp = Math.floor(Date.now() / 1000);
+ const signature = signRequest(body, timestamp);
+
+ const res = await app.request("/test", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/x-www-form-urlencoded",
+ "x-slack-request-timestamp": String(timestamp),
+ "x-slack-signature": signature,
+ },
+ body,
+ });
+
+ expect(res.status).toBe(200);
+ const json = (await res.json()) as { body: { type: string } };
+ expect(json.body.type).toBe("block_actions");
+ });
+
+ test("rejects missing headers", async () => {
+ const res = await app.request("/test", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: "{}",
+ });
+
+ expect(res.status).toBe(401);
+ });
+
+ test("rejects old timestamp", async () => {
+ const body = "{}";
+ const timestamp = Math.floor(Date.now() / 1000) - 600;
+ const signature = signRequest(body, timestamp);
+
+ const res = await app.request("/test", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ "x-slack-request-timestamp": String(timestamp),
+ "x-slack-signature": signature,
+ },
+ body,
+ });
+
+ expect(res.status).toBe(401);
+ });
+
+ test("rejects invalid signature", async () => {
+ const body = "{}";
+ const timestamp = Math.floor(Date.now() / 1000);
+
+ const res = await app.request("/test", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ "x-slack-request-timestamp": String(timestamp),
+ "x-slack-signature":
+ "v0=invalidsignature000000000000000000000000000000000000000000000000",
+ },
+ body,
+ });
+
+ expect(res.status).toBe(401);
+ });
+
+ test("rejects signature with wrong length", async () => {
+ const body = "{}";
+ const timestamp = Math.floor(Date.now() / 1000);
+
+ const res = await app.request("/test", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ "x-slack-request-timestamp": String(timestamp),
+ "x-slack-signature": "v0=short",
+ },
+ body,
+ });
+
+ expect(res.status).toBe(401);
+ });
+
+ test("rejects missing timestamp header only", async () => {
+ const body = "{}";
+ const res = await app.request("/test", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ "x-slack-signature": "v0=abc",
+ },
+ body,
+ });
+ expect(res.status).toBe(401);
+ });
+
+ test("rejects missing signature header only", async () => {
+ const body = "{}";
+ const timestamp = Math.floor(Date.now() / 1000);
+ const res = await app.request("/test", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ "x-slack-request-timestamp": String(timestamp),
+ },
+ body,
+ });
+ expect(res.status).toBe(401);
+ });
+
+ test("rejects future timestamp beyond 5 minutes", async () => {
+ const body = "{}";
+ const timestamp = Math.floor(Date.now() / 1000) + 600;
+ const signature = signRequest(body, timestamp);
+
+ const res = await app.request("/test", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ "x-slack-request-timestamp": String(timestamp),
+ "x-slack-signature": signature,
+ },
+ body,
+ });
+ expect(res.status).toBe(401);
+ });
+
+ test("accepts timestamp within 5 minute window", async () => {
+ const body = JSON.stringify({ type: "test" });
+ const timestamp = Math.floor(Date.now() / 1000) - 200;
+ const signature = signRequest(body, timestamp);
+
+ const res = await app.request("/test", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ "x-slack-request-timestamp": String(timestamp),
+ "x-slack-signature": signature,
+ },
+ body,
+ });
+ expect(res.status).toBe(200);
+ });
+
+ test("rejects signature computed with wrong body", async () => {
+ const body = JSON.stringify({ type: "real_body" });
+ const timestamp = Math.floor(Date.now() / 1000);
+ const wrongSignature = signRequest("different body", timestamp);
+
+ const res = await app.request("/test", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ "x-slack-request-timestamp": String(timestamp),
+ "x-slack-signature": wrongSignature,
+ },
+ body,
+ });
+ expect(res.status).toBe(401);
+ });
+
+ test("handles form-urlencoded without payload param", async () => {
+ const body = "key=value";
+ const timestamp = Math.floor(Date.now() / 1000);
+ const signature = signRequest(body, timestamp);
+
+ const res = await app.request("/test", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/x-www-form-urlencoded",
+ "x-slack-request-timestamp": String(timestamp),
+ "x-slack-signature": signature,
+ },
+ body,
+ });
+ expect(res.status).toBe(200);
+ });
+
+ test("handles large JSON payload", async () => {
+ const largePayload = { type: "test", data: "x".repeat(10000) };
+ const body = JSON.stringify(largePayload);
+ const timestamp = Math.floor(Date.now() / 1000);
+ const signature = signRequest(body, timestamp);
+
+ const res = await app.request("/test", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ "x-slack-request-timestamp": String(timestamp),
+ "x-slack-signature": signature,
+ },
+ body,
+ });
+ expect(res.status).toBe(200);
+ });
+});
diff --git a/apps/server/src/routes/slack/verify.ts b/apps/server/src/routes/slack/verify.ts
new file mode 100644
index 000000000..273ea1038
--- /dev/null
+++ b/apps/server/src/routes/slack/verify.ts
@@ -0,0 +1,65 @@
+import { env } from "@/env";
+import { createMiddleware } from "hono/factory";
+
+export const verifySlackSignature = createMiddleware<{
+ Variables: { slackBody: unknown };
+}>(async (c, next) => {
+ const signingSecret = env.SLACK_SIGNING_SECRET;
+
+ if (!signingSecret) {
+ return c.json({ error: "Slack not configured" }, 503);
+ }
+
+ const timestamp = c.req.header("x-slack-request-timestamp");
+ const signature = c.req.header("x-slack-signature");
+
+ if (!timestamp || !signature) {
+ return c.json({ error: "Missing Slack headers" }, 401);
+ }
+
+ const now = Math.floor(Date.now() / 1000);
+ if (Math.abs(now - Number(timestamp)) > 300) {
+ return c.json({ error: "Request too old" }, 401);
+ }
+
+ const rawBody = await c.req.text();
+
+ const encoder = new TextEncoder();
+ const basestring = `v0:${timestamp}:${rawBody}`;
+ const key = await crypto.subtle.importKey(
+ "raw",
+ encoder.encode(signingSecret),
+ { name: "HMAC", hash: "SHA-256" },
+ false,
+ ["sign"],
+ );
+ const sig = await crypto.subtle.sign("HMAC", key, encoder.encode(basestring));
+ const computed = `v0=${Array.from(new Uint8Array(sig))
+ .map((b) => b.toString(16).padStart(2, "0"))
+ .join("")}`;
+
+ if (computed.length !== signature.length) {
+ return c.json({ error: "Invalid signature" }, 401);
+ }
+
+ const a = encoder.encode(computed);
+ const b = encoder.encode(signature);
+ let mismatch = 0;
+ for (let i = 0; i < a.length; i++) {
+ mismatch |= a[i] ^ b[i];
+ }
+ if (mismatch !== 0) {
+ return c.json({ error: "Invalid signature" }, 401);
+ }
+
+ const contentType = c.req.header("content-type") ?? "";
+ if (contentType.includes("application/json")) {
+ c.set("slackBody", JSON.parse(rawBody));
+ } else if (contentType.includes("application/x-www-form-urlencoded")) {
+ const params = new URLSearchParams(rawBody);
+ const payload = params.get("payload");
+ c.set("slackBody", payload ? JSON.parse(payload) : {});
+ }
+
+ await next();
+});
diff --git a/apps/server/src/routes/slack/workspace-resolver.ts b/apps/server/src/routes/slack/workspace-resolver.ts
new file mode 100644
index 000000000..750110ca5
--- /dev/null
+++ b/apps/server/src/routes/slack/workspace-resolver.ts
@@ -0,0 +1,58 @@
+import { and, db, eq } from "@openstatus/db";
+import {
+ integration,
+ selectWorkspaceSchema,
+ workspace,
+} from "@openstatus/db/src/schema";
+import type { Workspace } from "@openstatus/db/src/schema/workspaces/validation";
+
+export interface SlackWorkspace {
+ workspace: Workspace;
+ botToken: string;
+ botUserId: string;
+}
+
+interface IntegrationCredential {
+ botToken: string;
+ botUserId: string;
+}
+
+export async function resolveWorkspace(
+ teamId: string,
+): Promise<SlackWorkspace | null> {
+ const row = await db
+ .select({
+ workspaceId: integration.workspaceId,
+ credential: integration.credential,
+ })
+ .from(integration)
+ .where(
+ and(
+ eq(integration.name, "slack-agent"),
+ eq(integration.externalId, teamId),
+ ),
+ )
+ .get();
+
+ if (!row?.workspaceId) return null;
+
+ const credential = row.credential as IntegrationCredential | null;
+ if (!credential?.botToken) return null;
+
+ const ws = await db
+ .select()
+ .from(workspace)
+ .where(eq(workspace.id, row.workspaceId))
+ .get();
+
+ if (!ws) return null;
+
+ const parsed = selectWorkspaceSchema.safeParse(ws);
+ if (!parsed.success) return null;
+
+ return {
+ workspace: parsed.data,
+ botToken: credential.botToken,
+ botUserId: credential.botUserId ?? "",
+ };
+}
diff --git a/apps/server/src/routes/v1/check/http/schema.ts b/apps/server/src/routes/v1/check/http/schema.ts
index 92e0eea97..5033a15e8 100644
--- a/apps/server/src/routes/v1/check/http/schema.ts
+++ b/apps/server/src/routes/v1/check/http/schema.ts
@@ -1,4 +1,4 @@
-import { z } from "zod";
+import { z } from "@hono/zod-openapi";
import { MonitorSchema } from "../../monitors/schema";
export const CheckSchema = MonitorSchema.pick({
diff --git a/apps/server/src/routes/v1/monitors/schema.ts b/apps/server/src/routes/v1/monitors/schema.ts
index 851cca0da..ce4202475 100644
--- a/apps/server/src/routes/v1/monitors/schema.ts
+++ b/apps/server/src/routes/v1/monitors/schema.ts
@@ -16,7 +16,7 @@ import { ZodError } from "zod";
const statusAssertion = z
.object({
type: z.literal("status"),
- compare: numberCompare.openapi({
+ compare: z.enum(numberCompare.options).openapi({
description: "Comparison operator",
examples: ["eq", "not_eq", "gt", "gte", "lt", "lte"],
}),
@@ -474,7 +474,7 @@ const dnsRequestSchema = z.object({
const statusCodeAssertion = z
.object({
kind: z.literal("statusCode"),
- compare: numberCompare.openapi({
+ compare: z.enum(numberCompare.options).openapi({
description: "Comparison operator",
examples: ["eq", "not_eq", "gt", "gte", "lt", "lte"],
}),
@@ -505,7 +505,7 @@ const statusCodeAssertion = z
const headerAssertions = z.object({
kind: z.literal("header"),
- compare: stringCompare.openapi({
+ compare: z.enum(stringCompare.options).openapi({
description: "Comparison operator",
examples: ["eq", "not_eq", "contains", "not_contains"],
}),
@@ -521,7 +521,7 @@ const headerAssertions = z.object({
const textBodyAssertions = z.object({
kind: z.literal("textBody"),
- compare: stringCompare.openapi({
+ compare: z.enum(stringCompare.options).openapi({
description: "Comparison operator",
examples: ["eq", "not_eq", "contains", "not_contains"],
}),
@@ -537,7 +537,7 @@ const dnsRecordAssertion = z.object({
description: "Type of DNS record to check",
examples: ["A", "CNAME"],
}),
- compare: recordCompare.openapi({
+ compare: z.enum(recordCompare.options).openapi({
description: "Comparison operator",
examples: ["eq", "not_eq", "contains", "not_contains"],
}),
diff --git a/apps/server/src/routes/v1/notifications/schema.ts b/apps/server/src/routes/v1/notifications/schema.ts
index 0f217d40e..ec19e5c8e 100644
--- a/apps/server/src/routes/v1/notifications/schema.ts
+++ b/apps/server/src/routes/v1/notifications/schema.ts
@@ -1,8 +1,6 @@
import { z } from "@hono/zod-openapi";
-import {
- NotificationDataSchema,
- notificationProviderSchema,
-} from "@openstatus/db/src/schema";
+
+import { notificationProvider } from "@openstatus/db/src/schema/notifications/constants";
export const ParamsSchema = z.object({
id: z
@@ -27,11 +25,11 @@ export const NotificationSchema = z
description: "The name of the notification",
example: "OpenStatus Discord",
}),
- provider: notificationProviderSchema.openapi({
+ provider: z.enum(notificationProvider).openapi({
description: "The provider of the notification",
example: "discord",
}),
- payload: NotificationDataSchema.openapi({
+ payload: z.any().openapi({
description: "The data of the notification",
}),
monitors: z
diff --git a/apps/server/src/routes/v1/statusReports/schema.ts b/apps/server/src/routes/v1/statusReports/schema.ts
index a70286e2d..f17c11769 100644
--- a/apps/server/src/routes/v1/statusReports/schema.ts
+++ b/apps/server/src/routes/v1/statusReports/schema.ts
@@ -1,6 +1,6 @@
import { z } from "@hono/zod-openapi";
-import { statusReportStatusSchema } from "@openstatus/db/src/schema";
+import { statusReportStatus } from "@openstatus/db/src/schema/status_reports/status_reports";
export const ParamsSchema = z.object({
id: z
@@ -23,7 +23,7 @@ export const StatusReportSchema = z
example: "Documenso",
description: "The title of the status report",
}),
- status: statusReportStatusSchema.openapi({
+ status: z.enum(statusReportStatus).openapi({
description: "The current status of the report",
}),
statusReportUpdateIds: z
diff --git a/packages/api/src/router/integration.ts b/packages/api/src/router/integration.ts
index 7ed0434db..fdfafde3e 100644
--- a/packages/api/src/router/integration.ts
+++ b/packages/api/src/router/integration.ts
@@ -1,6 +1,8 @@
+// biome-ignore lint/style/useNodejsImportProtocol: some error with build
+import crypto from "crypto";
import { z } from "zod";
-import { and, eq } from "@openstatus/db";
+import { and, eq, sql } from "@openstatus/db";
import {
insertIntegrationSchema,
integration,
@@ -8,6 +10,23 @@ import {
import { createTRPCRouter, protectedProcedure } from "../trpc";
+function signInstallToken(workspaceId: number, ts: number): string {
+ const secret = process.env.SLACK_SIGNING_SECRET;
+ if (!secret) throw new Error("Slack not configured");
+ const payload = JSON.stringify({ workspaceId, ts });
+ const sig = crypto.createHmac("sha256", secret).update(payload).digest("hex");
+ return Buffer.from(`${payload}.${sig}`).toString("base64url");
+}
+
+function safeJsonParse(value: string | null): Record<string, unknown> {
+ if (!value) return {};
+ try {
+ return JSON.parse(value) as Record<string, unknown>;
+ } catch {
+ return {};
+ }
+}
+
export const integrationRouter = createTRPCRouter({
createIntegration: protectedProcedure
.input(
@@ -34,4 +53,67 @@ export const integrationRouter = createTRPCRouter({
.returning()
.get();
}),
+
+ list: protectedProcedure.query(async (opts) => {
+ const rows = await opts.ctx.db
+ .select({
+ id: integration.id,
+ name: integration.name,
+ externalId: integration.externalId,
+ rawData: sql<string>`${integration.data}`,
+ createdAt: integration.createdAt,
+ })
+ .from(integration)
+ .where(eq(integration.workspaceId, opts.ctx.workspace.id))
+ .all();
+
+ return rows.map((row) => ({
+ id: row.id,
+ name: row.name,
+ externalId: row.externalId,
+ data: safeJsonParse(row.rawData),
+ createdAt: row.createdAt,
+ }));
+ }),
+
+ generateInstallToken: protectedProcedure.mutation(async (opts) => {
+ const token = signInstallToken(opts.ctx.workspace.id, Date.now());
+ return { token };
+ }),
+
+ deleteIntegration: protectedProcedure
+ .input(z.object({ integrationId: z.number() }))
+ .mutation(async (opts) => {
+ const existing = await opts.ctx.db
+ .select()
+ .from(integration)
+ .where(
+ and(
+ eq(integration.id, opts.input.integrationId),
+ eq(integration.workspaceId, opts.ctx.workspace.id),
+ ),
+ )
+ .get();
+
+ if (!existing) return;
+
+ const cred = existing.credential as { botToken?: string } | null;
+ if (cred?.botToken) {
+ try {
+ await fetch("https://slack.com/api/auth.revoke", {
+ method: "POST",
+ headers: {
+ Authorization: `Bearer ${cred.botToken}`,
+ "Content-Type": "application/x-www-form-urlencoded",
+ },
+ });
+ } catch {
+ // Token may already be invalid
+ }
+ }
+
+ await opts.ctx.db
+ .delete(integration)
+ .where(eq(integration.id, existing.id));
+ }),
});
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 5afe11eca..31d4fe69c 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -449,6 +449,9 @@ importers:
apps/server:
dependencies:
+ '@ai-sdk/anthropic':
+ specifier: ^1.2.0
+ version: 1.2.12([email protected])
'@bufbuild/protobuf':
specifier: 2.10.2
version: 2.10.2
@@ -554,6 +557,9 @@ importers:
'@scalar/hono-api-reference':
specifier: 0.8.5
version: 0.8.5([email protected])
+ '@slack/web-api':
+ specifier: ^7.8.0
+ version: 7.14.1
'@t3-oss/env-core':
specifier: 0.13.10
@@ -563,6 +569,9 @@ importers:
'@upstash/qstash':
specifier: 2.6.2
version: 2.6.2
+ ai:
+ specifier: 6.0.94
+ version: 6.0.94([email protected])
hono:
specifier: 4.11.3
version: 4.11.3
@@ -1982,6 +1991,8 @@ importers:
specifier: 5.9.3
version: 5.9.3
+ packages/react/dist: {}
+
packages/regions:
dependencies:
zod:
@@ -2262,6 +2273,38 @@ importers:
packages:
+ '@ai-sdk/[email protected]':
+ resolution: {integrity: sha512-YSzjlko7JvuiyQFmI9RN1tNZdEiZxc+6xld/0tq/VkJaHpEzGAb1yiNxxvmYVcjvfu/PcvCxAAYXmTYQQ63IHQ==}
+ engines: {node: '>=18'}
+ peerDependencies:
+ zod: ^3.0.0
+
+ '@ai-sdk/[email protected]':
+ resolution: {integrity: sha512-lYCXP8T3YnIDiz8DP7loAMT27wnblc3IAYzQ7igg89RCRyTUjk6ffbxHXXQ5Pmv8jrdLF0ZIJnH54Dsr1OCKHg==}
+ engines: {node: '>=18'}
+ peerDependencies:
+ zod: ^3.25.76 || ^4.1.8
+
+ '@ai-sdk/[email protected]':
+ resolution: {integrity: sha512-fqhG+4sCVv8x7nFzYnFo19ryhAa3w096Kmc3hWxMQfW/TubPOmt3A6tYZhl4mUfQWWQMsuSkLrtjlWuXBVSGQA==}
+ engines: {node: '>=18'}
+ peerDependencies:
+ zod: ^3.23.8
+
+ '@ai-sdk/[email protected]':
+ resolution: {integrity: sha512-8XiKWbemmCbvNN0CLR9u3PQiet4gtEVIrX4zzLxnCj06AwsEDJwJVBbKrEI4t6qE8XRSIvU2irka0dcpziKW6w==}
+ engines: {node: '>=18'}
+ peerDependencies:
+ zod: ^3.25.76 || ^4.1.8
+
+ '@ai-sdk/[email protected]':
+ resolution: {integrity: sha512-qZMxYJ0qqX/RfnuIaab+zp8UAeJn/ygXXAffR5I4N0n1IrvA6qBsjc8hXLmBiMV2zoXlifkacF7sEFnYnjBcqg==}
+ engines: {node: '>=18'}
+
+ '@ai-sdk/[email protected]':
+ resolution: {integrity: sha512-oGMAgGoQdBXbZqNG0Ze56CHjDZ1IDYOwGYxYjO5KLSlz5HiNQ9udIXsPZ61VWaHGZ5XW/jyjmr6t2xz2jGVwbQ==}
+ engines: {node: '>=18'}
+
resolution: {integrity: sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==}
engines: {node: '>=10'}
@@ -2555,10 +2598,6 @@ packages:
resolution: {integrity: sha512-VXAq/Jz8KIrU84+HqsOJhIKZqG0PNTdi6n6PFQ4xJf44ZQHD/5C7ouH4qCFX5XgZXcgbRIcMVVYGC6Jye0dRng==}
engines: {node: '>=14.0.0'}
- '@babel/[email protected]':
- resolution: {integrity: sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==}
- engines: {node: '>=6.9.0'}
-
resolution: {integrity: sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw==}
engines: {node: '>=6.9.0'}
@@ -2571,10 +2610,6 @@ packages:
resolution: {integrity: sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==}
engines: {node: '>=6.9.0'}
- '@babel/[email protected]':
- resolution: {integrity: sha512-3EwLFhZ38J4VyIP6WNtt2kUdW9dokXA9Cr4IVIFHuCpZ3H8/YFOl5JjZHisrn1fATPBmKKqXzDFvh9fUwHz6CQ==}
- engines: {node: '>=6.9.0'}
-
resolution: {integrity: sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw==}
engines: {node: '>=6.9.0'}
@@ -2601,20 +2636,10 @@ packages:
resolution: {integrity: sha512-cwM7SBRZcPCLgl8a7cY0soT1SptSzAlMH39vwiRpOQkJlh53r5hdHwLSCZpQdVLT39sZt+CRpNwYG4Y2v77atg==}
engines: {node: '>=6.9.0'}
- '@babel/[email protected]':
- resolution: {integrity: sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w==}
- engines: {node: '>=6.9.0'}
-
resolution: {integrity: sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw==}
engines: {node: '>=6.9.0'}
- '@babel/[email protected]':
- resolution: {integrity: sha512-gytXUbs8k2sXS9PnQptz5o0QnpLL51SwASIORY6XaBKF88nsOT0Zw9szLqlSGQDP/4TljBAD5y98p2U1fqkdsw==}
- engines: {node: '>=6.9.0'}
- peerDependencies:
- '@babel/core': ^7.0.0
-
resolution: {integrity: sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA==}
engines: {node: '>=6.9.0'}
@@ -2625,10 +2650,6 @@ packages:
resolution: {integrity: sha512-URMGH08NzYFhubNSGJrpUEphGKQwMQYBySzat5cAByY1/YgIRkULnIy3tAMeszlL/so2HbeilYloUmSpd7GdVw==}
engines: {node: '>=6.9.0'}
- '@babel/[email protected]':
- resolution: {integrity: sha512-1gn1Up5YXka3YYAHGKpbideQ5Yjf1tDa9qYcgysz+cNCXukyLl6DjPXhD3VRwSb8c0J9tA4b2+rHEZtc6R0tlw==}
- engines: {node: '>=6.9.0'}
-
resolution: {integrity: sha512-S9gzZ/bz83GRysI7gAD4wPT/AI3uCnY+9xn+Mx/KPs2JwHJIz1W8PZkg2cqyt3RNOBM8ejcXhV6y8Og7ly/Dug==}
engines: {node: '>=6.9.0'}
@@ -2659,11 +2680,6 @@ packages:
resolution: {integrity: sha512-HFN59MmQXGHVyYadKLVumYsA9dBFun/ldYxipEjzA4196jpLZd8UjEEBLkbEkvfYreDqJhZxYAWFPtrfhNpj4w==}
engines: {node: '>=6.9.0'}
- '@babel/[email protected]':
- resolution: {integrity: sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ==}
- engines: {node: '>=6.0.0'}
- hasBin: true
-
resolution: {integrity: sha512-IyDgFV5GeDUVX4YdF/3CPULtVGSXXMLh1xVIgdCgxApktqnQV0r7/8Nqthg+8YLGaAtdyIlo2qIdZrbCv4+7ww==}
engines: {node: '>=6.0.0'}
@@ -2719,26 +2735,14 @@ packages:
resolution: {integrity: sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ==}
engines: {node: '>=6.9.0'}
- '@babel/[email protected]':
- resolution: {integrity: sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw==}
- engines: {node: '>=6.9.0'}
-
resolution: {integrity: sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ==}
engines: {node: '>=6.9.0'}
- '@babel/[email protected]':
- resolution: {integrity: sha512-TCCj4t55U90khlYkVV/0TfkJkAkUg3jZFA3Neb7unZT8CPok7iiRfaX0F+WnqWqt7OxhOn0uBKXCw4lbL8W0aQ==}
- engines: {node: '>=6.9.0'}
-
resolution: {integrity: sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA==}
engines: {node: '>=6.9.0'}
- '@babel/[email protected]':
- resolution: {integrity: sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA==}
- engines: {node: '>=6.9.0'}
-
resolution: {integrity: sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==}
engines: {node: '>=6.9.0'}
@@ -6469,6 +6473,18 @@ packages:
resolution: {integrity: sha512-tlqY9xq5ukxTUZBmoOp+m61cqwQD5pHJtFY3Mn8CA8ps6yghLH/Hw8UPdqg4OLmFW3IFlcXnQNmo/dh8HzXYIQ==}
engines: {node: '>=18'}
+ '@slack/[email protected]':
+ resolution: {integrity: sha512-Wz7QYfPAlG/DR+DfABddUZeNgoeY7d1J39OCR2jR+v7VBsB8ezulDK5szTnDDPDwLH5IWhLvXIHlCFZV7MSKgA==}
+ engines: {node: '>= 18', npm: '>= 8.6.0'}
+
+ '@slack/[email protected]':
+ resolution: {integrity: sha512-PVF6P6nxzDMrzPC8fSCsnwaI+kF8YfEpxf3MqXmdyjyWTYsZQURpkK7WWUWvP5QpH55pB7zyYL9Qem/xSgc5VA==}
+ engines: {node: '>= 12.13.0', npm: '>= 6.12.0'}
+
+ '@slack/[email protected]':
+ resolution: {integrity: sha512-RoygyteJeFswxDPJjUMESn9dldWVMD2xUcHHd9DenVavSfVC6FeVnSdDerOO7m8LLvw4Q132nQM4hX8JiF7dng==}
+ engines: {node: '>= 18', npm: '>= 8.6.0'}
+
'@smithy/[email protected]':
resolution: {integrity: sha512-wRlta7GuLWpTqtFfGo+nZyOO1vEvewdNR1R4rTxpC8XU6vG/NDyrFBhwLZsqg1NUoR1noVaXJPC/7ZK47QCySw==}
engines: {node: '>=14.0.0'}
@@ -7192,6 +7208,9 @@ packages:
resolution: {integrity: sha512-FGJ6udDNUCjd19pp0Q3iTiDkwhYup7J8hpMW9c4k53NrccQFFWKRho6hvtPPEhnXWKvukfwAlB6DbDz4yhH5Gg==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==}
+
resolution: {integrity: sha512-l6rX1MUXje5ztPT0cAFtUayXF06DqPhRyfVXareEN5gGCFaP/iwsxIyKODr9XDhfxPpN6vXUFNfo5kZMXCxBtw==}
@@ -7252,6 +7271,10 @@ packages:
resolution: {integrity: sha512-6Zr/9twzWpMJp4ap1fwLIcKkehju6UR8D1BK2+QUfGPxlXQBusxwBJzf3TqATCSceeShaJsALHaSDwuKDFpoTw==}
engines: {node: '>=16.14'}
+ '@vercel/[email protected]':
+ resolution: {integrity: sha512-Fw28YZpRnA3cAHHDlkt7xQHiJ0fcL+NRcIqsocZQUSmbzeIKRpwttJjik5ZGanXP+vlA4SbTg+AbA3bP363l+w==}
+ engines: {node: '>= 20'}
+
'@vitejs/[email protected]':
resolution: {integrity: sha512-gUu9hwfWvvEDBBmgtAowQCojwZmJ5mcLn3aufeCsitijs3+f2NsrPtlAWIR6OPiqljl96GVCUbLe0HyqIpVaoA==}
engines: {node: ^14.18.0 || >=16.0.0}
@@ -7384,6 +7407,12 @@ packages:
resolution: {integrity: sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==}
engines: {node: '>=8'}
+ resolution: {integrity: sha512-/F9wh262HbK05b/5vILh38JvPiheonT+kBj1L97712E7VPchqmcx7aJuZN3QSk5Pj6knxUJLm2FFpYJI1pHXUA==}
+ engines: {node: '>=18'}
+ peerDependencies:
+ zod: ^3.25.76 || ^4.1.8
+
resolution: {integrity: sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw==}
peerDependencies:
@@ -7519,6 +7548,9 @@ packages:
resolution: {integrity: sha512-+gDffFXRW6sl/HCwbta7zK4uNqbPjv4YJEAdz7Vu+FLQHe77eZ4bvbJGi4hE0QPeJlMYMA3piXEr1UL3dAwx7Q==}
+ resolution: {integrity: sha512-cz4ur7Vb0xS4/KUN0tPWe44eqxrIu31me+fbang3ijiNscE129POzipJJA6zniq2C/Z6sJCjMimjS8Lc/GAs8Q==}
+
resolution: {integrity: sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==}
engines: {node: '>= 0.4'}
@@ -8639,6 +8671,15 @@ packages:
resolution: {integrity: sha512-9UbaD6XdAL97+k/n+N7JwX46K/M6Zc6KcFYskrYL8wbBV/Uyk0CTAMY0VT+qiK5PM7AIc9aTWYtq65U7T+aCNQ==}
engines: {node: '>=8'}
+ resolution: {integrity: sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==}
+ engines: {node: '>=4.0'}
+ peerDependencies:
+ debug: '*'
+ peerDependenciesMeta:
+ debug:
+ optional: true
+
resolution: {integrity: sha512-9f5g4feWT1jWT8+SbL85aLIRLIXUaDygaM2xPXRmzPYxrOMNok79Lr3FGJoKVNKibE0WCunNiEVG2mwuE+2qEg==}
@@ -8653,6 +8694,10 @@ packages:
resolution: {integrity: sha512-jqdObeR2rxZZbPSGL+3VckHMYtu+f9//KXBsVny6JSX/pa38Fy+bGjuG8eW/H6USNQWhLi8Num++cU2yOCNz4A==}
engines: {node: '>= 0.12'}
+ resolution: {integrity: sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==}
+ engines: {node: '>= 6'}
+
resolution: {integrity: sha512-9XNj/o4wrRFyhSMJOvsuyMwy8aUfBaZ1VrqHVfohyXf0Sw0e+yfKG+xZaY3arGCOMdwFsqObtzVOc1gU9KiT9w==}
engines: {node: '>=18.3.0'}
@@ -8772,13 +8817,6 @@ packages:
resolution: {integrity: sha512-9UiX/Bl6J2yaBbxKoEBRm4Cipxgok8kQYcOPEhScPwebu2I0HoQOuYdIO6S3hLuWoZgpDpwQZMzTFxgpkyT76g==}
engines: {node: 20 || >=22}
- deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting [email protected]
- hasBin: true
-
- resolution: {integrity: sha512-vuNwKSaKiqm7g0THUBu2x7ckSs3XJLXE+2ssL7/MfTGPLLcrJQ/4Uq1CjPTtO5cCIiRxqvN6Twy1qOwhL0Xjcw==}
- engines: {node: 20 || >=22}
- deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting [email protected]
hasBin: true
@@ -9121,6 +9159,9 @@ packages:
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
hasBin: true
+ resolution: {integrity: sha512-FO/Rhvz5tuw4MCWkpMzHFKWD2LsfHzIb7i6MdPYZ/KW7AlxawyLkqdy+jPZP1WubqEADE3O4FUENlJHDfQASRg==}
+
resolution: {integrity: sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==}
engines: {node: '>=0.10.0'}
@@ -9264,9 +9305,6 @@ packages:
resolution: {integrity: sha512-s+3Al/p9g32Iq+oqXxkW//7jk2Vig6FF1CFqzVXoTUXt2qz89YWbL+OwS17NFYEvxC35n0FKeGO2LGYSxeM2Gg==}
- resolution: {integrity: sha512-MpcPtHLE5EmztuFIqB0vzHAWJPpmN1E6L4oo+kze56LIs3MyXIj9ZHMDxqOvkP38gBR7K1v3jqd4WU2+nrfONQ==}
-
resolution: {integrity: sha512-0TpaTfihd4QMNwrz/ob2Bp7X04yuxJkjRGi4aKmOqwhov54i6u79oCv7T+C7lo70MKH6BesI3vscD1yb/yzKXQ==}
@@ -9305,6 +9343,9 @@ packages:
resolution: {integrity: sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==}
+ resolution: {integrity: sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==}
+
resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==}
engines: {node: '>=6'}
@@ -10143,6 +10184,10 @@ packages:
oxlint-tsgolint:
optional: true
+ resolution: {integrity: sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==}
+ engines: {node: '>=4'}
+
resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==}
engines: {node: '>=10'}
@@ -10159,10 +10204,22 @@ packages:
resolution: {integrity: sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==}
engines: {node: '>=8'}
+ resolution: {integrity: sha512-RwFpb72c/BhQLEXIZ5K2e+AhgNVmIejGlTgiB9MzZ0e93GRvqZ7uSi0dvRF7/XIXDeNkra2fNHBxTyPDGySpjQ==}
+ engines: {node: '>=8'}
+
resolution: {integrity: sha512-aNZ+VfjobsWryoiPnEApGGmf5WmNsCo9xu8dfaYamG5qaLP7ClhLN6NgsFe6SwJ2UbLEBK5dv9x8Mn5+RVhMWQ==}
engines: {node: '>=18'}
+ resolution: {integrity: sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg==}
+ engines: {node: '>=8'}
+
resolution: {integrity: sha512-MyIV3ZA/PmyBN/ud8vV9XzwTrNtR4jFrObymZYnZqMmW0zA8Z17vnT0rBgFE/TlohB+YCHqXMgZzb3Csp49vqg==}
engines: {node: '>=14.16'}
@@ -10178,9 +10235,6 @@ packages:
resolution: {integrity: sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==}
- resolution: {integrity: sha512-uBj69dVlYe/+wxj8JOpr97XfsxH/eumMt6HqjNTmJDf/6NO9s+0uxeOneIz3AsPt2m6y9PqzDzd3ATcU17MNfw==}
-
resolution: {integrity: sha512-61A5ThoTiDG/C8s8UMZwSorAGwMJ0ERVGj2OjoW5pAalsNOg15+iQiPzrLJ4jhZ1HJzmC2PIHT2oEiH3R5fzNA==}
@@ -10882,6 +10936,9 @@ packages:
resolution: {integrity: sha512-vfD3pmTzGpufjScBh50YHKzEu2lxBWhVEHsNGoEXmCmn2hKGfeNLYMzCJpe8cD7gqX7TJluOVpBkAequ6dgMmA==}
engines: {node: '>=4'}
+ resolution: {integrity: sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw==}
+
resolution: {integrity: sha512-5TF+l7p4+OsnP8BCCvSyZiSPc4x4//p5uPwK8TCnVPJYRmU2aYKMpOXvw8zM5a5JvuuCGN1jmsMwuU2W02ukfA==}
@@ -10983,10 +11040,6 @@ packages:
resolution: {integrity: sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==}
engines: {node: '>= 6.0.0', npm: '>= 3.0.0'}
- resolution: {integrity: sha512-QlaZEqcAH3/RtNyet1IPIYPsEWAaYyXXv1Krsi+1L/QHppjX4Ifm8MQsBISz9vE8cHicIq3clogsheili5vhaQ==}
- engines: {node: '>= 18'}
-
resolution: {integrity: sha512-4zemZi0HvTnYwLfrpk/CF9LOd9Lt87kAt50GnqhMpyF9U3poDAP2+iukq2bZsO/ufegbYehBkqINbsWxj4l4cw==}
engines: {node: '>= 18'}
@@ -11280,7 +11333,7 @@ packages:
resolution: {integrity: sha512-7NyxrTE4Anh8km8iEy7o0QYPs+0JKBTj5ZaqHg6B39erLg0qYXN3BijtShwbsNSvQ+LN75+KV+C4QR/f6Gwnpg==}
engines: {node: '>=18'}
- deprecated: Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exhorbitant rates) by contacting [email protected]
+ deprecated: Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting [email protected]
resolution: {integrity: sha512-resvxdc6Mgb7YEThw6G6bExlXKkv6+YbuzGg9xuXxSgxJF7Ozs+o8Y9+2R3sArdWdW8nOokoQb1yrpFB0pQK2g==}
@@ -12194,6 +12247,41 @@ packages:
snapshots:
+ dependencies:
+ '@ai-sdk/provider': 1.1.3
+ '@ai-sdk/provider-utils': 2.2.8([email protected])
+ zod: 4.1.13
+
+ dependencies:
+ '@ai-sdk/provider': 3.0.8
+ '@ai-sdk/provider-utils': 4.0.15([email protected])
+ '@vercel/oidc': 3.1.0
+ zod: 4.1.13
+
+ dependencies:
+ '@ai-sdk/provider': 1.1.3
+ nanoid: 3.3.11
+ secure-json-parse: 2.7.0
+ zod: 4.1.13
+
+ dependencies:
+ '@ai-sdk/provider': 3.0.8
+ '@standard-schema/spec': 1.1.0
+ eventsource-parser: 3.0.6
+ zod: 4.1.13
+
+ '@ai-sdk/[email protected]':
+ dependencies:
+ json-schema: 0.4.0
+
+ '@ai-sdk/[email protected]':
+ dependencies:
+ json-schema: 0.4.0
+
'@alloc/[email protected]': {}
'@ampproject/[email protected]':
@@ -12203,7 +12291,7 @@ snapshots:
dependencies:
- package-manager-detector: 1.5.0
+ package-manager-detector: 1.6.0
tinyexec: 1.0.2
@@ -12305,7 +12393,7 @@ snapshots:
remark-rehype: 11.1.2
remark-smartypants: 3.0.2
shiki: 3.20.0
- smol-toml: 1.5.2
+ smol-toml: 1.6.0
unified: 11.0.5
unist-util-remove-position: 5.0.0
unist-util-visit: 5.1.0
@@ -12424,7 +12512,7 @@ snapshots:
dependencies:
'@panva/hkdf': 1.2.1
- jose: 6.1.2
+ jose: 6.1.3
oauth4webapi: 3.8.3
preact: 10.24.3
preact-render-to-string: 6.5.11([email protected])
@@ -12942,12 +13030,6 @@ snapshots:
'@smithy/types': 2.12.0
tslib: 2.8.1
- '@babel/[email protected]':
- dependencies:
- '@babel/helper-validator-identifier': 7.28.5
- js-tokens: 4.0.0
- picocolors: 1.1.1
-
dependencies:
'@babel/helper-validator-identifier': 7.28.5
@@ -12958,15 +13040,15 @@ snapshots:
dependencies:
- '@babel/code-frame': 7.27.1
- '@babel/generator': 7.28.5
+ '@babel/code-frame': 7.29.0
+ '@babel/generator': 7.29.1
'@babel/helper-compilation-targets': 7.27.2
- '@babel/helper-module-transforms': 7.28.3(@babel/[email protected])
+ '@babel/helper-module-transforms': 7.28.6(@babel/[email protected])
'@babel/helpers': 7.28.4
- '@babel/parser': 7.28.5
- '@babel/template': 7.27.2
- '@babel/traverse': 7.28.5
- '@babel/types': 7.28.5
+ '@babel/parser': 7.29.0
+ '@babel/template': 7.28.6
+ '@babel/traverse': 7.29.0
+ '@babel/types': 7.29.0
'@jridgewell/remapping': 2.3.5
convert-source-map: 2.0.0
debug: 4.4.3
@@ -12976,14 +13058,6 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@babel/[email protected]':
- dependencies:
- '@babel/parser': 7.28.5
- '@babel/types': 7.28.5
- '@jridgewell/gen-mapping': 0.3.13
- '@jridgewell/trace-mapping': 0.3.31
- jsesc: 3.1.0
-
dependencies:
'@babel/parser': 7.29.0
@@ -12994,7 +13068,7 @@ snapshots:
dependencies:
- '@babel/types': 7.28.5
+ '@babel/types': 7.29.0
dependencies:
@@ -13012,7 +13086,7 @@ snapshots:
'@babel/helper-optimise-call-expression': 7.27.1
'@babel/helper-replace-supers': 7.27.1(@babel/[email protected])
'@babel/helper-skip-transparent-expression-wrappers': 7.27.1
- '@babel/traverse': 7.28.5
+ '@babel/traverse': 7.29.0
semver: 6.3.1
transitivePeerDependencies:
- supports-color
@@ -13021,15 +13095,8 @@ snapshots:
dependencies:
- '@babel/traverse': 7.28.5
- '@babel/types': 7.28.5
- transitivePeerDependencies:
- - supports-color
-
- '@babel/[email protected]':
- dependencies:
- '@babel/traverse': 7.28.5
- '@babel/types': 7.28.5
+ '@babel/traverse': 7.29.0
+ '@babel/types': 7.29.0
transitivePeerDependencies:
- supports-color
@@ -13040,15 +13107,6 @@ snapshots:
transitivePeerDependencies:
- supports-color
- dependencies:
- '@babel/core': 7.28.5
- '@babel/helper-module-imports': 7.27.1
- '@babel/helper-validator-identifier': 7.28.5
- '@babel/traverse': 7.28.5
- transitivePeerDependencies:
- - supports-color
-
dependencies:
'@babel/core': 7.28.5
@@ -13060,9 +13118,7 @@ snapshots:
dependencies:
- '@babel/types': 7.28.5
-
- '@babel/[email protected]': {}
+ '@babel/types': 7.29.0
'@babel/[email protected]': {}
@@ -13071,14 +13127,14 @@ snapshots:
'@babel/core': 7.28.5
'@babel/helper-member-expression-to-functions': 7.28.5
'@babel/helper-optimise-call-expression': 7.27.1
- '@babel/traverse': 7.28.5
+ '@babel/traverse': 7.29.0
transitivePeerDependencies:
- supports-color
dependencies:
- '@babel/traverse': 7.28.5
- '@babel/types': 7.28.5
+ '@babel/traverse': 7.29.0
+ '@babel/types': 7.29.0
transitivePeerDependencies:
- supports-color
@@ -13090,12 +13146,8 @@ snapshots:
dependencies:
- '@babel/template': 7.27.2
- '@babel/types': 7.28.5
-
- '@babel/[email protected]':
- dependencies:
- '@babel/types': 7.28.5
+ '@babel/template': 7.28.6
+ '@babel/types': 7.29.0
dependencies:
@@ -13109,7 +13161,7 @@ snapshots:
dependencies:
'@babel/core': 7.28.5
- '@babel/helper-plugin-utils': 7.27.1
+ '@babel/helper-plugin-utils': 7.28.6
dependencies:
@@ -13122,19 +13174,19 @@ snapshots:
dependencies:
'@babel/core': 7.28.5
- '@babel/helper-plugin-utils': 7.27.1
+ '@babel/helper-plugin-utils': 7.28.6
dependencies:
'@babel/core': 7.28.5
- '@babel/helper-plugin-utils': 7.27.1
+ '@babel/helper-plugin-utils': 7.28.6
dependencies:
'@babel/core': 7.28.5
'@babel/helper-annotate-as-pure': 7.27.3
'@babel/helper-create-class-features-plugin': 7.28.5(@babel/[email protected])
- '@babel/helper-plugin-utils': 7.27.1
+ '@babel/helper-plugin-utils': 7.28.6
'@babel/helper-skip-transparent-expression-wrappers': 7.27.1
'@babel/plugin-syntax-typescript': 7.27.1(@babel/[email protected])
transitivePeerDependencies:
@@ -13143,7 +13195,7 @@ snapshots:
dependencies:
'@babel/core': 7.28.5
- '@babel/helper-plugin-utils': 7.27.1
+ '@babel/helper-plugin-utils': 7.28.6
'@babel/helper-validator-option': 7.27.1
'@babel/plugin-syntax-jsx': 7.28.6(@babel/[email protected])
'@babel/plugin-transform-modules-commonjs': 7.28.6(@babel/[email protected])
@@ -13157,30 +13209,12 @@ snapshots:
'@babel/[email protected]': {}
- '@babel/[email protected]':
- dependencies:
- '@babel/code-frame': 7.27.1
- '@babel/parser': 7.28.5
- '@babel/types': 7.28.5
-
dependencies:
'@babel/code-frame': 7.29.0
'@babel/parser': 7.29.0
'@babel/types': 7.29.0
- '@babel/[email protected]':
- dependencies:
- '@babel/code-frame': 7.27.1
- '@babel/generator': 7.28.5
- '@babel/helper-globals': 7.28.0
- '@babel/parser': 7.28.5
- '@babel/template': 7.27.2
- '@babel/types': 7.28.5
- debug: 4.4.3
- transitivePeerDependencies:
- - supports-color
-
dependencies:
'@babel/code-frame': 7.29.0
@@ -13193,11 +13227,6 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@babel/[email protected]':
- dependencies:
- '@babel/helper-string-parser': 7.27.1
- '@babel/helper-validator-identifier': 7.28.5
-
dependencies:
'@babel/helper-string-parser': 7.27.1
@@ -13460,7 +13489,7 @@ snapshots:
'@emotion/[email protected]':
dependencies:
- '@babel/helper-module-imports': 7.27.1
+ '@babel/helper-module-imports': 7.28.6
'@babel/runtime': 7.28.4
'@emotion/hash': 0.9.2
'@emotion/memoize': 0.9.0
@@ -16856,6 +16885,29 @@ snapshots:
'@sindresorhus/[email protected]': {}
+ '@slack/[email protected]':
+ dependencies:
+ '@types/node': 24.0.8
+
+ '@slack/[email protected]': {}
+
+ '@slack/[email protected]':
+ dependencies:
+ '@slack/logger': 4.0.0
+ '@slack/types': 2.20.0
+ '@types/node': 24.0.8
+ '@types/retry': 0.12.0
+ axios: 1.13.5
+ eventemitter3: 5.0.1
+ form-data: 4.0.5
+ is-electron: 2.2.2
+ is-stream: 2.0.1
+ p-queue: 6.6.2
+ p-retry: 4.6.2
+ retry: 0.13.1
+ transitivePeerDependencies:
+ - debug
+
'@smithy/[email protected]':
dependencies:
'@smithy/types': 2.12.0
@@ -17497,24 +17549,24 @@ snapshots:
dependencies:
- '@babel/parser': 7.28.5
- '@babel/types': 7.28.5
+ '@babel/parser': 7.29.0
+ '@babel/types': 7.29.0
'@types/babel__generator': 7.27.0
'@types/babel__template': 7.4.4
'@types/babel__traverse': 7.28.0
dependencies:
- '@babel/types': 7.28.5
+ '@babel/types': 7.29.0
dependencies:
- '@babel/parser': 7.28.5
- '@babel/types': 7.28.5
+ '@babel/parser': 7.29.0
+ '@babel/types': 7.29.0
dependencies:
- '@babel/types': 7.28.5
+ '@babel/types': 7.29.0
dependencies:
@@ -17691,6 +17743,8 @@ snapshots:
'@types/tough-cookie': 4.0.5
form-data: 2.5.5
+ '@types/[email protected]': {}
+
dependencies:
htmlparser2: 8.0.2
@@ -17761,6 +17815,8 @@ snapshots:
is-buffer: 2.0.5
undici: 5.29.0
+ '@vercel/[email protected]': {}
+
dependencies:
'@babel/core': 7.28.5
@@ -17948,6 +18004,14 @@ snapshots:
clean-stack: 2.2.0
indent-string: 4.0.0
+ dependencies:
+ '@ai-sdk/gateway': 3.0.52([email protected])
+ '@ai-sdk/provider': 3.0.8
+ '@ai-sdk/provider-utils': 4.0.15([email protected])
+ '@opentelemetry/api': 1.9.0
+ zod: 4.1.13
+
optionalDependencies:
ajv: 8.17.1
@@ -18157,6 +18221,14 @@ snapshots:
stubborn-fs: 2.0.0
when-exit: 2.1.5
+ dependencies:
+ follow-redirects: 1.15.11
+ form-data: 4.0.5
+ proxy-from-env: 1.1.0
+ transitivePeerDependencies:
+ - debug
+
@@ -19243,6 +19315,8 @@ snapshots:
+
dependencies:
'@types/fontkit': 2.0.8
@@ -19274,6 +19348,14 @@ snapshots:
mime-types: 2.1.35
safe-buffer: 5.2.1
+ dependencies:
+ asynckit: 0.4.0
+ combined-stream: 1.0.8
+ es-set-tostringtag: 2.1.0
+ hasown: 2.0.2
+ mime-types: 2.1.35
+
dependencies:
fd-package-json: 2.0.0
@@ -19407,15 +19489,6 @@ snapshots:
package-json-from-dist: 1.0.1
path-scurry: 2.0.1
- dependencies:
- foreground-child: 3.3.1
- jackspeak: 4.1.1
- minimatch: 10.1.1
- minipass: 7.1.2
- package-json-from-dist: 1.0.1
- path-scurry: 2.0.1
-
dependencies:
fs.realpath: 1.0.0
@@ -19968,6 +20041,8 @@ snapshots:
+
@@ -20071,8 +20146,6 @@ snapshots:
-
@@ -20102,6 +20175,8 @@ snapshots:
+
@@ -20147,7 +20222,7 @@ snapshots:
oxc-resolver: 11.16.2
picocolors: 1.1.1
picomatch: 4.0.3
- smol-toml: 1.5.2
+ smol-toml: 1.6.0
strip-json-comments: 5.0.3
typescript: 5.9.3
zod: 4.1.13
@@ -20323,8 +20398,8 @@ snapshots:
dependencies:
- '@babel/parser': 7.28.5
- '@babel/types': 7.28.5
+ '@babel/parser': 7.29.0
+ '@babel/types': 7.29.0
source-map-js: 1.2.1
@@ -21249,6 +21324,8 @@ snapshots:
'@oxlint/win32-x64': 1.36.0
oxlint-tsgolint: 0.10.1
+
dependencies:
yocto-queue: 0.1.0
@@ -21265,11 +21342,25 @@ snapshots:
dependencies:
aggregate-error: 3.1.0
+ dependencies:
+ eventemitter3: 4.0.7
+ p-timeout: 3.2.0
+
dependencies:
eventemitter3: 5.0.1
p-timeout: 6.1.4
+ dependencies:
+ '@types/retry': 0.12.0
+ retry: 0.13.1
+
+ dependencies:
+ p-finally: 1.0.0
+
@@ -21292,8 +21383,6 @@ snapshots:
-
@@ -21327,7 +21416,7 @@ snapshots:
dependencies:
- '@babel/code-frame': 7.27.1
+ '@babel/code-frame': 7.29.0
error-ex: 1.3.4
json-parse-even-better-errors: 2.3.1
lines-and-columns: 1.2.4
@@ -21696,14 +21785,14 @@ snapshots:
dependencies:
- '@babel/parser': 7.28.5
- '@babel/traverse': 7.28.5
+ '@babel/parser': 7.29.0
+ '@babel/traverse': 7.29.0
chokidar: 4.0.3
commander: 13.1.0
conf: 15.0.2
debounce: 2.2.0
esbuild: 0.25.12
- glob: 11.1.0
+ glob: 11.0.0
jiti: 2.4.2
log-symbols: 7.0.1
mime-types: 3.0.2
@@ -22220,6 +22309,8 @@ snapshots:
extend-shallow: 2.0.1
kind-of: 6.0.3
+
dependencies:
parseley: 0.12.1
@@ -22268,7 +22359,7 @@ snapshots:
dependencies:
'@antfu/ni': 25.0.0
'@babel/core': 7.28.5
- '@babel/parser': 7.28.5
+ '@babel/parser': 7.29.0
'@babel/plugin-transform-typescript': 7.28.5(@babel/[email protected])
'@babel/preset-typescript': 7.28.5(@babel/[email protected])
'@dotenvx/dotenvx': 1.52.0
@@ -22312,7 +22403,7 @@ snapshots:
dependencies:
'@antfu/ni': 25.0.0
'@babel/core': 7.28.5
- '@babel/parser': 7.28.5
+ '@babel/parser': 7.29.0
'@babel/plugin-transform-typescript': 7.28.5(@babel/[email protected])
'@babel/preset-typescript': 7.28.5(@babel/[email protected])
'@dotenvx/dotenvx': 1.52.0
@@ -22485,8 +22576,6 @@ snapshots:
-