Repository navigation
Releases: TheCraftyCoder/opencode-vision-bridge
Release list
v1.3.0 — Fix Media.Asset prototype mismatch (OpenCode 2.0.18)
What's fixed
Pasted images now work reliably
When attaching an image to a prompt in OpenCode, the vision bridge was failing with a \Schema validation failed\ error because injected \media\ parts failed OpenCode's internal \instanceof Me\ (Media.Asset) check. The plugin imported the same Bun bundle chunk as OpenCode, but Bun created separate module instances — meaning the two \Me\ classes were different objects and \instanceof\ always returned \alse.
How it was fixed
The fix uses a three-tier strategy to ensure every injected media part passes OpenCode's validator:
- Reuse the original — When the incoming context message already contains a real \Media.Asset\ (e.g. the user's own pasted image), that object is carried through to the internal vision session unchanged. No prototype games needed.
- Construct via the captured host — The first real \Media.Asset\ that passes through the context hook has its prototype/constructor captured. New objects are created with
ew hostCtor(…)\ or stamped with \Object.setPrototypeOf(media, hostProto). - Plain object fallback — If neither of the above is available yet, a raw object matching the expected shape is used (same as before).
Also improved
ead_image\ tool now also accepts paths inside the OS temp/opencode directory, so pasted session attachments can be analysed via the tool without triggering a path-escape error.
Compatibility
Tested against OpenCode 2.0.18. Compatible with the @opencode/plugin\ 2.0.x API.
v1.2.0 — OpenCode v2 image and PDF bridge
OpenCode v2 production release for automatic image and PDF understanding in text-only sessions. Defaults to zai-coding-plan/glm-5.3-flash; adds capability-aware image bridging, bounded PDF-to-PNG rendering with bundled font/CMap/WASM assets, per-attachment fail-soft behavior, strict project-scoped read_image handling, bounded retryable caching, idempotent media injection, reusable internal sessions, project-scoped digest storage, multilingual documentation, and a loadable root package entrypoint. Verified with 60 passing tests plus live OpenCode v2 image and PDF flows. Grok's final passive adversarial review returned SHIP.
v1.0.4 — Package attribution
Adds npm repository metadata, issue tracker, homepage, discovery keywords, and attribution to the upstream fork.
v1.0.1 — Fix Flash fallback
Fixes transient vision requests on stable OpenCode V2 by injecting media for both context and generate hooks and inheriting the source session location.
v1.0.0 — OpenCode 2.0.12 support
Stable OpenCode 2.0.12 port. Updates the plugin, client, and AI dependencies to the @opencode/* packages; migrates custom-provider registration to the stable provider transform API; and fixes cross-platform configuration tests.