sync: upstream 195f59264 (between v1.14.50 and v1.14.51)

Merged
AL
6mo ago
+223051-73941

Summary

Brings anomalyco/opencode from ce66b191d (v1.14.48, our previous anchor) to 195f59264 (refactor(server): simplify listener lifecycle, between v1.14.50 and v1.14.51). 379 upstream commits.

Did NOT target v1.14.51. Upstream's chore: generate commit e62ebd8fe (the parent of 4e7a60dac/v1.14.51) regenerated packages/sdk/openapi.json + the v2 SDK in a way that drops EventMessageUpdated/EventMessagePartUpdated from the SDK's Event union — while cli/cmd/run.ts, acp/agent.ts, cli/cmd/run/{demo,session-data,stream.transport}.ts, etc. still string-compare against those types. A pristine checkout of 4e7a60dac produces 207 typecheck errors. The parent commit 195f59264 is the last clean point that still includes the upstream image-fix PR #26805 we wanted, so I anchored there. Recommend retrying once upstream re-aligns its event consumers with the new SyncEvent shape.

Why this sync now

User pointed at our PRs #64 (fix/strict-temperature-required-models) and #69 (fix/photon-load-and-typed-omitted-message) and asked whether upstream had fixed those independently and if so to adopt upstream and drop our exceptions.

  • PR #69 (image fix). ✅ Upstream's 981e00971 (PR #26805) fixes the photon WASM loading bug differently and more cleanly — top-level import photonWasm from ".../photon_rs_bg.wasm" with { type: "file" } then path.isAbsolute / fileURLToPath to compute __OPENCODE_PHOTON_WASM_PATH, replacing our runtime new Function / createRequire eval path. Upstream also renamed ImagePhotonUnavailableError → ImageResizerUnavailableError and changed loadPhoton to fail-fast (no null fallback). Adopted upstream's image.ts verbatim. Our PR #69 exception on image.ts can be removed from EXCEPTIONS.md after this lands.
  • PR #69 (processor.ts typed-omitted-message). ❌ Upstream's processor.ts falls back to [N image(s) omitted: could not be resized below the image size limit.] regardless of which Image.Error fired. Our PR #69 surfaces typed reasons (decode / size / unavailable / malformed URL) grouped by _tag. Kept our version, just updated the case label from ImagePhotonUnavailableError to ImageResizerUnavailableError.
  • PR #64 (temperature). ❌ Upstream did NOT include the operand swap. Kept our fix.

Conflicts resolved

FileResolution
packages/opencode/package.jsonKept @browser-use/browsercode-core, bumped version string to 1.14.51
bun.lock--theirs, regenerated via bun install
30 .github/workflows/*.ymlRe-deleted per PR #14
src/agent/agent.tsKept Skills + Flag imports + Scout referencePrompt/referenceDescription block. Added missing Reference import (auto-merge dropped it).
src/cli/cmd/tui/feature-plugins/home/tips-view.tsxKept brand strings (bcode.json, ~/.config/bcode, .bcode/commands/agents/tools/plugins/themes, BrowserCode). Adopted upstream's dynamic-shortcut refactors + formatter/lsp tip rewordings. Dropped the new docker/zen marketing tips.
src/image/image.tsAdopted upstream verbatim (PR #26805).
src/index.tsCombined trace + isRecord imports.
src/installation/index.tsKept our curl-only Method surface but rebuilt on upstream's new appProcess.run shape + userAgent(client) factory. Added back Flag import for the UA default.
src/plugin/index.tsCombined Laminar + DigitalOcean plugins in INTERNAL_PLUGINS.
src/provider/provider.tsKept bcode.sh / bcode headers for nvidia. Dropped upstream's new X-BILLING-INVOKE-ORIGIN: OpenCode (would phone home wrong brand).
src/server/shared/ui.tsAdopted upstream's embeddedUI(disableEmbeddedWebUi) signature. Kept F7 phone-home removal (dropped requestBody/proxyResponseHeaders/upstreamURL).
src/session/processor.tsKept our typed-message UX. Renamed ImagePhotonUnavailableError case to ImageResizerUnavailableError.
src/storage/db.tsAdopted upstream's flags: ChannelDbFlags signature. Kept bcode.db / bcode-<channel>.db filenames.
src/tool/registry.tsAdopted upstream's SessionStatus + BackgroundJob + RuntimeFlags additions. Split FetchUse.layer into its own .pipe() call (Effect caps .pipe() at 20 args; pre-piped with FetchHttpClient.layer so its HttpClient dep doesn't escape).
src/tool/webfetch.tsCombined FetchUse + Config + Parser imports.
test/storage/db.test.tsAdopted upstream's new it.effect + RuntimeFlags.layer shape. Kept bcode.db filenames.
test/tool/registry.test.tsAdopted upstream's factory shape. Same FetchUse pipe-split as the source.
test/tool/webfetch.test.tsAdopted upstream's Effect.acquireUseRelease test shape. Promoted top it = testEffect(...) to include FetchUse + Config layers.

Brand sweep

packages/core/src/models.ts is a NEW file from upstream that includes USER_AGENT = \"opencode/...\". Rebranded to browsercode/... in the F7-style sweep so it doesn't ship as a regression of that work.

Verification

  • bun install: clean, regenerated lockfile.
  • bun run typecheck: 7/7 packages passed in ~10s (one-time cold run).
  • Pristine 195f59264 standalone also typechecks clean (sanity check that we hit the right anchor and aren't compounding upstream's regression).

Yellow-zone audit

12 files touched upstream + at our zone: customizations preserved across the board (banner/title BC, bcode.sh HTTP-Referer/X-Title/X-Source across 8 providers, Cerebras X-Cerebras-3rd-Party-Integration: bcode, .bcode/plans, .bcode/agent-workspace, Skills import, BrowserExecute renderer, bcode.db filenames, bcode.sh/install curl bootstrap, Method surface stays curl-only, userAgent(client) returns browsercode/...).

EXCEPTIONS.md follow-up

Not in this PR (lives outside this repo in the maintainer's agent memory). To be updated to:

  • Remove the implicit PR #69 image/image.ts exception (now adopted upstream).
  • Keep the PR #69 session/processor.ts typed-message exception (BrowserCode-specific UX).
  • Keep the PR #64 session/llm.ts temperature exception (still slated to be opened upstream).

Summary by cubic

Sync with upstream to a clean pre-v1.14.51 point to pull in image handling and core/server updates, and add console-side TPS limiting + sticky provider persistence. Kept our typed image error UX and temperature fix; skipped v1.14.51 due to an upstream SDK event regression.

  • New Features

    • Console
      • Per-model TPS limiter and DB-backed sticky provider tracking; new Cloudflare Worker Stat for TPS history.
      • Honeycomb webhook handles low TPS alerts.
    • App
      • Project quick-switch hotkeys (mod+1…mod+9); improved “session working” state; review panel unmounts when closed.
      • Todo dock collapse state is remembered per session.
      • Palette/keybinds hide hidden commands; dialog excludes hidden options.
      • MCP shows “needs client registration” and click-to-auth; toggle/connect flow hardened; popover prioritizes MCP issues.
      • Clearer server errors by unwrapping SDK-wrapped causes.
    • Core
      • New aisdk bridge (adds SSE timeout guard) and catalog module for providers/models.
      • Auth storage migrated to v2 with on-write migration from legacy file.
      • Removed effect-zod; moved/renamed GitHub Copilot helpers.
  • Dependencies

    • Updated to effect/@effect/* 4.0.0-beta.65 and @opentui/{core,keymap,solid} 0.2.10.
    • Package versions bumped to 1.14.50 where applicable; bun.lock and Nix hashes refreshed.
    • CI hardening: pin actions/checkout, actions/create-github-app-token, and oven-sh/setup-bun; split cache restore/save; bunfig.toml adds minimumReleaseAge.