Skip to content

fix: support Node runtime in OpenCode Desktop - #2

Open
yikZero wants to merge 1 commit into
openchamber:mainfrom
yikZero:fix/node-runtime-desktop
Open

fix: support Node runtime in OpenCode Desktop#2
yikZero wants to merge 1 commit into
openchamber:mainfrom
yikZero:fix/node-runtime-desktop

Conversation

@yikZero

@yikZero yikZero commented Aug 26, 2026

Copy link
Copy Markdown

Problem

OpenCode Desktop runs plugin hooks in its Electron/Node backend. The current proxy assumes a Bun host at module load and startup (import.meta.dir, Bun.serve, and Bun.spawn). In Desktop, the config hook fails before it can seed the discovered model catalog, so the configured cursor provider is omitted from the provider list.

Fix

  • add a small runtime adapter that keeps the existing Bun server/process path and provides a Node HTTP server fallback
  • launch HTTP/2 bridge scripts with the current Node/Electron executable, using ELECTRON_RUN_AS_NODE for Electron
  • resolve bundled bridge paths with standard import.meta.url
  • add a Node regression that covers proxy requests and a real HTTP/2 child-process round trip
  • document OpenCode Desktop / Node runtime support

Verification

  • bun run build
  • bun run test:node
  • package dry run includes dist/runtime.js and both HTTP/2 bridge scripts
  • OpenCode CLI 1.18.19: live Cursor catalog loaded and cursor/default returned FORK_CLI_OK
  • OpenCode Desktop 1.18.23: embedded Electron/Node server reported Cursor connected with 92 model entries; a Desktop request using providerID: cursor / modelID: default returned DESKTOP_FORK_OK

bun run test currently reaches the existing testCursorVariantHooks assertion and fails with Expected runtime provider to expose one GPT family. The same failure reproduces on an untouched worktree at upstream commit ef37212, before this patch is applied; the runtime-specific Node regression passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant