Skip to content

Releases: TheCraftyCoder/opencode-vision-bridge

v1.3.0 — Fix Media.Asset prototype mismatch (OpenCode 2.0.18)

Choose a tag to compare

@TheCraftyCoder TheCraftyCoder released this 26 Sep 20:14

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:

  1. 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.
  2. 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).
  3. 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

Choose a tag to compare

@TheCraftyCoder TheCraftyCoder released this 22 Sep 01:18
db8e558

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

Choose a tag to compare

@TheCraftyCoder TheCraftyCoder released this 21 Sep 18:30

Adds npm repository metadata, issue tracker, homepage, discovery keywords, and attribution to the upstream fork.

v1.0.1 — Fix Flash fallback

Choose a tag to compare

@TheCraftyCoder TheCraftyCoder released this 21 Sep 17:50

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

Choose a tag to compare

@TheCraftyCoder TheCraftyCoder released this 21 Sep 17:41

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.