feat(opencode): unify Black + Go (Lite) + shared billing into one provider#98
Open
anthonybaldwin wants to merge 3 commits into
Open
feat(opencode): unify Black + Go (Lite) + shared billing into one provider#98anthonybaldwin wants to merge 3 commits into
anthonybaldwin wants to merge 3 commits into
Conversation
Folds the previous opencode + opencodego split back into a single provider that surfaces 21 namespaced metrics across three lanes: - black-* : paid Zen subscription rolling/weekly/status/plan - go-* : Lite (Go) rolling/weekly/monthly with status - billing-* : shared balance, monthly limit/usage, auto-reload, last4 The three _server function calls (subscription.get, lite.subscription.get, billing.get) fan out in parallel via goroutines; missing lanes degrade to "no data" rather than erroring the whole snapshot — Black-only and Lite-only users both see a working tile without one lane breaking the other. The lite.subscription.get and billing.get hashes ship as empty placeholders. SolidStart content-addresses these at build time and they need DevTools network capture from a live opencode.ai session to populate. logMissingHashes() emits a one-time launch warning. Black metrics work today; go-* and billing-* light up once the hashes land. Also renames CODEXBAR_OPENCODE_WORKSPACE_ID to OPENCODE_WORKSPACE_ID per plans/codexbar-env-cleanup.md (the workspace ID is now shared by Black and Lite, so the opencodego variant collapses too). See plans/opencode-tier-coverage.md for the architecture decision and the full metric inventory. Co-Authored-By: Claude <noreply@anthropic.com>
Removes the standalone OpenCode Go provider — its three metrics (session/weekly/monthly) now live as `go-rolling-percent`, `go-weekly-percent`, `go-monthly-percent` on the unified opencode provider. User-pinned buttons keep working via two-stage migration: - metricIDAliases gains `opencode` + `opencodego` entries that rewrite Claude-flavored IDs (session-percent/weekly-percent/monthly-percent) to the lane-namespaced equivalents on willAppear, persisted via SetSettings so the canonical ID flows back to the PI dropdown. - providerIDActionAliases maps the legacy `opencodego` action UUID to `opencode` for fetch dispatch — buttons surface the new metric immediately even though Stream Deck still labels them under the removed action UUID. One log line per launch announces each migration kind. Subsequent rebinds stay silent. The opencodego package, manifest action, glyph, SVG assets, website icon, and cache.go provider-list entry are all dropped. Plugin-level ProviderIDFromAction callers route through providerIDForAction so they pick up the alias automatically. Co-Authored-By: Claude <noreply@anthropic.com>
…ider - stat.html METRICS["opencode"] gains 21 namespaced rows split across three optgroups (Black, Go, Billing) — same __group__ syntax pattern used elsewhere. METRICS["opencodego"] entry, BRAND_COLORS/BRAND_BG duplicate, AUTH_PROVIDERS entry, and provider-name label all dropped. - METRIC_ID_ALIASES mirrors the plugin-side opencode + opencodego metric rename so the PI dropdown selects the right option for pre-rename buttons. - populateMetrics now emits <optgroup> separators for group rows; metricRows() helper strips them so default-metric resolution and feature-visibility logic keep using flat .find(). - PROVIDERS.md collapses two rows into one with the full metric inventory. - README.md drops opencodego/ from the provider tree. - docs/index.html provider count goes 35 → 34, OpenCode Go pill removed. - Workspace override env var renamed CODEXBAR_OPENCODE_WORKSPACE_ID → OPENCODE_WORKSPACE_ID per plans/codexbar-env-cleanup.md (one var covers both lanes since they share the workspace ID). Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the existing two providers (
opencode+opencodego) with one unifiedopencodeprovider that surfaces 21 namespaced metrics across three lanes:black-*(5) — paid Zen subscription rate limits ($20 / $100 / $200)go-*(6) — Lite (Go) plan rate limits ($12 / $30 / $60)billing-*(10) — shared credit balance, monthly limit/usage, auto-reload state, payment last4Architecture, full metric inventory, and don't-do list are in
plans/opencode-tier-coverage.md. The previousopencodeprovider was silently parsing the wrong fields for non-Black users; this PR re-grounds the implementation against the four actual product tiers (Free / Lite / Black / Enterprise) per sst/opencode source.User-pinned buttons auto-migrate via two-stage rebinding:
metricIDAliases(plugin-side + PI-side) rewrites Claude-flavored IDs (session-percent/weekly-percent/monthly-percent) to lane-namespaced IDs on willAppear, persisted viaSetSettings.providerIDActionAliasesmaps the legacyopencodegoaction UUID toopencodefor fetch dispatch — so even though Stream Deck still labels old buttons under the removed action UUID, the unified provider serves them. One log line per launch per migration kind.The bundle also renames the workspace-override env var from
CODEXBAR_OPENCODE_WORKSPACE_ID→OPENCODE_WORKSPACE_IDperplans/codexbar-env-cleanup.md.CODEXBAR_OPENCODEGO_WORKSPACE_IDcollapses entirely — Black and Lite share the same workspace.Server-function hashes — captured / TODO
workspaces.listdef39973159c7f0483d8793a822b8dbb10d067e12c65455fcb4608459ba0234fsubscription.get(Black)7abeebee372f304e050aaaf92be863f4a86490e382f8c79db68fd94040d691b4subscriptionServerID→blackServerID; workslite.subscription.get(Go)billing.get(shared)SolidStart content-addresses these by build at the function-key + file-position level — they're not derivable from the function name alone (we confirmed via the public sst/opencode source). The infrastructure ships with empty-string consts;
Fetch()falls through to "no data" for those lanes andlogMissingHashes()emits one launch-time warning. Once the hashes are captured (right-click Network panel on opencode.ai → look for the POST/GET to/_serverand copy theidquery param), drop them intoliteServerID/billingServerIDininternal/providers/opencode/opencode.goand thego-*+billing-*metrics light up immediately. No code changes required beyond the const literals.Changes
internal/providers/opencode/opencode.go— three-lane parser (parseBlackResponse,parseLiteResponse,parseBillingResponse), parallel fan-out via goroutines, per-lane graceful degrade.internal/providers/opencode/opencode_test.go— 12 tests covering active / null / minified-Solid / empty-workspace shapes for each parser, plus snapshot-assembly tests for Black-only, Go-only, and Billing-only paths.internal/providers/opencodego/,internal/icons/opencodego.go, opencodego SVG assets,docs/provider-icons/opencodego.svg, manifest action entry.cmd/plugin/main.go—metricIDAliasesgainsopencode+opencodegoentries; newproviderIDActionAliases+canonicalProviderID+providerIDForActionhelpers; willAppear handler rewrites + persists migrated metric IDs via SetSettings; ~15 callsites ofstreamdeck.ProviderIDFromActionroute through the canonicalizer.cmd/plugin/main_test.go— locks in the migration contracts.stat.html— singleMETRICS["opencode"]with__group__:optgroup separators (Black / Go / Billing); plugin-mirroringMETRIC_ID_ALIASES; newmetricRows()+isGroupRow()helpers;populateMetrics()emits<optgroup>for group rows.Sort-Object Name | ConvertTo-Json).Test plan
go build ./...cleango vet ./...cleangolangci-lint run ./...clean (0 issues)go test ./...clean — all opencode parser tests pass; main_test migration contract tests pass; manifest UUID resolution test passes (opencodego no longer claimed by manifest)go build -ldflags="-H=windowsgui" ...)black-*metrics populated, button rebinds work after restartlite.subscription.get+billing.gethashes are captured: re-run with a Lite-tier account and verifygo-*+billing-*lanes populateReferences
plans/opencode-tier-coverage.md— architecture decision and metric inventoryplans/codexbar-env-cleanup.md— env-var rename rationale🤖 Generated with Claude Code