@kealthas-dev/opencode-llm-review-gate 1.1.8 → 1.1.10
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 +3 -3
- package/llm-review-gate.ts +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
Gates `bash` tool calls behind an LLM safety review. Before a command runs it is sent to a hidden, throwaway opencode session that answers ALLOW or BLOCK; this sits on top of opencode's own permission config, it does not replace it.
|
|
4
4
|
|
|
5
5
|
- Package: `@kealthas-dev/opencode-llm-review-gate`, source `llm-review-gate.ts`.
|
|
6
|
-
- **Opt-in.** The plugin line is commented out in `deploy/opencode.
|
|
6
|
+
- **Opt-in.** The plugin line is commented out in `deploy/opencode.jsonc.example` because it adds a hidden model call before every `bash` command and can block commands. Uncomment it to enable (SETUP.md step 5).
|
|
7
7
|
- Fails closed: a review error or timeout blocks the command (`FAIL_OPEN_ON_ERROR = false` in the source).
|
|
8
8
|
- Never reviews its own review session's calls, so there is no recursion.
|
|
9
9
|
|
|
10
10
|
## Why it is built this way
|
|
11
11
|
|
|
12
|
-
- **A dedicated `review-gate` agent** (defined in `deploy/opencode.
|
|
12
|
+
- **A dedicated `review-gate` agent** (defined in `deploy/opencode.jsonc.example`, no `prompt` override, every tool denied except `review_verdict`). A per-request `system` field is appended after an agent's configured `prompt`, not substituted for it (checked against opencode's `packages/opencode/src/session/llm/request.ts`). Without a dedicated agent the reviewer would inherit the full coding-agent persona from `system-prompt.txt` and answer with chat or tool calls instead of a verdict.
|
|
13
13
|
- **One throwaway session per review**, created right before the prompt and deleted right after. A session is a stateful conversation; reusing one would grow its history by a command-and-verdict turn per review, inflating context and cost and contradicting the "judge this one command in isolation" framing. `session.create`/`session.delete` are metadata calls, not model calls.
|
|
14
|
-
- **The verdict is a real function call.** The plugin registers a `review_verdict(allow, reason?)` tool; `execute()` stores the arguments keyed by the review's session ID and `review()` reads them back after `session.prompt()` resolves. Plugin-registered tools are visible to every agent, so `deploy/opencode.
|
|
14
|
+
- **The verdict is a real function call.** The plugin registers a `review_verdict(allow, reason?)` tool; `execute()` stores the arguments keyed by the review's session ID and `review()` reads them back after `session.prompt()` resolves. Plugin-registered tools are visible to every agent, so `deploy/opencode.jsonc.example` denies it globally and allows it only for `review-gate`. If the model never calls it, `review()` falls back to parsing ALLOW/BLOCK from the text.
|
|
15
15
|
- It is the only plugin with a runtime dependency (`zod`, for the tool's argument schema); the others import only types.
|
|
16
16
|
|
|
17
17
|
## Tests and limits
|
package/llm-review-gate.ts
CHANGED
|
@@ -53,7 +53,7 @@ async function logReview(entry: Record<string, unknown>) {
|
|
|
53
53
|
|
|
54
54
|
// Custom tool the review-gate agent uses to record its verdict as a real
|
|
55
55
|
// function call (confirmed enabled on this deployment's model - see
|
|
56
|
-
// deploy/opencode.
|
|
56
|
+
// deploy/opencode.jsonc.example's "review_verdict" permission, denied globally
|
|
57
57
|
// and re-allowed only for "review-gate"). Keyed by session ID so concurrent
|
|
58
58
|
// reviews never clobber each other.
|
|
59
59
|
//
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kealthas-dev/opencode-llm-review-gate",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.10",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "llm-review-gate.ts opencode plugin (gates bash tool calls behind an LLM safety review before they run, via a real review_verdict function-call tool with a text-parsing fallback), published to npm so opencode's own npm-plugin loader can install it directly from a bare package name in opencode.json's plugin array - see CLAUDE.md. Written in TypeScript against @opencode-ai/plugin's Plugin type (type-only) plus a real `zod` runtime dependency for the tool's argument schema - the one plugin in this repo with an actual runtime dependency, unlike hook-logger.ts
|
|
5
|
+
"description": "llm-review-gate.ts opencode plugin (gates bash tool calls behind an LLM safety review before they run, via a real review_verdict function-call tool with a text-parsing fallback), published to npm so opencode's own npm-plugin loader can install it directly from a bare package name in opencode.json's plugin array - see CLAUDE.md. Written in TypeScript against @opencode-ai/plugin's Plugin type (type-only) plus a real `zod` runtime dependency for the tool's argument schema - the one plugin in this repo with an actual runtime dependency, unlike hook-logger.ts's zero-dependency design. Independently installable from hook-logger.ts - not bundled together.",
|
|
6
6
|
"main": "llm-review-gate.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"llm-review-gate.ts"
|