Skip to content

Releases: engrtarun/opencode-model-badges

v0.4.0 - OpenCode v2 compatibility

Choose a tag to compare

@engrtarun engrtarun released this 28 Oct 07:08

v0.4.0 - OpenCode v2 compatibility

OpenCode v2.2.0 moved execution state out of session.status (and the v2 wire has no session.idle). This release keeps the same badge contract on both channels:

  • v2 model switch - session.model.selected { model, previous } moves a session's badge instantly (same as v1's session.model.updated)
  • v2 rate-limit back-off - session.retry.scheduled { at, attempt, error } paints the model amber and seeds the ? window from the provider's own resume epoch �t
  • v2 execution lifecycle - session.execution.started / succeeded / failed / interrupted drive busy/idle; a failure without any back-off event in the chain earns no ? (regression guard for #10)
  • Replay guard - durable v2 frames replayed after a reconnect can refresh bookkeeping but never resurrect liveness: no ghost ? on sessions that idled before the connection
  • Back-off sweeper - a missed follow-up execution event can no longer hold a stale ? forever
  • 24-test suite - 4 new v2 event tests ( est/v2-events.test.js)

Install: copy index.ts + lib.ts into ~/.config/opencode/plugins/model-badges/; badges rebuild on the next picker open.

v0.3.1 - badge immediacy + test harness

Choose a tag to compare

@engrtarun engrtarun released this 23 Oct 10:31

Focus: community merges + proof-of-work (two contributors in 24 h ??)

  • Faster model-switch badges (PR #13, thanks @Golden007-prog) - a running session's badge now follows session.model* events immediately, no paginated session-list, no 8-second lag; incomplete payloads keep the short refresh, and an in-flight stale list can no longer restore an old mapping. Closes #11.
  • Test harness on main (idea from PR #5, thanks @xmejl) - dependency-free npm test (node:test): 20 tests across badge strip/pick/count + real-plugin model-switch regressions. The suffix-regex and dedup findings are credited in lib.ts, the test header and CONTRIBUTING.md.
  • CI gate - .github/workflows/test.yml runs the suite on every push/PR (Node 22 + 24). Green badge on the README.
  • Quality-of-readme - badges row (license/version/tests/node), updated install copy includes lib.ts.

Credits

Contributor What
@xmejl double-count reproduction + suffix regex bug (PR #5, absorbed with credit)
@Golden007-prog immediate model-switch badge updates + revision guard (PR #13)

Full changelog: v0.3.0...v0.3.1

v0.2.0 - Rate-limit badges & professional Unicode glyphs

Choose a tag to compare

@engrtarun engrtarun released this 22 Oct 15:11

What's new

Professional Unicode badges instead of emoji

  • ✅ / ✔️ [N] → ● / ● [N] — pure text glyphs (U+25CF) that render monochrome and identical in every terminal and font, no color-emoji dependency.
  • Legacy ✅ / ✔️ [N] / ⭐ names from v0.1.0 are still recognized and cleaned up on the first refresh.

Rate-limit visibility (the headline feature)

  • A model hitting a rate/usage limit (HTTP 429) sets session status to retry — the model now earns a ↻ badge while OpenCode backs off (previously it misleadingly kept the running badge).
  • When the retry policy gives up, the model keeps ✕ until the provider-provided reset epoch (retry-after), capped at 24 h — with a 10-minute default window when no timing is provided.
  • Badge priority stays sane: actually-running sessions always win (● [3] > ↻ > ✕).

Under the hood

  • New tunable constants: RETRY_MARK_DEFAULT_MS, RETRY_MARK_MAX_MS.
  • Deletion cleanup extended to the new retry/exhausted state (no leaks).
  • Debug log now prints running=[...] retry=[...] exhausted=[...].

Install/upgrade: same single-file plugin — copy index.ts + package.json into ~/.config/opencode/plugins/model-badges/ and touch opencode.jsonc (or restart).

v0.1.0 - First public release

Choose a tag to compare

@engrtarun engrtarun released this 20 Oct 16:41

First public release - v0.1.0

Live running-session badges on every OpenCode model name - right inside the model picker.

What it shows

Badge Meaning
(none) no session currently running on the model
? green tick exactly 1 chat session running
?? [N] blue tick + count N (2+) sessions running on the same model in parallel

How it works

  • Consumes the server SSE stream (GET /api/event) with plain etch() - no child processes, no terminal flash, zero RAM-resident state.
  • Liveness = 3 layers: authoritative session.status events, 15s activity TTL on generation-stream events, and explicit oolCallID tracking so long builds never lose their badge.
  • Badges are always rebuilt from the bare name (suffix stripped first) - no double-badge or stuck-badge possible.
  • Deleted sessions have all state cleaned; a 10-min safety refresh catches missed events.

Install

Copy index.ts + package.json into ~/.config/opencode/plugins/model-badges/ and touch opencode.jsonc to reload. See the README for details.

Tuning

Top of index.ts: ACTIVITY_TTL_MS, STATUS_DEBOUNCE_MS, TOOL_MAX_MS, MIN_MULTI.

MIT License - (c) engrtarun