Conversation
- Rename to @kilng235/opencode-visual-cache - Switch peerDeps to V2 @opencode/plugin - Update install.mjs to use V2 plugins array (was: V1 plugin)
- Replace TuiPlugin/TuiPluginApi with V2 Plugin.define + setup(context)
- Replace api.slots.register / api.ui.Prompt override with context.ui.slot({append: ...})
- Replace api.command.register with context.keymap.layer({commands: [{slash: ...}]})
- Replace 9 dialog usages (DialogSelect/DialogPrompt) with await context.ui.dialog.* calls
- Replace api.kv.get/set/ready (30+ calls) with a single reactive context.storage.store
- Replace api.state.part/get/provider/etc. with context.data.session.* and context.client.model.list
- Replace api.theme.current with context.theme (V2 ResolvedTheme tokens)
- Replace api.event.on('message.part.updated') with V2 session.* events
- Replace api.lifecycle.onDispose with cleanup function returned from setup()
- Replace api.route.current with context.ui.router.current()
- Drop <api.ui.Prompt>/<api.ui.Dialog*>/<api.ui.Slot> JSX usage
- Delete src/server.ts (V1 server stub)
- Bump @opentui/{core,solid,keymap} to ^0.5.10 to satisfy V2 plugin peer deps
- Add @opencode/client devDep so TS can resolve V2 client types
Build/typecheck/tests all pass.
Author
|
Closing — opened in wrong repo (targeted upstream instead of fork). Re-open manually at https://github.com/kilng235/opencode-visual-cache if you want to send upstream. |
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.
Summary
V2 fork of opencode-visual-cache. Migrates
src/index.tsx(~2238 → ~2220 lines) from the V1 plugin API to V2Plugin.define({ id, setup }).What's migrated
const tui: TuiPlugin = async (api) => …→export default Plugin.define({ id, setup(context) { … } })from@opencode/plugin/tuiResolvedTheme(no flatprimaryetc.) mapped to the 7-key palette the components expect (primary/text/textMuted/success/warning/error/border), desaturated through the existing Morandi ceilingapi.kv.get/set/ready→ singlecontext.storage.store("settings", { initial })reactive pair; the.readypolling interval is gone<api.ui.DialogPrompt>/<api.ui.DialogSelect>JSX usages → imperativeawait context.ui.dialog.prompt / select. The chaineddialog?.replace(...)+dialog?.clear()pattern collapses to plainawaits<api.ui.Prompt>override →prompt.footer.statusslot (V2 doesn't let plugins replace the prompt input itself)api.slots.register({ slots: { sidebar_content } })→context.ui.slot({ append: "sidebar.content", render })api.state.part(msgId)→ iteratecontext.data.session.message.list(sid)and readmsg.partsapi.command.register()→context.keymap.layer(() => ({ commands: [{ slash, run }] }))api.state.session.{messages,get,cost}→context.data.session.message.list / get / costapi.lifecycle.onDispose(...)→ return a single cleanup function fromsetup()api.route.current(used in 2 slash commands) → V2 commands receivesessionIDdirectly inexecute()Behavior deltas
api.state.provider. Non-OpenAI providers now require/cache-balance-key; OpenAI still works via the OAuth auth.json fallback.App.dataDir: doesn't exist on the V2Appinterface.readOpenAIOAuthToken()derives paths fromHOME/XDG_DATA_HOME/APPDATAdirectly.context.client.model.list(); pricing is filled best-effort only when the list is synchronously resolvable, so the createEffect reactive graph doesn't block.event.on("message.part.updated")has no exact equivalent; substituted withsession.usage.updated+session.tool.success/session.tool.failed+session.idle.Verification
npm install✅npm run build✅ emitsdist/tui.js(135 KB)npm run typecheck✅npm run test:balance✅src/server.tsdeleted (V1 server stub no longer needed)Compatibility
This is a V2-only fork. V1 OpenCode users should keep using the upstream
opencode-visual-cachepackage. Installing@kilng235/opencode-visual-cacheagainst V1 will not work.If upstream accepts this back, a future change can add the dual-export pattern (per the V1→V2 migration guide) so a single package supports both.