Skip to content

v0.16.3

Choose a tag to compare

@github-actions github-actions released this 05 May 11:36

Critical Electron compatibility fix

OpenCode 1.14.x stable shipped on Electron 41 (NODE_MODULE_VERSION 145), which rejects the better-sqlite3 Node ABI 137 prebuild that ships with Magic Context. Without this fix, Magic Context disables itself on OpenCode Desktop entirely. If you're on Desktop and saw the plugin silently stop working, this release fixes it.

This release also moves the unified CLI fully onto npx, drops a 1.5s-per-transform HTTP round trip on large sessions, and tightens a few install-flow rough edges.

Upgrade

npx @cortexkit/magic-context@latest doctor --force

--force clears OpenCode's cached plugin install so it picks up the new bundle on the next launch. Dashboard users should also run this to refresh the cached plugin used by the Magic Context tray.

What's Fixed

  • Electron Desktop: better-sqlite3 ABI mismatch resolved. Magic Context now detects Electron at plugin init, fetches a matching ABI 145 prebuild from the official WiseLibs/better-sqlite3 GitHub release on first run, and caches it under ~/.cache/cortexkit/native-bindings/. Subsequent restarts use the cache. The bundled node_modules/.../better_sqlite3.node is never modified — Pi (Node) and OpenCode TUI (Bun) keep using the binary they need. Implementation uses better-sqlite3's documented nativeBinding constructor option, no require.cache or node_modules manipulation. Verified live on OpenCode 1.14.37 / Electron 41.2.1 with both fresh-download and warm-cache paths.

  • Transform latency on large sessions cut by ~1.5s per pass. Magic Context's transform was calling client.session.get(...) on every pass to resolve the session's project directory — an HTTP round trip through OpenCode's local API that took 1.5s+ for long sessions under Electron. Since session.directory is set at session create time and never changes, the result is now cached in-process for the session's lifetime; subsequent transforms use a sub-microsecond Map lookup. Most visible on Desktop with sessions in the tens of thousands of tagged messages.

What's Changed

  • CLI invocation: npx-only. The unified CLI now consistently recommends npx @cortexkit/magic-context@latest <command> everywhere — install scripts, README, CONFIGURATION.md, doctor self-help text, plugin warnings, TUI sidebar, dashboard, and the bug-report template. Two recurring issues drove this:

    • bunx --bun froze under curl | bash because Bun's TTY handling doesn't deliver keypress events through a fresh /dev/tty, so the historian-model picker hung on first install.
    • The plugin auto-update checker was running bun install even though OpenCode itself uses npm to manage plugins, generating a parallel bun.lock that drifted from OpenCode's package-lock.json. The checker now runs npm install --no-audit --no-fund --no-progress and cleans both modern and legacy package-lock.json shapes.

    Bun is still fully supported as a runtime — bunx works fine, the docs just don't actively recommend it anymore. Node 20.12+ is required (Clack prompts depend on node:util.styleText).

Notes

  • No config changes required; existing magic-context.jsonc files continue to work.
  • No data-migration changes; the SQLite schema is unchanged.
  • The first plugin load on Electron Desktop will spend ~1-2 seconds downloading the matching better_sqlite3.node (~950 KB) from GitHub. Subsequent launches are instant — they use the cached binary.