Summary
oc-plugin-rainbow@0.1.1 is broken on OpenCode v1.16.0 (and >= v1.14 for the buffer issue). Two separate bugs:
Bug 1: api.keybind.create is not a function — Plugin fails to initialize
Severity: Critical (plugin crashes on load)
Affected version: OpenCode >= v1.15.0 (when api.keybind was removed from @opencode-ai/plugin TUI API)
Root cause: tui.tsx:139 calls api.keybind.create() which no longer exists in TuiPluginApi. The current API uses api.keymap for keybinding management, and api.command.register() accepts a keybind?: string property directly.
Error log:
TypeError: undefined is not an object (evaluating 'api.keybind.create')
failed to initialize tui plugin
Fix: Remove api.keybind.create() call. The keybind string (splashKeybind = "ctrl+shift+r") is already defined as a constant — just pass it directly to api.command.register(). Also remove the orphaned obj() helper.
Files changed: tui.tsx (3 edits: remove dead code, remove keybind.create(), simplify keybind.get() → direct string)
Bug 2: Rainbow effect invisible — Uint16Array buffer format mismatch
Severity: Major (plugin loads but produces no visual effect)
Affected version: OpenCode >= v1.14.40 (when @opentui/core changed buffer format)
Root cause: OptimizedBuffer.buffers.fg/bg changed from Float32Array (0.0–1.0 float) to Uint16Array (0–255 integer) starting from @opentui/core@0.2.2. The plugin's rainbow-post-process.ts types and all pixel operations assume Float32Array, writing float values like 0.5 which truncate to 0 in Uint16Array — all colors become black/invisible.
Fix: Add runtime buffer-type detection with three helpers:
isUint16(buf) — detect buffer type
readColor(buf, slot) — /255 for Uint16Array, passthrough for Float32Array
writeColor(buf, slot, value) — Math.round(value * 255) for Uint16Array, passthrough for Float32Array
Update all function signatures and pixel read/write operations to use these helpers. Backward compatible — works with both old and new buffer formats.
Files changed: rainbow-post-process.ts (3 helpers + updated types + 4 updated functions)
Testing
Verified working on OpenCode v1.16.0, Linux (Kitty terminal). Foreground rainbow and logo splash (Ctrl+Shift+R) both functional.
Note: Background glow (bg: true) causes persistent cursor blinking on Kitty due to the 12-24fps repaint resetting the terminal cursor blink timer. This is a terminal-level artifact (issue #4), unrelated to the fixes above.
Summary
oc-plugin-rainbow@0.1.1is broken on OpenCode v1.16.0 (and >= v1.14 for the buffer issue). Two separate bugs:Bug 1:
api.keybind.create is not a function— Plugin fails to initializeSeverity: Critical (plugin crashes on load)
Affected version: OpenCode >= v1.15.0 (when
api.keybindwas removed from@opencode-ai/pluginTUI API)Root cause:
tui.tsx:139callsapi.keybind.create()which no longer exists inTuiPluginApi. The current API usesapi.keymapfor keybinding management, andapi.command.register()accepts akeybind?: stringproperty directly.Error log:
Fix: Remove
api.keybind.create()call. Thekeybindstring (splashKeybind = "ctrl+shift+r") is already defined as a constant — just pass it directly toapi.command.register(). Also remove the orphanedobj()helper.Files changed:
tui.tsx(3 edits: remove dead code, removekeybind.create(), simplifykeybind.get()→ direct string)Bug 2: Rainbow effect invisible — Uint16Array buffer format mismatch
Severity: Major (plugin loads but produces no visual effect)
Affected version: OpenCode >= v1.14.40 (when
@opentui/corechanged buffer format)Root cause:
OptimizedBuffer.buffers.fg/bgchanged fromFloat32Array(0.0–1.0 float) toUint16Array(0–255 integer) starting from@opentui/core@0.2.2. The plugin'srainbow-post-process.tstypes and all pixel operations assumeFloat32Array, writing float values like0.5which truncate to0in Uint16Array — all colors become black/invisible.Fix: Add runtime buffer-type detection with three helpers:
isUint16(buf)— detect buffer typereadColor(buf, slot)—/255for Uint16Array, passthrough for Float32ArraywriteColor(buf, slot, value)—Math.round(value * 255)for Uint16Array, passthrough for Float32ArrayUpdate all function signatures and pixel read/write operations to use these helpers. Backward compatible — works with both old and new buffer formats.
Files changed:
rainbow-post-process.ts(3 helpers + updated types + 4 updated functions)Testing
Verified working on OpenCode v1.16.0, Linux (Kitty terminal). Foreground rainbow and logo splash (
Ctrl+Shift+R) both functional.Note: Background glow (
bg: true) causes persistent cursor blinking on Kitty due to the 12-24fps repaint resetting the terminal cursor blink timer. This is a terminal-level artifact (issue #4), unrelated to the fixes above.