An open-source, faster Devin alternative
TypeScript
feat(sdk)+docs: Slack connect SDK surface; rework Slack doc (out of Labs, terse, REST+SDK)
Igor Zalutskicd440b35130f
diff --git a/docs/agent-sessions/slack.mdx b/docs/agent-sessions/slack.mdxindex 8088e531..a8e8d6a8 100644--- a/docs/agent-sessions/slack.mdx+++ b/docs/agent-sessions/slack.mdx@@ -4,74 +4,70 @@ title: "Slack"description: "Give an agent its own Slack handle"----<Note>**Labs preview.** Slack connect is a control-plane flow (dashboard + REST) — there are no SDK methods for it. Inbound and outbound ride the standard session model: see [Channels](/agent-sessions/channels), [Messaging](/agent-sessions/messaging), [Webhooks](/agent-sessions/webhooks), and [Events](/agent-sessions/events).</Note>+Connect an [agent](/agent-sessions/agents) to its own Slack app so members `@mention` it in a channel to start and steer [sessions](/agent-sessions/sessions). One app per agent, per workspace. You bring the app; OpenComputer keeps the bot token and signing secret in a sealed secret store — never returned, never exposed to a sandbox.-Connect an [agent](/agent-sessions/agents) to its **own** Slack app so members can `@mention` it in a channel to start and steer [sessions](/agent-sessions/sessions). One Slack app maps to one agent and one workspace (1 ⟷ 1 ⟷ 1). The agent brings its own app — you paste three values from Slack; OpenComputer holds the bot token and signing secret in a dedicated secret store, never returns them, and never exposes them to a sandbox.+Connect from the agent's page in the [dashboard](https://app.opencomputer.dev) (a guided wizard), or over the API: get a manifest, create the Slack app from it, then finalize with the three values Slack shows you.-## How it works--- **Connect** is a two-step wizard: create the Slack app *from a manifest* OpenComputer generates (it already points Event Subscriptions back at OpenComputer), then paste back the App ID, Signing Secret, and Bot Token.-- **Inbound.** An `@mention` is signature-verified, de-duplicated, and appended to a session as a [steer](/agent-sessions/messaging) — the same inbound message you can post over the API. The first mention in a thread starts a session; later mentions in that thread steer the same one (thread ⟷ session).-- **Outbound.** The session's `user`-level [events](/agent-sessions/events#visibility-levels) post back to the thread. The agent never calls Slack itself.--## Connect (dashboard)--<Steps>- <Step title="Start">On the agent's page, open **Slack → Connect Slack**. OpenComputer generates an app manifest.</Step>- <Step title="Create the app">Copy the manifest and create the app in Slack via **From a manifest**.</Step>- <Step title="Paste details">From **Basic Information → App Credentials**, paste the **App ID** and **Signing Secret**.</Step>- <Step title="Install">**Install App → Install to Workspace**, then paste the **Bot User OAuth Token** (`xoxb-…`) and finish.</Step>- <Step title="Use it">Invite the bot (`/invite @handle`), then `@mention` it to start a session.</Step>-</Steps>+<CodeGroup>-## Connect (API)+```ts TypeScript SDK+// 1. Manifest to create the Slack app from (Create app → From a manifest).+const { manifest, create_url } = await oc.agents.slackManifest(agentId);-The same flow over REST — org-key authenticated, scoped to the agent.+// 2. Finalize with the App ID, Signing Secret, and Bot User OAuth Token.+const slack = await oc.agents.connectSlack(agentId, {+ app_id: "A0…",+ signing_secret: "…",+ bot_token: "xoxb-…",+});-<CodeGroup>-```bash Start (manifest)-curl -X POST https://api.opencomputer.dev/v3/agents/{agent_id}/slack/manifest \- -H "Authorization: Bearer $OC_API_KEY"-# → { manifest, create_url, steps, status }+await oc.agents.getSlack(agentId); // { status: "active", … } — no secrets+await oc.agents.disconnectSlack(agentId); // purge + stop routing```-```bash Finalize-curl -X POST https://api.opencomputer.dev/v3/agents/{agent_id}/slack \- -H "Authorization: Bearer $OC_API_KEY" -H "content-type: application/json" \- -d '{"app_id":"A0…","bot_token":"xoxb-…","signing_secret":"…"}'-# → the connection (status: active; never any secrets)-```+```http REST API+POST https://api.opencomputer.dev/v3/agents/{agent_id}/slack/manifest+POST https://api.opencomputer.dev/v3/agents/{agent_id}/slack+GET https://api.opencomputer.dev/v3/agents/{agent_id}/slack+DELETE https://api.opencomputer.dev/v3/agents/{agent_id}/slack+Authorization: Bearer $OPENCOMPUTER_API_KEY-```bash Status-curl https://api.opencomputer.dev/v3/agents/{agent_id}/slack \- -H "Authorization: Bearer $OC_API_KEY"+// finalize body+{ "app_id": "A0…", "signing_secret": "…", "bot_token": "xoxb-…" }```-```bash Disconnect-curl -X DELETE https://api.opencomputer.dev/v3/agents/{agent_id}/slack \- -H "Authorization: Bearer $OC_API_KEY"-```</CodeGroup>-Create the Slack app from the returned `manifest`, then post the three pasted values to finalize. `status` moves `pending → active`. Disconnect purges the stored secrets and stops routing.+Then invite the bot (`/invite @handle`) and `@mention` it.++## Routing++An `@mention` is signature-verified, de-duplicated, and appended to a session as a [steer](/agent-sessions/messaging). The first mention in a thread starts a session; later mentions in that thread steer the same one. The session's `user`-level [events](/agent-sessions/events#visibility-levels) post back to the thread — the agent never calls Slack itself.## Reconnect-Replacing the Slack app (new keys, or a fresh app) requires explicit intent, so a stray request can't break a live connection:+Replacing the app requires explicit intent, so a stray request can't tear down a live connection:++<CodeGroup>++```ts TypeScript SDK+await oc.agents.slackManifest(agentId, { reconnect: true });+```++```http REST API+POST https://api.opencomputer.dev/v3/agents/{agent_id}/slack/manifest-```bash-curl -X POST https://api.opencomputer.dev/v3/agents/{agent_id}/slack/manifest \- -H "Authorization: Bearer $OC_API_KEY" -H "content-type: application/json" \- -d '{"reconnect": true}'+{ "reconnect": true }```-Calling `manifest` on an already-active connection **without** `reconnect: true` returns `409`. A reconnect resets the connection to `pending` — the agent stops responding in Slack until you finish the new setup — and retires the prior threads' session bindings so future mentions start fresh. In the dashboard, use the **Reconnect** button on a connected agent.+</CodeGroup>++Calling it on an active connection without `reconnect` returns `409`. A reconnect resets the connection to `pending` and retires the prior threads' bindings, so future mentions start fresh.-## Limits (v1)+## Limits<Warning>-- **Anyone who can `@mention` the bot** in a channel it has joined can start and steer the agent. There is no per-user, per-channel, or per-org allow-list yet — invite the bot only to channels you trust.-- **Mention-only.** The agent responds to `@mentions`; it does not passively follow thread replies.-- **Final replies only.** Outbound posts `user`-level events; live progress narration isn't streamed into the thread yet.-- **One Slack app per agent, per workspace.**+- Anyone who can `@mention` the bot in a channel it has joined can start and steer the agent — there is no per-user or per-channel allow-list yet. Invite it only where you trust the members.+- Mention-only: it doesn't passively follow thread replies.+- Outbound posts `user`-level events; live progress isn't streamed into the thread yet.</Warning>diff --git a/docs/docs.json b/docs/docs.jsonindex 236aca58..ee2da69b 100644--- a/docs/docs.json+++ b/docs/docs.json@@ -73,6 +73,7 @@"agent-sessions/authentication","agent-sessions/messaging","agent-sessions/webhooks",+ "agent-sessions/slack","agent-sessions/runtimes","agent-sessions/runtime-tools","agent-sessions/api-reference",@@ -84,7 +85,6 @@"agent-sessions/custom-runtimes","agent-sessions/triggers","agent-sessions/channels",- "agent-sessions/slack","agent-sessions/workspaces","agent-sessions/artifacts"]diff --git a/sdks/typescript/package-lock.json b/sdks/typescript/package-lock.jsonindex d1567c34..7413c4c6 100644--- a/sdks/typescript/package-lock.json+++ b/sdks/typescript/package-lock.json@@ -1,12 +1,12 @@{"name": "@opencomputer/sdk",- "version": "0.9.1",+ "version": "0.9.2","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "@opencomputer/sdk",- "version": "0.9.1",+ "version": "0.9.2","license": "MIT","devDependencies": {"@types/node": "^25.3.0",diff --git a/sdks/typescript/package.json b/sdks/typescript/package.jsonindex fbd23104..8d76d81c 100644--- a/sdks/typescript/package.json+++ b/sdks/typescript/package.json@@ -1,6 +1,6 @@{"name": "@opencomputer/sdk",- "version": "0.9.1",+ "version": "0.9.2","description": "TypeScript SDK for OpenComputer - cloud sandbox platform","type": "module","main": "dist/index.js",diff --git a/sdks/typescript/src/agents/agents.ts b/sdks/typescript/src/agents/agents.tsindex c2411430..dc9cd124 100644--- a/sdks/typescript/src/agents/agents.ts+++ b/sdks/typescript/src/agents/agents.ts@@ -22,6 +22,31 @@ export interface UpdateAgentParams {export interface Page<T> { data: T[]; nextCursor?: string | null; }+/** The Slack app manifest to create in Slack (from `slackManifest`). */+export interface SlackManifest {+ manifest: Record<string, unknown>;+ create_url: string;+ steps?: unknown;+ status: string;+}++/** A Slack connection's public state — never carries the bot token / signing secret. */+export interface SlackConnection {+ id: string;+ agent_id: string;+ status: string; // pending | active | revoked | error+ slack_app_id?: string | null;+ team_id?: string | null;+ account_login?: string | null;+}++/** The three values pasted back from Slack to finalize a connection. */+export interface ConnectSlackParams {+ app_id: string;+ bot_token: string;+ signing_secret: string;+}+/** Reusable agents — the "what" a session runs. */export class Agents {constructor(private readonly http: Http) {}@@ -39,4 +64,24 @@ export class Agents {list(params: { limit?: number; cursor?: string } = {}): Promise<Page<Agent>> {return this.http.request("GET", "/agents", { query: params as Query });}++ // ── Slack (give the agent its own @handle; BYO app, 1 app ⟷ 1 agent ⟷ 1 workspace) ──++ /** Start the connect intent → returns the app manifest to create in Slack. Pass+ * `reconnect: true` to replace an already-active connection (otherwise 409). */+ slackManifest(id: string, opts: { reconnect?: boolean } = {}): Promise<SlackManifest> {+ return this.http.request("POST", `/agents/${id}/slack/manifest`, { body: opts });+ }+ /** Finalize the connection with the three values Slack shows after install. */+ connectSlack(id: string, params: ConnectSlackParams): Promise<SlackConnection> {+ return this.http.request("POST", `/agents/${id}/slack`, { body: params });+ }+ /** Current connection (no secrets). */+ getSlack(id: string): Promise<SlackConnection> {+ return this.http.request("GET", `/agents/${id}/slack`);+ }+ /** Disconnect — purges the stored secrets and stops routing. */+ disconnectSlack(id: string): Promise<{ ok: boolean }> {+ return this.http.request("DELETE", `/agents/${id}/slack`);+ }}