Registry / devops / opencode-visual-cache

opencode-visual-cache

JSON →
library1.2.12jsnpmunverified

A real-time token cache hit rate visualizer plugin for the OpenCode TUI. Displays cache hit/miss stats, token distribution by role, model pricing, accumulated costs and savings, and supports collapsible panels, adaptive theming, multilingual UI (Chinese/English), and slash commands for runtime configuration. Current stable version 1.2.12. Requires @opencode-ai/plugin >=1.14.0, @opencode-ai/sdk >=1.14.0, @opentui/core >=0.2.0, @opentui/solid >=0.2.0, solid-js >=1.9.0. Ships TypeScript definitions.

npm install opencode-visual-cache
INSTALL
IMPORT
SIG · OPENCODE-VISUAL-CA
O
opencode-visual-cache
devopsjavascriptv1.2.12
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default import
import registerPlugin from 'opencode-visual-cache'
const registerPlugin = require('opencode-visual-cache')
ESM-only package. CommonJS require() will fail. TypeScript types included.
PluginOptions
import { PluginOptions } from 'opencode-visual-cache'
import { PluginOptions } from 'opencode-visual-cache/types'
TypeScript type, also available via default import type inference.
registerPlugin (named)
import { registerPlugin } from 'opencode-visual-cache'
import registerPlugin from 'opencode-visual-cache'
Named export also exists; default export is preferred and recommended.

Imports and registers the Visual Cache plugin with optional configuration, then shows available slash commands.

import registerPlugin from 'opencode-visual-cache'; // Register the plugin with OpenCode TUI registerPlugin({ // optional: override default config sections: { tokenDetails: true, modelPricing: true, tokenDistribution: true, loadedSkills: true, panelBorder: true }, currency: 'USD', exchangeRate: 1, language: 'auto' // 'auto' | 'zh' | 'en' }); // After registration, the cache panel appears in the sidebar. // Use slash commands inside OpenCode: // /cache-currency, /cache-rate, /cache-section, /cache-lang, /cache-config
Debug
Known issues
breakingRequires ESM environment; CommonJS require() will throw an error.
fix
Use import syntax. Set "type": "module" in package.json or use .mjs extension.
affects: >=1.0.0
deprecatedPluginOptions.currency may be replaced by runtime slash command in future versions.
fix
Prefer using /cache-currency slash command instead of static config.
affects: >=1.2.0
gotchaPeer dependencies must be installed manually if not using OpenCode's plugin manager.
fix
Run: npm install -g opencode-visual-cache@latest and ensure OpenCode environment includes peer deps.
affects: >=1.0.0
gotchaExchange rates are offline defaults; may not reflect current market rates.
fix
Use /cache-rate command to set custom exchange rate for accurate cost display.
affects: >=1.0.0
Errors
Common errors & fixes
ERR_REQUIRE_ESM
Using require() on an ESM-only package.
fix
Change to dynamic import(): const registerPlugin = await import('opencode-visual-cache');
Module not found: Can't resolve 'opencode-visual-cache'
Plugin not installed or not in node_modules.
fix
Run: npm install -g opencode-visual-cache@latest
Cannot find module '@opencode-ai/plugin'
Missing peer dependency.
fix
Install peer deps: npm install -g @opencode-ai/plugin @opencode-ai/sdk @opentui/core @opentui/solid solid-js
Upgrade
Version history
1.2.12latest on npm
Audit
Dependencies
@opencode-ai/pluginrequiredRequired OpenCode plugin API for registration
@opencode-ai/sdkrequiredProvides plugin SDK utilities
@opentui/corerequiredTUI core framework
@opentui/solidrequiredSolid.js bindings for TUI
solid-jsrequiredUI library for reactive components
Agent activity
2 hits · last 30 days
node
2
Resources
opencode-visual-cache — npm install opencode-visual-cache · libregistry