fix(core): rebrand attribution headers and meta prompt introduced by v1.18.4 sync

Merged
AL
4mo ago
+42-42

Summary

Post-sync branding audit of the v1.18.4 window (#116) found two surfaces where sync-introduced upstream code violates established fork policy. Stacked on sync/upstream-v1.18.4.

1. Provider attribution headers (7 files + their tests)

Upstream's new v2 provider-plugin architecture (packages/core/src/plugin/provider/) sets attribution headers per provider, architecturally bypassing the provider/provider.ts sites rebranded in PR #12 (those survived the sync intact). A bcode binary was crediting OpenCode for its traffic:

FileChange
zenmux.ts, kilo.ts, openrouter.ts, nvidia.ts, vercel.tsHTTP-Referer: opencode.ai → bcode.sh, X-Title: opencode → bcode
llmgateway.tssame + X-Source: opencode → bcode
cerebras.tsX-Cerebras-3rd-Party-Integration: opencode → bcode

Same rationale as PR #12: attribution is not auth or User-Agent; sending opencode.ai from a bcode binary is impersonation. Red-zone identifiers untouched: openai.ts User-Agent: opencode/<ver> + originator: "opencode" (Codex OAuth provider trust), gitlab.ts/cloudflare-*.ts User-Agents, and plugin/provider/opencode.ts (OpenCode-as-provider, user-initiated) are all left verbatim. provider-opencode.test.ts untouched.

2. New meta.txt system prompt

New in this window (upstream #36122), selected when model.api.id.includes("muse-spark"). Shipped as "You are OpenCode", identified itself as OpenCode, sent feedback to anomalyco/opencode, and instructed the agent to WebFetch opencode.ai/docs when asked about its own features. Rebranded following the default.txt / per-model prompt convention (F7 deeper sweep, PR #63): BrowserCode identity, browser-use/browsercode feedback URL, README pointer with fork acknowledgement.

Also audited, deliberately not changed

  • bcode console command (new, device-flow login to console.opencode.ai): hidden (describe: false), user-initiated only — same deferred class as bcode github.
  • TUI: only new OpenCode string in the window was the /share tip, already handled in #116.
  • Install/upgrade paths: still exclusively bcode.sh + browser-use/browsercode releases.

Verification

  • Filtered bun run typecheck: 16/16 pass
  • bun test test/plugin/provider-*.test.ts (7 affected files, from packages/core): 30/30 pass

Merge order

#116 → main first, then rebase this onto main (or merge this into the sync branch so #116 carries it — either works, changes are confined to sync-introduced files).


Summary by cubic

Rebranded sync-introduced provider attribution headers and the Muse Spark meta system prompt from OpenCode to BrowserCode/bcode. Prevents opencode.ai attribution from bcode traffic and aligns prompts and links with the fork.

  • Bug Fixes
    • Updated provider plugins (cerebras, kilo, llmgateway, nvidia, openrouter, vercel, zenmux) to send HTTP-Referer: https://bcode.sh/ and X-Title: bcode (plus X-Source: bcode for LLMGateway and X-Cerebras-3rd-Party-Integration: bcode for Cerebras).
    • Rebranded muse-spark meta prompt to BrowserCode: new name, feedback URL (browser-use/browsercode/issues), and docs pointer (project README with fork note).
    • Updated tests to match new headers; kept upstream-required identifiers intact (e.g., OpenAI UA, NVIDIA X-BILLING-INVOKE-ORIGIN).