mirror of
https://github.com/different-ai/openwork
synced 2026-05-14 11:06:25 +02:00
* fix(openwrk): modernize router tab and lazy-load TUI * feat(owpenbot): add opencode-router alias and health port hints
OpenCode Router (formerly Owpenbot)
Simple Slack + Telegram bridge + directory router for a running OpenCode server.
Install + Run
One-command install (recommended):
curl -fsSL https://raw.githubusercontent.com/different-ai/openwork/dev/packages/owpenbot/install.sh | bash
Or install from npm (package name is still owpenwork):
npm install -g owpenwork
Quick run without install (runs the legacy owpenwork alias):
npx owpenwork
Then follow the guided setup (choose what to configure, start).
- One-command setup (installs deps, builds, creates
.envif missing):
pnpm -C packages/owpenbot setup
- (Optional) Fill in
packages/owpenbot/.env(see.env.example).
Required:
OPENCODE_URLOPENCODE_DIRECTORY
Recommended:
OPENCODE_SERVER_USERNAMEOPENCODE_SERVER_PASSWORD
- Run the router:
opencode-router
# (legacy aliases)
owpenwork
owpenbot
Telegram
Telegram support is configured via identities. You can either:
- Use env vars for a single bot:
TELEGRAM_BOT_TOKEN=... - Or add multiple bots to the config file (
owpenbot.json) using the CLI:
opencode-router telegram add <token> --id default
opencode-router telegram list
Slack (Socket Mode)
Slack support uses Socket Mode and replies in threads when @mentioned in channels.
- Create a Slack app.
- Enable Socket Mode and generate an app token (
xapp-...). - Add bot token scopes:
chat:writeapp_mentions:readim:history
- Subscribe to events (bot events):
app_mentionmessage.im
- Set env vars (or save via
opencode-router slack add ...):SLACK_BOT_TOKEN=xoxb-...SLACK_APP_TOKEN=xapp-...SLACK_ENABLED=true
To add multiple Slack apps:
opencode-router slack add <xoxb> <xapp> --id default
opencode-router slack list
Identity-Scoped Routing
The router routes messages based on (channel, identityId, peerId) -> directory bindings.
opencode-router bindings set --channel telegram --identity default --peer <chatId> --dir /path/to/workdir
opencode-router bindings list
Health Server (Local HTTP)
The router can expose a small local HTTP server for health/config and simple message dispatch.
OPENCODE_ROUTER_HEALTH_PORTorOWPENBOT_HEALTH_PORTcontrols the port (OpenWork defaults to a random free port when usingopenwrk).PORTis also accepted as a convenience if the above are unset.OWPENBOT_HEALTH_HOSTcontrols bind host (default:127.0.0.1).
Send a message to all peers bound to a directory:
curl -sS "http://127.0.0.1:${OWPENBOT_HEALTH_PORT:-3005}/send" \
-H 'Content-Type: application/json' \
-d '{"channel":"telegram","directory":"/path/to/workdir","text":"hello"}'
Commands
opencode-router start
opencode-router status
opencode-router telegram list
opencode-router telegram add <token> --id default
opencode-router slack list
opencode-router slack add <xoxb> <xapp> --id default
opencode-router bindings list
opencode-router bindings set --channel telegram --identity default --peer <chatId> --dir /path/to/workdir
Defaults
- SQLite at
~/.openwork/owpenbot/owpenbot.dbunless overridden. - Config stored at
~/.openwork/owpenbot/owpenbot.json(created byowpenworkorowpenwork setup). - Group chats are disabled unless
GROUPS_ENABLED=true.
Tests
pnpm -C packages/owpenbot test:unit
pnpm -C packages/owpenbot test:smoke
pnpm -C packages/owpenbot test:cli
pnpm -C packages/owpenbot test:npx