npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

opencode-router

v0.11.126

Published

opencode-router: Slack + Telegram bridge + directory routing for a running opencode server

Readme

opencode-router

Simple Slack + Telegram bridge + directory router for a running opencode server.

Runtime requirement: Bun 1.3+ (bun --version).

Install + Run

One-command install (recommended):

curl -fsSL https://raw.githubusercontent.com/different-ai/openwork/dev/packages/opencode-router/install.sh | bash

Install from npm:

npm install -g opencode-router

Quick run without global install:

npx --yes opencode-router --help

Then configure identities and start.

  1. One-command setup (installs deps, builds, creates .env if missing):
pnpm -C packages/opencode-router setup
  1. (Optional) Fill in packages/opencode-router/.env (see .env.example).

Required:

  • OPENCODE_URL
  • OPENCODE_DIRECTORY

Recommended:

  • OPENCODE_SERVER_USERNAME
  • OPENCODE_SERVER_PASSWORD
  1. Run the router:
opencode-router start

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 (opencode-router.json) using the CLI:
opencode-router telegram add <token> --id default
opencode-router telegram list

Important for direct sends and bindings:

  • Telegram targets must use numeric chat_id values.
  • @username values are not valid direct peerId targets for router sends.
  • If a user has not started a chat with the bot yet, Telegram may return chat not found.
  • Private Telegram identities can require first-chat pairing with /pair <code> before commands are accepted.

Slack (Socket Mode)

Slack support uses Socket Mode and replies in threads when @mentioned in channels.

  1. Create a Slack app.
  2. Enable Socket Mode and generate an app token (xapp-...).
  3. Add bot token scopes:
    • chat:write
    • app_mentions:read
    • im:history
  4. Subscribe to events (bot events):
    • app_mention
    • message.im
  5. 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_PORT controls the port (OpenWork defaults to a random free port when using openwork).
  • PORT is also accepted as a convenience if the above are unset.
  • OPENCODE_ROUTER_HEALTH_HOST controls bind host (default: 127.0.0.1).

Send a message to all peers bound to a directory:

curl -sS "http://127.0.0.1:${OPENCODE_ROUTER_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/opencode-router/opencode-router.db unless overridden.
  • Config stored at ~/.openwork/opencode-router/opencode-router.json (created by opencode-router or pnpm -C packages/opencode-router setup).
  • Group chats are disabled unless GROUPS_ENABLED=true.

Tests

test:smoke requires a running opencode server (default: http://127.0.0.1:4096).

opencode serve --port 4096 --hostname 127.0.0.1
pnpm -C packages/opencode-router test:smoke

Other test suites:

pnpm -C packages/opencode-router test:unit
pnpm -C packages/opencode-router test:cli
pnpm -C packages/opencode-router test:npx