opencode-reviewer 2.0.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +60 -65
  2. package/dist/tui.js +309 -1941
  3. package/package.json +3 -4
package/README.md CHANGED
@@ -3,8 +3,8 @@
3
3
  Reviews pending permissions in the [OpenCode](https://github.com/anomalyco/opencode) sidebar using a separate LLM. Reviews
4
4
  native shell commands, file edits, and external-directory access. Skill, MCP and
5
5
  custom-tool requests currently remain manual.
6
- Supports streaming explanations, saved report history, auto-approval, and Linux
7
- desktop notifications with distinct sounds.
6
+ Supports streaming explanations, saved report history and stats, auto-approval, and Linux
7
+ desktop notifications (Gnome) with distinct sounds.
8
8
 
9
9
  This plugin is meant to enable you to run sessions with less frequent input in a safer way. Also giving the reviewer context of specific files the agent might want to run/see/... The review prompts are freely configurable, so you can determine the reviewers behavior very accurately.
10
10
 
@@ -29,7 +29,7 @@ There is no project-local CLI configuration. OpenCode loads the
29
29
  "$schema": "https://opencode.ai/v2/cli.json",
30
30
  "plugins": [
31
31
  {
32
- "package": "opencode-reviewer@2.0.1",
32
+ "package": "opencode-reviewer@latest",
33
33
  "options": {
34
34
  "baseURL": "https://openrouter.ai/api/v1",
35
35
  "model": "your-model",
@@ -79,28 +79,18 @@ launching OpenCode. The inline key takes precedence. Omit both for an unauthenti
79
79
  endpoint. Remove `instructions` to use the built-in prompts and
80
80
  `notificationSoundDirectory` to use the bundled sounds.
81
81
 
82
- The connection, credential and directory values above are examples, not defaults.
83
- All boolean, numeric and per-type notification values shown are the defaults.
84
- Restart OpenCode after changing reviewer configuration. Also load the server
85
- companion in `opencode.json`, globally or in the project. Keep permission rules
86
- only in this server configuration, not in `cli.json`:
82
+ You also need to edit `opencode.json`, as the plugin needs to be informed of states
83
+ that are not exposed by TUI APIs:
87
84
 
88
85
  ```json
89
86
  {
90
87
  "$schema": "https://opencode.ai/config.json",
91
- "plugins": ["opencode-reviewer@2.0.1"],
92
- "permissions": [
93
- { "action": "shell", "resource": "*", "effect": "ask" },
94
- { "action": "edit", "resource": "*", "effect": "ask" },
95
- { "action": "skill", "resource": "*", "effect": "ask" },
96
- { "action": "external_directory", "resource": "*", "effect": "ask" }
97
- ]
88
+ "plugins": ["opencode-reviewer@latest"]
98
89
  }
99
90
  ```
100
91
 
101
- Merge these entries with your existing configuration. Rules are ordered and the last
102
- matching rule wins. Reviews run only when OpenCode asks for permission. Existing
103
- `allow` rules and native autoaccept skip review. See OpenCode's
92
+ ### Opencode docs
93
+
104
94
  [server config](https://opencode.ai/v2/docs/config),
105
95
  [CLI config](https://opencode.ai/v2/docs/cli/config) and
106
96
  [CLI plugins](https://opencode.ai/v2/docs/build/plugins/cli) guides.
@@ -120,14 +110,14 @@ inclusive, fractions are invalid, and the maximum safe integer is
120
110
  | `apiKey` | string | Unset | Nonempty Bearer token. Takes precedence over `apiKeyEnv`. |
121
111
  | `apiKeyEnv` | string | Unset | Environment-variable name matching `[A-Za-z_][A-Za-z_0-9]*`. Without an inline key, its value must be set and nonblank when a review runs. Omit both key options for no Authorization header. |
122
112
  | `instructions` | string | Unset (built-ins) | Absolute, NUL-free directory path containing overrides for the [prompt templates](https://github.com/mightykatun/opencode-reviewer/tree/main/prompts), not inline instructions. Missing named files use built-ins; supplied files must be readable, regular, non-symlink, nonempty UTF-8 text up to 64 KiB. Fixed contracts cannot be overridden. |
123
- | `stream` | boolean | `false` | Request SSE and show provisional rating/text updates. Normal automatic approval waits for a completed, validated report; fast mode can approve on an early Safe rating. Presentation rules are described below. |
113
+ | `stream` | boolean | `false` | Request SSE and show provisional rating/text updates. Normal automatic approval waits for a completed, validated report; fast mode can approve on an early Safe rating. Approval rules are described below. |
124
114
  | `reviewBash` | boolean | `true` | Review native `shell` permissions. The option keeps its existing name. |
125
115
  | `reviewEdits` | boolean | `true` | Review native `edit`, `write` and `patch` tools, which use the `edit` permission action. |
126
116
  | `reviewSkills` | boolean | `true` | Skill-review category switch. Exact mandatory skill instructions are currently unavailable to the V2 collector, so these requests remain manual. |
127
117
  | `reviewMcp` | boolean | `false` | MCP-review category switch. V2 MCP collection is currently unsupported; enabling this does not supply missing origin/catalog evidence or permit automatic approval. |
128
118
  | `reviewCustomTools` | boolean | `false` | Custom-tool review category switch. V2 custom-tool collection is currently unsupported; these requests remain manual. |
129
119
  | `reviewExternalDirectories` | boolean | `false` | Review directory access independently of operation-review switches. Directory approval can resume the operation without another prompt. |
130
- | `autoApprove` | boolean | `false` | Allow Safe reviews once automatically. Normally waits for completion, validation and the countdown. Requires the top-level conversation and physical presentation proof; subagent browsing never permits automatic approval. Normal-mode report-history cover has a separate physical-proof exception. |
120
+ | `autoApprove` | boolean | `false` | Allow Safe reviews once automatically. Normally waits for completion, validation and the countdown. Works throughout the current conversation, including subagent browsing and hidden/covered reports. Home, dashboards, unrelated conversations and native permission decision editing wait without cancellation. |
131
121
  | `fastMode` | boolean | `false` | Requires `autoApprove: true`. Approve an eligible, front-of-queue request as soon as a Safe rating is parsed, bypassing the countdown. Respects `stream`; with `stream: false`, waits for the complete validated response. Finish the report and save it in the background after approval. |
132
122
  | `extraCareful` | boolean | `true` | Include extra-careful guidance when `autoApprove` is enabled. Setting `false` omits that guidance without disabling automatic approval. |
133
123
  | `autoApproveDelaySeconds` | integer | `15` | `0`–`3600` seconds. Positive values include an extra 200 ms initial grace; `0` skips the wait but keeps the other approval checks. Ignored in fast mode. |
@@ -142,10 +132,10 @@ inclusive, fractions are invalid, and the maximum safe integer is
142
132
  | `maxFiles` | integer | `6` | `1`–`1000` distinct file candidates per shell/edit review, including unavailable candidates. |
143
133
  | `maxEvidenceBytes` | integer | `131072` | `1`–`16777216` bytes for command/source content, edit diffs or category-specific JSON evidence. Optional items are omitted whole; oversized mandatory evidence fails analysis. This is not a cap on the full prompt or HTTP request. |
144
134
 
145
- Notification channels are independent: `banner: false, sound: true` is sound-only;
146
- `banner: true, sound: false` is banner-only; both `false` disable that type.
135
+ Notification channels are independent: `banner: false, sound: true` is sound-only,
136
+ `banner: true, sound: false` is banner-only, both `false` disable that type.
147
137
  `notify` and `notifySound` take precedence. Invalid notification settings disable
148
- notification work without invalidating otherwise valid review settings.
138
+ notification.
149
139
 
150
140
  My LLMs insist on writing a bunch of useless text to my README, so I collapsed them here in case anyone wants to inflict themselves (or more likely their agent) the pain of reading it.
151
141
 
@@ -156,18 +146,20 @@ Markdown and scrolling. If the sidebar is hidden, use OpenCode's Show sidebar
156
146
  command.
157
147
 
158
148
  The reviewer panel appears only in the main conversation. Opening any subagent,
159
- including a nested one, hides the panel and prevents normal and fast auto-approval.
160
- Reviews may still finish while hidden. If a Safe report has never started a normal
161
- countdown, returning to the main conversation can start a fresh one once the host
162
- confirms the panel is visible. Leaving after a countdown starts cancels auto-approval
163
- for that request for the rest of that plugin run. Returning or disabling and
164
- re-enabling review won't restart it.
165
-
166
- Auto-approval requires mouse tracking so the host can check that the panel is
167
- visible and receives clicks. With mouse tracking off, you can still read reports
168
- and approve requests manually. The plugin doesn't enable mouse tracking or reveal
169
- a hidden sidebar unless you click an approval notification; it checks that the
170
- sidebar is absent from the main conversation before showing it.
149
+ including a nested one, hides the panel but does not stop normal or fast auto-approval
150
+ within that conversation. A Safe report need not be displayed before approval.
151
+ Command selectors, dialogs, report history, other session panels, sidebar hiding,
152
+ terminal resizing and disabled mouse tracking do not cancel automation.
153
+
154
+ Home, dashboard routes and unrelated conversations hold approval until you return
155
+ to the request's conversation. A countdown already started keeps its original
156
+ deadline; if it expires while waiting, approval can proceed immediately on return
157
+ after fresh checks. A review that has never started a countdown starts its full
158
+ delay when its conversation becomes eligible.
159
+
160
+ The plugin doesn't enable mouse tracking or reveal a hidden sidebar unless you
161
+ click an approval notification; it checks that the sidebar is absent from the main
162
+ conversation before showing it. Hidden automatic reports are saved normally.
171
163
 
172
164
  The skill, MCP and custom-tool options are still present, but these reviews aren't
173
165
  supported in V2. The reviewer can't get the required skill instructions or verify
@@ -189,15 +181,13 @@ operation evidence is verified. Context can't override the review rules.
189
181
  With streaming enabled, Evaluating and its spinner disappear when a rating arrives.
190
182
  The rating is provisional until the full response passes validation. A retry
191
183
  clears the preview and brings back the loading indicator. Normal auto-approval
192
- waits for the full validated report and for the host to confirm that it's displayed
193
- in the main conversation.
184
+ waits for the full validated report, then the configured countdown.
194
185
 
195
186
  With `autoApprove: true` and `fastMode: true`, a parsed Safe rating can approve the
196
187
  request before the streamed report finishes, without a countdown. The request must
197
- be first in OpenCode's permission queue, and the host must confirm the panel is
198
- visible in the main conversation. Browsing a subagent, hiding the sidebar or
199
- covering it with a dialog or report history prevents fast approval. Without
200
- streaming, fast mode waits for the full validated response, then skips the countdown.
188
+ be first in OpenCode's permission queue and belong to the currently viewed conversation
189
+ or its descendants. The report may be hidden or covered. Without streaming, fast
190
+ mode waits for the full validated response, then skips the countdown.
201
191
 
202
192
  After confirmed fast approval, the live panel shows **Auto-approved; finishing
203
193
  report…** and stays ahead of newer requests until its report finishes. Hiding the
@@ -220,14 +210,15 @@ limits and overall timeout still apply. Retried requests can incur additional
220
210
  provider charges, and unreported usage remains unknown.
221
211
 
222
212
  During an auto-approval countdown, click the countdown to allow once immediately,
223
- or Cancel to leave the request manual. Hiding or covering the panel cancels the
224
- countdown too, except when this plugin's report history is displayed in the main
225
- conversation and passes the host's visibility checks. Browsing any subagent or
226
- switching conversations cancels it. Returning, reopening the panel or re-enabling
227
- review won't restart a canceled countdown. If the plugin can't confirm the result
228
- of an approval attempt, it leaves the request manual and never retries that attempt.
229
- Cancel before using native Allow always or rejection
230
- forms; those forms alone do not stop the countdown.
213
+ or Cancel to leave the request manual. Only explicit stop actions, such as Cancel,
214
+ disabling review, or native interruption/rejection, stop automation for that request.
215
+ Returning, reopening the panel or re-enabling review won't restart a canceled countdown.
216
+ Selecting native Allow always or Reject, or editing a rejection reason, holds
217
+ approval without cancellation. Returning to Allow once resumes eligibility with
218
+ the original countdown deadline. Ambiguous native choice state also waits.
219
+ Temporary queue/cache/read failures wait and recover after fresh verification.
220
+ Changed or unverifiable requests remain manual. If the plugin can't confirm the
221
+ result of a sent approval attempt, it never retries that write.
231
222
  Cancel remains available during native preparation, until the approval is sent.
232
223
  Positive countdowns add a 200 ms initial grace and then update on remaining-time
233
224
  boundaries. A zero-second setting still approves without that grace.
@@ -236,6 +227,12 @@ boundaries. A zero-second setting still approves without that grace.
236
227
  descendants. The setting is saved for resume. Both commands are also in the command
237
228
  palette. Disabling stops unapproved reviews and countdowns while native permission
238
229
  controls remain available. Already-approved fast-mode reports finish in the background.
230
+ The commands remain available when review configuration or the companion is unavailable;
231
+ they save the preference without starting reviews.
232
+
233
+ At startup, the reviewer retries timed-out or not-yet-available companion handshakes
234
+ for up to 10 seconds. If it remains unavailable, history and notifications still work;
235
+ reload the plugin to try again. Invalid handshake data is not retried.
239
236
 
240
237
  If the server reconnects or the companion is replaced, reviews and auto-approval
241
238
  stop. Reload the plugin or restart OpenCode to resume. This keeps cached permissions
@@ -250,8 +247,7 @@ PageUp/PageDown scroll. Close or Escape closes history. Repeating the command
250
247
  returns to the newest report. History remains available with review disabled or
251
248
  invalid reviewer configuration. The history command preserves a hidden sidebar;
252
249
  clicking an approval notification reveals it and selects that permission's live or saved report.
253
- Keyboard browsing also works with mouse tracking off; that does not grant
254
- automatic-approval history cover.
250
+ Keyboard browsing also works with mouse tracking off.
255
251
 
256
252
  Each entry shows the original report, available usage, model, provider and outcome:
257
253
  **Auto approved**, **Manually approved**, **Cancelled**, or **Rejected**. Cancelled
@@ -261,12 +257,8 @@ native Allow once replies whose submitting client cannot be identified. History
261
257
  keeps the latest completed report, which can differ from the report that caused
262
258
  approval in another window.
263
259
 
264
- In normal mode, opening report history can leave a countdown running in the main
265
- conversation. The host must confirm that the history heading and footer are visible
266
- and the review report is rendered. A newly completed Safe review can become eligible
267
- for a countdown under the same checks. OpenCode dialogs, including the command palette, still cancel an
268
- active countdown; opening history afterward won't restart it. History blocks fast
269
- approval. Browsing saved reports doesn't itself approve requests or replay notifications.
260
+ Opening report history does not hold normal or fast auto-approval for eligible live
261
+ requests. Browsing saved reports doesn't itself approve requests or replay notifications.
270
262
 
271
263
  Reports are saved only after a permission resolution that qualifies for history.
272
264
  They can contain private text and are kept under OpenCode's local state base:
@@ -276,9 +268,11 @@ storage, the plugin uses its private, plugin-owned sibling
276
268
  `opencode-reviewer-state/opencode-reviewer/` without changing host-directory permissions.
277
269
  An existing safe sibling database remains in use across restarts. Conversation
278
270
  enable/disable settings stay in the original OpenCode state directory.
279
- The plugin deletes them only when it can verify that a deleted conversation belongs
280
- to the matching server and scope. If that can't be verified after an offline
281
- deletion, it keeps the history; a missing list entry or bare 404 isn't enough.
271
+ Saved modes require private ownership and a nonreplaceable path; an untrusted or
272
+ unreadable mode suspends review rather than silently enabling it.
273
+ Deleting a conversation currently leaves its saved history in place. Known live
274
+ deletion events invalidate only volatile session state, not saved reports or totals.
275
+ A missing list entry or bare 404 cannot prove deletion ownership.
282
276
  Windows using the same state directory share history, grouped by host directory
283
277
  and main conversation. Reports not yet saved can be lost on shutdown or during a
284
278
  prolonged storage failure.
@@ -303,7 +297,7 @@ review counts once, even without usage data; a fresh review after re-enabling co
303
297
  again. Retries count extra API attempts actually dispatched, including format
304
298
  corrections and transport recovery. Manual approvals are not auto-approvals.
305
299
  Timings run from evaluation start, including evidence and retries, to the accepted
306
- attempt's first rating and final validated response, excluding rendering/countdown
300
+ attempt's first rating and final validated response, excluding countdown
307
301
  time. Non-streaming reviews use the final response time for both measurements.
308
302
  Averages use running means and sample counts; stored review details also retain
309
303
  their individual timings. Both scopes persist in the existing history database
@@ -343,8 +337,8 @@ terminal is focused:
343
337
  - **Session needs attention:** manual permissions. Reviewed requests
344
338
  stay silent during identification, report generation and retries. Final Safe
345
339
  reports notify when auto-approval is disabled or canceled, or after failed approval
346
- is confirmed to remain pending. Waiting for rendering, queue position or an
347
- automatic countdown to start does not trigger attention. Disabled/unsupported
340
+ is confirmed to remain pending. Waiting for conversation eligibility, native priority
341
+ or an automatic countdown to start does not trigger attention. Disabled/unsupported
348
342
  reviews and terminal analysis failures can notify without a report.
349
343
  - **Unsafe permission needs human approval:** a completed, validated Unsafe review,
350
344
  with its own sound. Provisional streamed ratings never notify.
@@ -358,7 +352,8 @@ terminal is focused:
358
352
  wait for the previous player to finish, so successive alerts do not overlap.
359
353
  - **Session error:** an unrecovered session/provider failure, not a review failure.
360
354
  - **Session ended:** a completed root-agent response, not a question/permission
361
- pause or an explicit user interruption.
355
+ pause or an explicit user interruption. Waits until the conversation's subagents,
356
+ shells and terminals have finished, including work the main agent stopped waiting for.
362
357
 
363
358
  Permission attention, Unsafe and question notifications, including their reminders,
364
359
  apply only to the current native input blocker in each visited root conversation.
@@ -450,6 +445,6 @@ After building, run `node scripts/test-runtime.mjs --profile ci` for that same
450
445
  profile. Use `node scripts/test-runtime.mjs --list` for the complete runtime
451
446
  inventory or `node scripts/test-runtime.mjs --plan --profile ci` for a
452
447
  host-independent plan. Profiles select documented scenario/flag combinations;
453
- interactive desktop checks and historical replays have separate prerequisites.
448
+ interactive desktop checks have separate prerequisites.
454
449
  See [AGENTS.md](https://github.com/mightykatun/opencode-reviewer/blob/main/AGENTS.md)
455
450
  for runtime tests and the tag-driven release process.