fix: OpenCode v1.14–v1.16 compatibility — api.keybind + Uint16Array buffer - #8
Open
yingmanwumen wants to merge 2 commits into
Open
fix: OpenCode v1.14–v1.16 compatibility — api.keybind + Uint16Array buffer#8yingmanwumen wants to merge 2 commits into
yingmanwumen wants to merge 2 commits into
Conversation
api.keybind.create() was removed in @opencode-ai/plugin v1.16.0 (@opentui/core >= 0.3.x). The plugin now passes the keybind string directly to api.command.register() entries, matching the current TuiCommand.keybind?: string API. Also removes the unused obj() helper function.
@opentui/core >= 0.2.2 changed OptimizedBuffer.buffers.fg/bg from Float32Array (0.0-1.0) to Uint16Array (0-255). The old code wrote float values directly, which were truncated to 0, making the rainbow effect invisible. Adds isUint16()/readColor()/writeColor() helpers that detect the buffer type at runtime and scale between float (0-1) and integer (0-255) as needed. Backward compatible with Float32Array buffers. Closes anomalyco#5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #7
Closes #5 (Uint16Array fix is a more complete version of the approach in #6)
Two separate commits addressing two independent bugs:
Commit 1:
fix: replace deprecated api.keybind with direct keybind stringapi.keybind.create()was removed in@opencode-ai/pluginv1.16.0 (@opentui/core >= 0.3.x). The plugin was throwingTypeErroron initialization, causing "Failed to update oc-plugin-rainbow".api.keybind.create()call (tui.tsx:139)splashKeybindstring directly toapi.command.register()which natively acceptskeybind?: stringobj()helperCommit 2:
fix: support Uint16Array buffer format in OpenCode >= v1.14@opentui/core >= 0.2.2changedOptimizedBuffer.buffers.fg/bgfromFloat32Array(0.0–1.0) toUint16Array(0–255). Float writes were truncated to 0, making the rainbow effect invisible.isUint16()/readColor()/writeColor()helpers with runtime buffer-type detectionMath.round(value * 255)Float32Arraybuffersrainbow-post-process.tsTesting
Verified working on OpenCode v1.16.0, Linux (Kitty). Foreground rainbow and logo splash both functional.