opencode-reviewer 0.8.0 → 1.0.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.
- package/README.md +112 -43
- package/dist/tui.js +596 -223
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
# OpenCode Reviewer
|
|
2
2
|
|
|
3
3
|
Reviews pending permissions in the OpenCode sidebar using a separate LLM. Covers
|
|
4
|
-
shell commands, file edits, MCP calls, custom tools, and external-directory access.
|
|
4
|
+
shell commands, file edits, skill loading, MCP calls, custom tools, and external-directory access.
|
|
5
5
|
Supports streaming explanations, saved report history, auto-approval, and Linux
|
|
6
6
|
desktop notifications with distinct sounds.
|
|
7
7
|
|
|
8
|
+
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.
|
|
9
|
+
|
|
10
|
+
> ⚠️ **Disclaimer**
|
|
11
|
+
>
|
|
12
|
+
> This does not make running agents foolproof and safe! An actor running intrusive commands on your machine will always create attack surface! It just reduces risk, and enables you to get more insight into what your agent is doing.
|
|
13
|
+
|
|
8
14
|

|
|
9
15
|
|
|
10
16
|
Requires OpenCode 1.18.35 or newer on Linux.
|
|
@@ -29,10 +35,12 @@ OpenCode installs the [npm package](https://www.npmjs.com/package/opencode-revie
|
|
|
29
35
|
"stream": false,
|
|
30
36
|
"reviewBash": true,
|
|
31
37
|
"reviewEdits": true,
|
|
38
|
+
"reviewSkills": true,
|
|
32
39
|
"reviewMcp": false,
|
|
33
40
|
"reviewCustomTools": false,
|
|
34
41
|
"reviewExternalDirectories": false,
|
|
35
42
|
"autoApprove": false,
|
|
43
|
+
"fastMode": false,
|
|
36
44
|
"extraCareful": true,
|
|
37
45
|
"autoApproveDelaySeconds": 15,
|
|
38
46
|
"notify": true,
|
|
@@ -48,7 +56,7 @@ OpenCode installs the [npm package](https://www.npmjs.com/package/opencode-revie
|
|
|
48
56
|
},
|
|
49
57
|
"notificationSoundDirectory": "/absolute/path/to/notification-sounds",
|
|
50
58
|
"formatRetries": 1,
|
|
51
|
-
"maxOutputTokens":
|
|
59
|
+
"maxOutputTokens": 4096,
|
|
52
60
|
"timeoutMs": 30000,
|
|
53
61
|
"maxFiles": 6,
|
|
54
62
|
"maxEvidenceBytes": 131072
|
|
@@ -67,34 +75,53 @@ launching OpenCode. The inline key takes precedence. Omit both for an unauthenti
|
|
|
67
75
|
endpoint. Remove `instructions` to use the built-in prompts and
|
|
68
76
|
`notificationSoundDirectory` to use the bundled sounds.
|
|
69
77
|
|
|
70
|
-
The
|
|
71
|
-
|
|
72
|
-
|
|
78
|
+
The connection, credential and directory values above are examples, not defaults.
|
|
79
|
+
All boolean, numeric and per-type notification values shown are the defaults.
|
|
80
|
+
Restart OpenCode after changing configuration. Reviews run when OpenCode asks for
|
|
81
|
+
permission, so set the relevant rules to `ask` in `opencode.json`. Existing `allow`
|
|
82
|
+
rules skip review.
|
|
73
83
|
|
|
74
84
|
## Options reference
|
|
75
85
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
|
83
|
-
|
|
|
84
|
-
| `
|
|
85
|
-
| `
|
|
86
|
-
| `
|
|
87
|
-
| `
|
|
88
|
-
| `
|
|
89
|
-
| `
|
|
90
|
-
| `
|
|
91
|
-
| `
|
|
92
|
-
| `
|
|
93
|
-
| `
|
|
94
|
-
| `
|
|
95
|
-
| `
|
|
96
|
-
| `
|
|
97
|
-
| `
|
|
86
|
+
These are options inside the plugin's configuration object in `tui.json`.
|
|
87
|
+
Defaults apply only to omitted options; `null` is invalid. Boolean and integer
|
|
88
|
+
options require JSON booleans and numbers, not quoted strings. Integer ranges are
|
|
89
|
+
inclusive, fractions are invalid, and the maximum safe integer is
|
|
90
|
+
9,007,199,254,740,991. Unknown option names are rejected.
|
|
91
|
+
|
|
92
|
+
| Option | Type | Default | Accepted values and behavior |
|
|
93
|
+
| --- | --- | --- | --- |
|
|
94
|
+
| `baseURL` | string | Required | HTTP(S) API base URL; `/chat/completions` is appended after removing trailing slashes. Embedded credentials, query strings and fragments are rejected. |
|
|
95
|
+
| `model` | string | Required | Nonempty model identifier accepted by the configured endpoint. |
|
|
96
|
+
| `apiKey` | string | Unset | Nonempty Bearer token. Takes precedence over `apiKeyEnv`. |
|
|
97
|
+
| `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. |
|
|
98
|
+
| `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. |
|
|
99
|
+
| `stream` | boolean | `false` | Request SSE and show provisional rating/text updates. Normal automatic approval waits for a completed, validated and rendered report; fast mode can approve on an early Safe rating. |
|
|
100
|
+
| `reviewBash` | boolean | `true` | Review native shell-command permissions. |
|
|
101
|
+
| `reviewEdits` | boolean | `true` | Review native `edit`, `write` and `apply_patch` permissions. |
|
|
102
|
+
| `reviewSkills` | boolean | `true` | Review native skill-load permissions for dangerous guidance and relevance to the current task. Supplies the host's skill instructions and bounded, directly referenced supporting files within the skill directory. |
|
|
103
|
+
| `reviewMcp` | boolean | `false` | Review identifiable MCP tool and resource permissions. |
|
|
104
|
+
| `reviewCustomTools` | boolean | `false` | Review permissions requested by registered custom tools. |
|
|
105
|
+
| `reviewExternalDirectories` | boolean | `false` | Review directory access independently of operation-review switches. Directory approval can resume the operation without another prompt. |
|
|
106
|
+
| `autoApprove` | boolean | `false` | Allow Safe reviews once automatically. Normally waits for completion, validation, rendering and the countdown, including behind this plugin's report history. |
|
|
107
|
+
| `fastMode` | boolean | `false` | Requires `autoApprove: true`. Approve a visible, 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. |
|
|
108
|
+
| `extraCareful` | boolean | `true` | Include extra-careful guidance when `autoApprove` is enabled. Setting `false` omits that guidance without disabling automatic approval. |
|
|
109
|
+
| `autoApproveDelaySeconds` | integer | `15` | `0`–`3600` seconds. Positive values have an extra one-second initial hold; `0` skips the wait but retains rendering and eligibility checks. Ignored in fast mode. |
|
|
110
|
+
| `notify` | boolean | `true` | Master switch for desktop banners, sounds and reminders. `false` overrides all per-type controls. |
|
|
111
|
+
| `notifySound` | boolean | `true` | Master switch for notification audio. `false` silences every type and reminder without disabling enabled banners. |
|
|
112
|
+
| `staleReminderSeconds` | integer | `60` | `0` through the maximum safe integer, in seconds. `0` disables reminders; otherwise eligible pending human interactions repeat at this interval, limited to the native front-of-queue blocker per conversation. |
|
|
113
|
+
| `notifications` | object | All types: `banner: true`, `sound: true` | Keys: `attention`, `unsafe`, `question`, `approved`, `error`, `ended`. Each entry is an object with optional `banner` and `sound` booleans. Omitted types/fields remain enabled; unknown types/fields are invalid. Controls also apply to reminders. |
|
|
114
|
+
| `notificationSoundDirectory` | string | Unset (bundled sounds) | Absolute, NUL-free path, at most 4096 string code units. Use the six notification type names as basenames: usable `.wav` first, then `.mp3`, then the corresponding bundled sound. |
|
|
115
|
+
| `formatRetries` | integer | `1` | `0`–`100` additional assessment-format correction attempts. `0` disables format corrections, not independent transport recovery. |
|
|
116
|
+
| `maxOutputTokens` | integer | `4096` | `1` through the maximum safe integer. Sent as `max_tokens` on every reviewer POST, including retries/corrections. Your provider/model enforces its supported output limit. |
|
|
117
|
+
| `timeoutMs` | integer | `30000` | `1`–`3600000` milliseconds shared across evidence collection, HTTP requests, retries and corrections; not a fresh budget per POST. |
|
|
118
|
+
| `maxFiles` | integer | `6` | `1`–`1000` distinct file candidates per shell/edit/skill review, including unavailable candidates. Skill reviews count the main instructions as one file. |
|
|
119
|
+
| `maxEvidenceBytes` | integer | `131072` | `1`–`16777216` bytes for command/source content, edit diffs or category-specific JSON evidence. Skill reviews share this budget between mandatory skill JSON and UTF-8 supporting-file content. Optional items are omitted whole; oversized mandatory evidence fails analysis. This is not a cap on the full prompt or HTTP request. |
|
|
120
|
+
|
|
121
|
+
Notification channels are independent: `banner: false, sound: true` is sound-only;
|
|
122
|
+
`banner: true, sound: false` is banner-only; both `false` disable that type.
|
|
123
|
+
`notify` and `notifySound` take precedence. Invalid notification settings disable
|
|
124
|
+
notification work without invalidating otherwise valid review settings.
|
|
98
125
|
|
|
99
126
|
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.
|
|
100
127
|
|
|
@@ -104,11 +131,42 @@ The sidebar shows Safe, Unsafe, or Analysis unavailable. Explanations support
|
|
|
104
131
|
Markdown and scrolling. If the sidebar is hidden, use OpenCode's Show sidebar
|
|
105
132
|
command.
|
|
106
133
|
|
|
134
|
+
Skill-load review is enabled by default; set `skill` permissions to `ask` in
|
|
135
|
+
`opencode.json` to receive reviews. Its prompt requires both bounded risk and clear
|
|
136
|
+
relevance to the current work. A harmless but irrelevant skill is rated Unsafe.
|
|
137
|
+
The reviewer receives the exact main instructions from the host's skill catalog,
|
|
138
|
+
plus bounded snapshots of directly referenced local files within the skill directory.
|
|
139
|
+
It does not execute scripts, follow references in supporting files, expand directory
|
|
140
|
+
listings, fetch external URLs, or read supporting files outside that directory.
|
|
141
|
+
Built-in skills without a local directory receive instruction-only review.
|
|
142
|
+
Customize this guidance with `SKILL-REVIEW-PROMPT.md` in your prompt directory.
|
|
143
|
+
|
|
144
|
+
For every review category, subagent requests include the latest immediate delegation
|
|
145
|
+
linked to the requesting assistant invocation, alongside the genuine root-user prompt.
|
|
146
|
+
Resumed subagents use the current delegation; nested subagents include only their
|
|
147
|
+
immediate delegation. Missing or over-64-KiB delegation text is noted rather than
|
|
148
|
+
replaced with an older task. Both prompts are context for the reviewer, not instructions
|
|
149
|
+
that can override its review contract.
|
|
150
|
+
|
|
107
151
|
With streaming enabled, Evaluating and its spinner disappear when a rating arrives.
|
|
108
152
|
The rating remains provisional until the full response is validated. A retry
|
|
109
|
-
clears the preview and restores the loading indicator.
|
|
153
|
+
clears the preview and restores the loading indicator. Normal auto-approval
|
|
110
154
|
starts only after the full response is validated and rendered.
|
|
111
155
|
|
|
156
|
+
With `autoApprove: true` and `fastMode: true`, a parsed Safe rating approves the
|
|
157
|
+
current visible permission immediately, without a countdown or waiting for the
|
|
158
|
+
rest of a streamed report. Hidden panels and covering dialogs or history prevent
|
|
159
|
+
fast approval. Without streaming, fast mode waits for the full validated response
|
|
160
|
+
and then skips the countdown.
|
|
161
|
+
|
|
162
|
+
After confirmed fast approval, the live panel shows **Auto-approved; finishing
|
|
163
|
+
report…** and stays ahead of newer requests until its report finishes. Hiding the
|
|
164
|
+
panel, changing conversations or disabling review does not stop that already-approved
|
|
165
|
+
assessment. Normal retries and the original deadline still apply. The panel closes
|
|
166
|
+
when the assessment finishes; history saves continue in the background. Only a
|
|
167
|
+
completed validated report is saved, including a final Unsafe rating after a retry.
|
|
168
|
+
A failed remainder creates no report entry and cannot undo the earlier approval.
|
|
169
|
+
|
|
112
170
|
Transient connection failures, HTTP 408/429/500/502/503/504 responses, and rejected
|
|
113
171
|
assessment streams share up to two internal retries within `timeoutMs`, honoring
|
|
114
172
|
server cooldowns. Stream protocol failures and output-token truncation regenerate
|
|
@@ -131,8 +189,8 @@ before counting down. A zero-second setting still approves without that hold.
|
|
|
131
189
|
|
|
132
190
|
`/reviewer-disable` and `/reviewer-enable` control the current conversation and its
|
|
133
191
|
descendants. The setting is saved for resume. Both commands are also in the command
|
|
134
|
-
palette. Disabling stops
|
|
135
|
-
controls remain available.
|
|
192
|
+
palette. Disabling stops unapproved reviews and countdowns while native permission
|
|
193
|
+
controls remain available. Already-approved fast-mode reports finish in the background.
|
|
136
194
|
|
|
137
195
|
### Report history
|
|
138
196
|
|
|
@@ -141,7 +199,8 @@ open the newest saved report for the current conversation and its descendants.
|
|
|
141
199
|
Left/Right or the arrow buttons select older/newer entries; Up/Down and
|
|
142
200
|
PageUp/PageDown scroll. Close or Escape closes history. Repeating the command
|
|
143
201
|
returns to the newest report. History remains available with review disabled or
|
|
144
|
-
invalid reviewer configuration
|
|
202
|
+
invalid reviewer configuration. The history command preserves a hidden sidebar;
|
|
203
|
+
clicking an approval notification reveals it and selects that permission's live or saved report.
|
|
145
204
|
|
|
146
205
|
Each entry shows the original report, available usage, model, provider and outcome:
|
|
147
206
|
**Auto approved**, **Manually approved**, **Cancelled**, or **Rejected**. Cancelled
|
|
@@ -195,9 +254,9 @@ same state directory. Browsing and switching views do not add usage.
|
|
|
195
254
|
|
|
196
255
|
Older retained history can provide a **partial** conversation baseline. Previously
|
|
197
256
|
deleted details and usage predating history tracking cannot be attributed or
|
|
198
|
-
reconstructed from legacy lifetime aggregates.
|
|
199
|
-
|
|
200
|
-
|
|
257
|
+
reconstructed from legacy lifetime aggregates. Once recorded in conversation totals,
|
|
258
|
+
deleting report details does not reduce those totals or Lifetime. Storage failures
|
|
259
|
+
show unavailable, not zero.
|
|
201
260
|
|
|
202
261
|
Tokens describe received provider usage, not just the visible explanation. One
|
|
203
262
|
report may sum several reviewer POSTs, including format corrections and transport
|
|
@@ -230,19 +289,23 @@ terminal is focused:
|
|
|
230
289
|
reviews and terminal analysis failures can notify without a report.
|
|
231
290
|
- **Unsafe permission needs human approval:** a completed, validated Unsafe review,
|
|
232
291
|
with its own sound. Provisional streamed ratings never notify.
|
|
233
|
-
- **Agent has a question:** a pending agent question
|
|
292
|
+
- **Agent has a question:** a pending agent question at the front of the native
|
|
293
|
+
input queue, with its own sound.
|
|
234
294
|
- **Reviewer approved a permission:** sent with the approval sound after confirmed
|
|
235
|
-
automatic approval,
|
|
295
|
+
automatic approval, including fast mode while its report is still streaming.
|
|
296
|
+
Positive and zero delays also notify on success; the countdown is silent.
|
|
236
297
|
Approval sounds are limited to
|
|
237
298
|
one every two seconds; every eligible banner is retained for delivery.
|
|
238
299
|
- **Session error:** an unrecovered session/provider failure, not a review failure.
|
|
239
300
|
- **Session ended:** a completed root-agent response, not a question/permission
|
|
240
301
|
pause or an explicit user interruption.
|
|
241
302
|
|
|
242
|
-
Permission attention and
|
|
243
|
-
only to the current native
|
|
303
|
+
Permission attention, Unsafe and question notifications, including their reminders,
|
|
304
|
+
apply only to the current native input blocker in each visited root conversation.
|
|
244
305
|
Requests queued behind it stay silent and are re-evaluated from their current
|
|
245
|
-
|
|
306
|
+
state when they become actionable. Questions wait behind pending permissions and
|
|
307
|
+
earlier questions. A request resolved while queued never sends a delayed alert.
|
|
308
|
+
A sequence of permissions that proceeds
|
|
246
309
|
through automatic approval stays free of attention notifications. Losing the
|
|
247
310
|
actionable position, restarting analysis or entering automatic approval cancels
|
|
248
311
|
pending attention delivery and reminders.
|
|
@@ -260,11 +323,11 @@ from initial dispatch, even if desktop delivery fails. Reminders replace their
|
|
|
260
323
|
previous banner and append **(Reminder)** to the event text, reusing the same
|
|
261
324
|
sound, icon, session heading and click target. Only the native front-of-queue
|
|
262
325
|
interaction per root conversation repeats: permissions precede questions, with
|
|
263
|
-
the host's session/request ordering. Queued interactions
|
|
264
|
-
|
|
326
|
+
the host's session/request ordering. Queued interactions stay silent. Handoff sends
|
|
327
|
+
the next eligible request's initial notification, then waits a full interval before
|
|
328
|
+
its first reminder. Independent visited conversations
|
|
265
329
|
can each remind. The supported host presents input for roots and direct children;
|
|
266
|
-
deeper descendants cannot become a native root-input
|
|
267
|
-
reminder target. Their questions can still receive initial question notifications.
|
|
330
|
+
deeper descendants cannot become a native root-input notification or reminder target.
|
|
268
331
|
|
|
269
332
|
Answering/dismissing a question in OpenCode, resolving a permission, deleting its
|
|
270
333
|
session or closing the plugin stops its reminders. Closing/clicking a desktop
|
|
@@ -279,6 +342,12 @@ the originating GNOME Terminal tab and root conversation. Native input prompts
|
|
|
279
342
|
cover root/direct-child requests in the supported host. Open dialogs are
|
|
280
343
|
left intact; other terminals still receive banners and sounds. Desktop policies
|
|
281
344
|
control expiry/history and whether activation actually brings a window forward.
|
|
345
|
+
Clicking **Reviewer approved a permission** opens that permission's unfinished
|
|
346
|
+
fast-mode report, or its matching saved report if it has completed, revealing the
|
|
347
|
+
sidebar if hidden. If a dialog is open, navigation waits until it closes and then
|
|
348
|
+
checks whether the report is still live. A clicked live panel closes on completion
|
|
349
|
+
like any fast-mode report. A pending save gets up to five seconds; if the report is
|
|
350
|
+
unavailable or deleted, the click just opens its conversation rather than a different report.
|
|
282
351
|
GNOME Terminal clicks use the desktop activation token to bring the correct tab
|
|
283
352
|
forward across workspaces. GNOME may attribute the notification source to Terminal;
|
|
284
353
|
the banner heading remains Opencode.
|