Skip to content

v2.0.7

Choose a tag to compare

@github-actions github-actions released this 03 Jul 12:07
· 70 commits to main since this release
95b9159

Installation

Fresh install

npm install -g https://github.com/Khip01/opencode-rich-presence/releases/download/v2.0.7/opencode-rich-presence-v2.0.7.tgz
opencode-rpc install

The installer creates a symlink at ~/.config/opencode/plugins/opencode-rich-presence.js so OpenCode loads the plugin as a local file (the package is distributed only via GitHub Releases, not the npm registry). It also adds @xhayper/discord-rpc to your local package.json and runs npm install so the worker can resolve its dependency.

Do not add opencode-rich-presence to the plugin array in opencode.jsonc. OpenCode reads that array as a list of npm packages to fetch on startup. The package is not on the npm registry, so adding it there causes a 404 notification on every OpenCode launch. The symlink alone is sufficient.

If you are upgrading from v2.0.5 and have a stale entry in opencode.jsonc, the installer detects it on the next opencode-rpc install and offers to remove it (default Yes).

Update from v2.0.x

opencode-rpc update

Or reinstall manually:

npm install -g https://github.com/Khip01/opencode-rich-presence/releases/download/v2.0.7/opencode-rich-presence-v2.0.7.tgz

Migrating from v1.0.0

v1.0.0 used bash scripts (install, uninstall, restart-discord.sh) and was Linux-only.

  1. Back up your old ~/.config/opencode/discord-config.json if you have one.
  2. Run the fresh install command above.
  3. Run opencode-rpc install to set up the new config file.
  4. Restore your settings into the new config (App ID, presence templates).
  5. Manually remove old v1.0.0 leftovers from ~/.config/opencode/:
    rm -rf ~/.config/opencode/plugins/opencode-dc-too-rich-presence.js
    rm -f ~/.config/opencode/discord-worker.mjs
    rm -f ~/.config/opencode/restart-discord.sh
    rm -f ~/.config/opencode/package.json ~/.config/opencode/package-lock.json
    rm -f ~/.config/opencode/CUSTOMIZATION.md ~/.config/opencode/README.md ~/.config/opencode/SETUP.md
  6. Restart OpenCode.

The plugin name changed from opencode-dc-too-rich-presence to opencode-rich-presence.

What's in v2.0.7

Fix: multi-instance leader election is now activity-based

  • Previously, the first OpenCode instance to start held the leader lock indefinitely
  • Standby instances could not push to Discord, even when actively chatting
  • Result: a previously idle leader showed stale presence while another instance was generating messages

Fix: standby instances can now take over leadership

  • Standby writes a handoff signal at ~/.config/opencode/.opencode-rich-presence-handoff when it receives chat.message or other activity events
  • Leader's heartbeat reads the signal and releases the lock if the request is fresher than its own activity
  • Standby picks up the lock on its next 2s poll and starts pushing to Discord
  • Total handoff time: ~7 seconds from your first message in the active window

Fix: leadership-change callback drives Discord worker lifecycle

  • startConnect() on gain, shutdownWorker() on loss
  • shutdownWorker() is distinct from destroy() (which is permanent) so the instance can re-acquire leadership later

Chore: docs

  • docs/ARCHITECTURE.md rewrites the Multi-instance Coordinator section
  • docs/TROUBLESHOOTING.md adds a root cause entry for "idle leader shows stale presence"
  • CHANGELOG.md adds v2.0.7 entry
  • Project AGENTS.md adds Critical Implementation Details for the new coordinator flow and a known-bug entry for the old first-wins design

See CHANGELOG.md for full details.