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-yet-another-discord-rpc

v0.1.3

Published

Discord Rich Presence plugin for OpenCode — shows agent, model, tokens, and cost on your Discord profile

Downloads

328

Readme

OpenCode Yet Another Discord RPC

Discord Rich Presence plugin for OpenCode. Shows your current agent, model, token usage, and cost directly on your Discord profile.

Built with the GLM-5.1 model in OpenCode.

What it looks like

🎮 OpenCode
Build • claude-4.5
18.2k in / 4.1k out • $0.0842

⏱ 4:32 elapsed
[GitHub ⤴]

The presence updates in real time as you work — switching agents, models, and tracking tokens/cost as they accumulate.

Status states

| State | Details line | Small badge | |---|---|---| | Busy | Build • claude-4.5 | ⚡ busy | | Idle | Idle • claude-4.5 | 💤 idle | | Retrying | Retrying #2 • claude-4.5 | 🔄 retry | | Error | Error | ❌ error | | No session | OpenCode | 💤 idle |

Installation

# Using bun
bun add opencode-yet-another-discord-rpc

# Using npm
npm install opencode-yet-another-discord-rpc

# Using pnpm
pnpm add opencode-yet-another-discord-rpc

Quick Start

Add the plugin to your opencode.json config:

{
  "plugins": ["opencode-yet-another-discord-rpc"]
}

That's it! The plugin will automatically connect to Discord and display your session status.

Make sure the Discord desktop client is running — the plugin connects via local IPC.

Configuration

The plugin works out of the box with a default Discord application ID. To use your own:

Option A — Config file (recommended):

{
  "plugins": [
    ["opencode-yet-another-discord-rpc", { "clientId": "YOUR_APP_ID" }]
  ]
}

Option B — Environment variable:

export DISCORD_CLIENT_ID="YOUR_APP_ID"

Priority: config option → env var → default application ID.

Custom art assets

If you use your own Discord application, upload these images to the Discord Developer Portal → your application → Rich PresenceArt Assets:

| Key | Description | Recommended size | |---|---|---| | opencode | Main logo | 1024×1024px | | busy | Working status badge | 512×512px | | idle | Idle status badge | 512×512px | | retry | Retrying status badge | 512×512px | | error | Error status badge | 512×512px |

Architecture

OpenCode runtime
  └─ Plugin event hook
       └─ Presence state reducer
            └─ Debounce layer (100ms–1s)
                 └─ Discord RPC transport (local IPC)
                      └─ Discord desktop client
  • Event-driven — subscribes to OpenCode's event hook for live updates
  • Debounced — coalesces rapid step-finish events (1s), status changes faster (250ms)
  • Reconnecting — auto-reconnects to Discord with exponential backoff
  • Privacy-safe — never exposes repo paths, file names, prompt text, or API keys

Privacy

This plugin only shows:

  • Agent name (Build, Explore, Plan, etc.)
  • Model identifier (shortened provider/modelID)
  • Aggregate token counts and cost
  • Session state (busy/idle/retry/error)

It never shows: repository names, file paths, Git branches, prompt text, tool arguments, or any code content.

Development

bun install
bun run typecheck

Project structure

src/
  index.ts        # Plugin entry point (PluginModule export)
  types.ts        # Type definitions
  state.ts        # Event reducer / state machine
  format.ts       # Presence formatting + model shortening
  debounce.ts     # Debounce/coalesce timer
  transport.ts    # Discord RPC transport (reconnect w/ backoff)
  events.ts       # Event handler + flush factory

License

MIT