An open-source, faster Devin alternative
TypeScript
Docs: automatic Slack setup, Slack management API and the Slack coder example
Igor Zalutski2604b9cae355
diff --git a/docs/agents/api.mdx b/docs/agents/api.mdxindex d46846e9..6bd592fc 100644--- a/docs/agents/api.mdx+++ b/docs/agents/api.mdx@@ -457,6 +457,114 @@ The delivered event names identifiers and the outcome; a completed turn'sfinal message is included, bounded to 16 KB. The receiving agent shouldtreat that text as data about another agent's work, not as instructions.+## Slack++Automatic Slack setup creates a dedicated Slack app for one agent, environment+and channel, then installs it. The dashboard's Connections tab uses these+routes; call them from your own tooling to script the same flow.++| Operation | Method and path | Body or query | Success |+| --- | --- | --- | --- |+| Start or continue | `POST /channels/slack/setups` | `{ agentId, alias, channelId?, name, requestKey, configurationToken? }` | `201` with `{ setup }` when created; `200` when the key names an existing setup |+| Find by target | `GET /channels/slack/setups` | `?agentId=&alias=&channelId=` | `200` with `{ setup }`, `null` when nothing is in progress |+| Get | `GET /channels/slack/setups/<id>` | None | `200` with `{ setup }` |+| Authorize | `POST /channels/slack/setups/<id>/authorize` | None | `200` with `{ authorizationUrl, expiresAt }` |+| Cancel | `POST /channels/slack/setups/<id>/cancel` | None | `200` with `{ setup }` in phase `cancelled` |++`alias` is `development` or `production`. `channelId` names a channel declared+in code; omit it for an agent whose deployment declares none. `requestKey` is+16 to 128 characters of letters, digits, `_` and `-` chosen by the caller: the+same key with the same target and name returns the same setup, so a retried+request never creates a second app, and a reused key with a different target+or name is `409 slack_setup_conflict`. `configurationToken` is a Slack app+configuration access token; it is used once to create the app and is never+stored or echoed. Send it with the first request, or with a later request+carrying the same key while the setup is `prepared`.++```bash+curl -X POST 'https://app.opencomputer.dev/api/managed-agents/channels/slack/setups' \+ -H 'x-api-key: <api-key>' \+ -H 'Content-Type: application/json' \+ -d '{+ "agentId": "coder",+ "alias": "development",+ "name": "Patch",+ "requestKey": "6f1d2c3b-4a5e-4f60-9b71-8c2d3e4f5a6b",+ "configurationToken": "<configuration-access-token>"+ }'+```++A setup is:++```json+{+ "setup": {+ "id": "<setup-id>",+ "requestKey": "6f1d2c3b-4a5e-4f60-9b71-8c2d3e4f5a6b",+ "projectId": "<project-id>",+ "agentId": "coder",+ "alias": "development",+ "channelId": "slack",+ "name": "Patch",+ "connectionId": "<connection-id>",+ "phase": "app_created",+ "app": { "id": "A0123456789", "name": "Patch" },+ "actions": ["authorize", "cancel"],+ "createdAt": "2026-09-17T10:00:00.000Z",+ "updatedAt": "2026-09-17T10:00:04.000Z"+ }+}+```++`workspace` (`{ id, name }`) and `botUserId` appear once the app is installed.+`error` carries `{ code, message, recoverable, retryAfterMs?, pointer?, at }`+when the last step did not complete; `recoverable` says whether submitting+again with corrected input can succeed. `actions` lists what the setup accepts+next: `create` (submit a configuration token), `authorize`, `manual` (finish+through manual setup) and `cancel`.++| Phase | Meaning |+| --- | --- |+| `prepared` | The target is reserved; a configuration token creates the app |+| `creating` | One creation attempt is in progress; a request with the same key joins it |+| `creation_uncertain` | Slack may or may not have created the app; check the Slack app list, then finish manually or cancel |+| `app_created` | The app exists; authorize to install it |+| `exchanging` | Slack approved the installation; the bot is being verified |+| `connected` | The connection is active |+| `cancelled` | Cancelled by the caller; an app already created in Slack is not deleted |++Error codes, as HTTP errors or as `error.code` on the setup:++| Code | Meaning |+| --- | --- |+| `slack_setup_conflict` | The request key was already used with a different target or name |+| `slack_setup_active` | Another setup is in progress for the target; find it by target and continue it |+| `slack_already_connected` | The target already has a connected app; disconnect it first |+| `slack_setup_unavailable` | Automatic setup is not available; use manual setup |+| `slack_configuration_token_invalid`, `slack_configuration_token_expired` | The token was rejected; generate a new one and submit it with the same key |+| `slack_manifest_rejected` | Slack rejected the generated app configuration; `pointer` names the field |+| `slack_app_limit_reached` | The workspace cannot hold another app |+| `slack_rate_limited` | Wait `retryAfterMs` and submit again |+| `slack_provider_unavailable` | Slack did not answer; submit or authorize again |+| `slack_creation_uncertain` | See phase `creation_uncertain` |+| `slack_exchange_uncertain`, `slack_authorization_denied`, `slack_authorization_expired` | The installation did not complete; authorize again |+| `slack_app_mismatch`, `slack_workspace_mismatch`, `slack_scope_missing`, `slack_enterprise_install_unsupported` | The installation did not match the created app, its established workspace or its declared scopes; authorize again and approve that app in a single workspace |+| `slack_setup_superseded` | A manual connection or reconnect completed first |++The authorization URL opens Slack's consent page for the created app and is+valid for ten minutes; authorizing again issues a new one. Slack sends the+outcome to `https://app.opencomputer.dev/api/managed-agents/slack/callback`,+which is registered on every app created this way, and the browser is then+redirected to the project's Connections tab with `slack=<result>` and+`setup=<id>` in the query. `result` is `connected` or one of+`authorization_denied`, `authorization_expired`, `exchange_failed`,+`app_mismatch`, `workspace_mismatch`, `scope_missing`,+`enterprise_install_unsupported`, `superseded` and `provider_unavailable`.+API clients do not call the callback.++`GET /channels` lists connections; each Slack connection carries `agents`, the+agents that receive the channel's messages in its environment.+## Projects, agents and deployments| Operation | Method and path | Success |diff --git a/docs/agents/channels.mdx b/docs/agents/channels.mdxindex bc360359..333b75a1 100644--- a/docs/agents/channels.mdx+++ b/docs/agents/channels.mdx@@ -78,6 +78,12 @@ conversation that waits hours for an answer should not bill for those hours.## Define a Slack channel+Declaring a channel is optional. An agent whose deployment declares none gets a+dedicated Slack app with the standard configuration: mentions and direct+messages go to that one agent. Declare a channel to narrow or extend what the+app can do, to share one app between several agents, or to publish through+[outboxes](/agents/outboxes).+Create a project-level channel under `opencomputer/channels/`:```tsx opencomputer/channels/team-slack.ts@@ -137,25 +143,70 @@ OpenComputer asks the user which agent should handle it instead of guessing.## Connect Slack-After the deployment is synchronized:--1. Open the project in the dashboard.-2. Select **Development** or **Production**.-3. Open **Channels** and choose **Connect Slack**.-4. Create or update the Slack app from the generated manifest.-5. Install the app to the intended Slack workspace.-6. Enter the installed app credentials when prompted.-7. Invite the app to each Slack conversation it will use.-8. Bind each code-defined destination to that conversation's Slack ID and- verify it.+Each environment gets its own dedicated Slack app. OpenComputer creates it+from the capabilities declared in code and installs it into your workspace;+you approve the installation in Slack. Nothing about the app is copied by+hand.-For a public destination, include `channels:read` and `chat:write`. For a-private destination, include `groups:read` and `chat:write`. The app must be a-member of the selected conversation. OpenComputer does not request-`chat:write.public` automatically.+After the deployment is synchronized:-Adding a scope in code changes the generated manifest. Update and reinstall-the Slack app so its granted scopes satisfy the current deployment.+1. Open the project in the dashboard and select **Development** or+ **Production**.+2. Open **Connections**. The Slack panel lists each declared channel with the+ agents that receive its messages, or the agent's dedicated app when the+ deployment declares no channel.+3. Choose **Create Slack bot** and enter the bot's name.+4. Paste an **App configuration access token** from+ [your Slack apps](https://api.slack.com/apps): under **Your App+ Configuration Tokens**, choose **Generate Token**, choose the workspace the+ bot will live in, and copy the **Access Token** (not the refresh token).+5. Approve the installation on the Slack page that opens. You are returned to+ the same project and environment.+6. Invite the bot to each conversation it will use and mention it.++The panel distinguishes **Connected**, meaning the installed credentials are+stored, from **First message received**, meaning a real Slack message reached+the agent. Slack's URL verification is not a message; mention the bot once to+confirm delivery.++The configuration token is used once, to create the app, and is never stored.+It expires 12 hours after it is generated; the installed bot does not expire+with it. Changing prompts, tools or other code and redeploying does not+require reconnecting Slack.++If Slack's page is closed before approval, the created app is kept: open+Connections again and choose **Authorize in Slack**. When the outcome of app+creation is unknown, the panel says so and links to your Slack app list rather+than creating a second app; finish with manual setup if the app exists, or+cancel and start again if it does not. Cancelling a setup never deletes an+app in Slack.++### Set up manually++Manual setup remains available for workspaces where you cannot generate a+configuration token, or to connect an app you created yourself. In the Slack+panel choose **Set up manually**:++1. Create or update the Slack app from the generated manifest.+2. Install the app to the intended Slack workspace.+3. Enter the installed app's ID, signing secret and bot token when prompted.+4. Invite the app to each Slack conversation it will use.++Both paths produce the same app configuration and the same connection.+Credentials, destination bindings and disconnecting are managed in the same+place afterwards.++### Destinations and scopes++Under **Channels**, bind each code-defined destination to that conversation's+Slack ID and verify it. For a public destination, include `channels:read` and+`chat:write`. For a private destination, include `groups:read` and+`chat:write`. The app must be a member of the selected conversation.+OpenComputer does not request `chat:write.public` automatically.++Adding a scope or event in code changes the generated app configuration.+Update the Slack app from the current manifest and reinstall it so its granted+scopes satisfy the deployment; other code changes need no reconnection.Inspect delivery health without opening the dashboard:@@ -185,11 +236,12 @@ not change the route, although its display label may refresh later.## Current limits-- Slack is the only channel provider.- Destination binding currently uses a Slack conversation ID.- Direct Slack user mapping and outbound DMs are not available.- A registration can receive mentions or direct messages only when thecorresponding event and scope are declared.+- A Slack app is installed into a single workspace; organization-wide+ installations are not supported.Use an [outbox](/agents/outboxes) when an agent needs to publish a proactivemessage to a configured Slack destination.diff --git a/docs/agents/examples/slack-coder.mdx b/docs/agents/examples/slack-coder.mdxnew file mode 100644index 00000000..ea7481bd--- /dev/null+++ b/docs/agents/examples/slack-coder.mdx@@ -0,0 +1,100 @@+---+title: "A coding agent in Slack"+description: "Deploy a coding teammate that takes work from Slack and opens draft pull requests"+---++The Slack coder example is a small deployed agent that receives coding tasks+in Slack. Mention it with a task; it clones the repository on its OpenComputer+computer, changes code on a branch, runs the relevant checks, opens a draft+pull request and replies with the result. Mention it again in the same thread+to continue on the same branch and pull request. It keeps working after you+close your terminal.++The repository is two files:++```text+opencomputer/project.ts+opencomputer/agents/coder/agent.ts+```++OpenComputer supplies the rest: the coding harness and computer, deployed+execution, conversation routing, GitHub credentials and the Slack app. There+is no server, message parser, GitHub client or Slack reply code to write.++[Browse the source on GitHub](https://github.com/diggerhq/opencomputer-slack-coder).++## What the agent does++`opencomputer/agents/coder/agent.ts` declares a GitHub connection with write+access to contents and pull requests, selects a model, enables the built-in+shell tool and returns the instructions the agent works from: read the+repository's instructions, inspect the code, work on a branch, run the checks+and report their actual results, push the branch and open a draft pull+request, continue follow-ups on that branch, never merge, and never print+credentials or put them in files or Git URLs.++The example declares no Slack channel, so the agent gets a dedicated Slack app+with the standard configuration: mentions and direct messages go to this one+agent. To narrow or extend what the app can do, declare a channel under+`opencomputer/channels/` as described in [Channels](/agents/channels).++## Deploy it++You need Node.js 22 or later, an OpenComputer account with available usage,+permission to install a Slack app in your workspace, and GitHub access to+install the managed OpenComputer App on the repositories the agent may change.++```bash+git clone https://github.com/diggerhq/opencomputer-slack-coder.git+cd opencomputer-slack-coder+npm ci+npx --package @opencomputer/cli opencomputer login+npx --package @opencomputer/cli opencomputer link --create-project slack-coder+npm run deploy -- --alias production+```++The deploy command exits after publishing; nothing keeps running on your+machine. Open the printed project URL and select **Production**.++## Connect GitHub++In **Connections**, install the managed OpenComputer GitHub App, select the+repositories the agent may change, and attach the installation to Production.+That selection is the complete boundary of what the agent can reach. Anyone+who can message the bot can direct it at those repositories, so invite the bot+to conversations accordingly. See+[GitHub App connections](/agents/github).++## Connect Slack++In the same Connections tab, the Slack panel shows the agent that will receive+messages. Choose **Create Slack bot**, name it, paste an app configuration+access token from [your Slack apps](https://api.slack.com/apps), and approve+the installation on the Slack page that opens. Then invite the bot to a+channel and mention it once; the panel reports the first message received.+[Connect Slack](/agents/channels#connect-slack) covers the token and the+manual alternative.++## Give it a task++Mention the bot by the name you gave it, in a channel it has been invited to,+naming a repository the installation can reach. The examples call it Patch:++> @Patch In acme/service, CSV export breaks when a customer's name contains a+> comma. Reproduce it, fix it, run the tests and open a draft PR.++The reply reports what was run, the check results and the draft pull request+link. Follow up in the same thread, from the same Slack account:++> @Patch Also cover names containing newlines in that PR.++The same session continues on the same branch and updates the same pull+request. A new thread starts independent work. Each conversation belongs to+the Slack user and thread it started in.++## Change the agent++Edit the instructions or the model in `agent.ts` and run the deploy command+again. New conversations use the promoted version; conversations already+running keep the version they started with. Redeploying does not require+reconnecting GitHub or Slack.diff --git a/docs/agents/github.mdx b/docs/agents/github.mdxindex e02c9ef1..420c8490 100644--- a/docs/agents/github.mdx+++ b/docs/agents/github.mdx@@ -53,9 +53,9 @@ Effective authority is therefore the intersection of:## Install the App-Deploy the agent, open its project in the OpenComputer dashboard, and choose-**GitHub**. Install the managed OpenComputer GitHub App into a user or-organization account. GitHub lets the installer select all repositories or a+Deploy the agent, open its project in the OpenComputer dashboard, select the+environment and open **Connections**. Install the managed OpenComputer GitHub+App into a user or organization account. GitHub lets the installer select all repositories or aspecific set of repositories.That GitHub installation selection is the complete repository boundary. Therediff --git a/docs/docs.json b/docs/docs.jsonindex cc9ada3b..58037ca2 100644--- a/docs/docs.json+++ b/docs/docs.json@@ -90,6 +90,7 @@"agents/examples/gtm-engineer","agents/examples/feature-flag-hygiene","agents/examples/github-actions-triage",+ "agents/examples/slack-coder","agents/examples/pr-review","agents/examples/test-coverage"]