new: [opencode-greenpt-usage] port plugin to OpenCode v2
Rewrite the TUI plugin against the OpenCode v2 plugin API (``@opencode/plugin`` + ``@opencode/plugin/tui``): - ``src/index.ts``: minimal server-side ``Plugin.define`` entry. - ``src/tui.tsx``: CLI plugin registered as ``./tui``, appending the widget to the ``sidebar.content`` slot through ``context.ui.slot`` and exposing the refresh/reset commands via ``context.keymap.layer``. - ``src/store.ts``: durable plugin storage (``context.storage.store``) replaces the KV store; ``session.idle``/``session.status`` events and the ``client.session`` API drive reconciliation and backfill. - ``src/widget.tsx``: v2 semantic theme tokens (``theme.text.base``/``text.muted``/``text.feedback``). - Tests updated to a structural fake of the v2 context. The free ``HEAD /v1/chat/completions`` balance probe and the credential resolution order are unchanged. The ``order`` option is gone: v2 slot placement is additive.
This commit is contained in:
23
package.json
23
package.json
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "opencode-greenpt-usage",
|
||||
"version": "0.1.0",
|
||||
"description": "OpenCode TUI plugin that shows the remaining GreenPT API credit balance in the sidebar.",
|
||||
"version": "0.2.0",
|
||||
"description": "OpenCode v2 TUI plugin that shows the remaining GreenPT API credit balance in the sidebar.",
|
||||
"type": "module",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"keywords": [
|
||||
@@ -13,21 +13,28 @@
|
||||
"balance"
|
||||
],
|
||||
"engines": {
|
||||
"opencode": ">=1.18.0"
|
||||
"opencode": ">=2.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"test:integration": "GREENPT_INTEGRATION=1 vitest run test/integration.greenpt.test.ts",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./tui": "./src/tui.tsx"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@opencode-ai/plugin": "*",
|
||||
"@opentui/solid": "*",
|
||||
"solid-js": "*"
|
||||
"@opencode/plugin": ">=2.0.0 <3",
|
||||
"@opentui/core": ">=0.5.17",
|
||||
"@opentui/solid": ">=0.5.17",
|
||||
"solid-js": ">=1.9.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@opencode-ai/plugin": "^1.18.33",
|
||||
"@opentui/solid": "^0.5.12",
|
||||
"@opencode/plugin": "^2.0.32",
|
||||
"@opencode/theme": "^2.0.32",
|
||||
"@opentui/core": "^0.5.17",
|
||||
"@opentui/solid": "^0.5.17",
|
||||
"@types/node": "^24.0.0",
|
||||
"solid-js": "^1.9.0",
|
||||
"typescript": "^5.6.0",
|
||||
|
||||
Reference in New Issue
Block a user