@noppu-labs/opencode-permission-reviewer 2.4.2 → 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.
Files changed (59) hide show
  1. package/CHANGELOG.md +174 -1
  2. package/LICENSE +21 -201
  3. package/LICENSE-APACHE +201 -0
  4. package/MIGRATION.md +2 -1
  5. package/NOTICE +14 -6
  6. package/README.md +109 -787
  7. package/SECURITY.md +41 -22
  8. package/dist/explain.d.ts +3 -4
  9. package/dist/explain.js +9708 -4298
  10. package/dist/index.d.ts +1096 -987
  11. package/dist/index.js +18646 -10575
  12. package/dist/rpc.d.ts +38 -38
  13. package/dist/rpc.js +30 -18
  14. package/dist/tui/config/jsonc.ts +71 -63
  15. package/dist/tui/config/layer-read.ts +120 -0
  16. package/dist/tui/config/loader.ts +73 -512
  17. package/dist/tui/config/risk-policy-clamp.ts +80 -0
  18. package/dist/tui/config/trust-boundary-keys.ts +102 -0
  19. package/dist/tui/config/trust-boundary.ts +148 -0
  20. package/dist/tui/config/trusted-degradation.ts +97 -0
  21. package/dist/tui/config-fields.ts +75 -0
  22. package/dist/tui/config-knobs.ts +119 -0
  23. package/dist/tui/config-policy-rules.ts +86 -0
  24. package/dist/tui/config-risk-policy.ts +59 -0
  25. package/dist/tui/config-rule-condition.ts +150 -0
  26. package/dist/tui/config.ts +72 -431
  27. package/dist/tui/descriptor-io.ts +42 -0
  28. package/dist/tui/failure-kind.ts +28 -0
  29. package/dist/tui/is-record.ts +13 -0
  30. package/dist/tui/opencode/event-normalizer.ts +41 -31
  31. package/dist/tui/reviewer-model.ts +87 -0
  32. package/dist/tui/system-one-routing.ts +110 -0
  33. package/dist/tui/tui.tsx +97 -99
  34. package/dist/tui/types.ts +206 -596
  35. package/dist/tui/ui/action-fit.ts +161 -0
  36. package/dist/tui/ui/action-spans.tsx +60 -0
  37. package/dist/tui/ui/attribution.ts +113 -0
  38. package/dist/tui/ui/components.tsx +69 -137
  39. package/dist/tui/ui/config-notices.ts +137 -0
  40. package/dist/tui/ui/fit-parts.ts +76 -0
  41. package/dist/tui/ui/manual-toast.ts +87 -0
  42. package/dist/tui/ui/review-connection.ts +32 -0
  43. package/dist/tui/ui/review-feed.ts +156 -0
  44. package/dist/tui/ui/review-overlay.tsx +111 -0
  45. package/dist/tui/ui/review-result.tsx +74 -0
  46. package/dist/tui/ui/review-store.ts +88 -0
  47. package/dist/tui/ui/review-theme.ts +70 -0
  48. package/dist/tui/ui/rpc.ts +5 -2
  49. package/dist/tui/ui/v1-host.ts +66 -0
  50. package/dist/tui/ui/v2.tsx +82 -220
  51. package/dist/tui/ui-protocol.ts +112 -124
  52. package/dist/tui/ui-state.ts +86 -64
  53. package/dist/tui/ui-status-extras.ts +165 -0
  54. package/dist/tui/ui-status-parse.ts +132 -0
  55. package/dist/tui/ui-text-elide.ts +89 -0
  56. package/package.json +24 -23
  57. package/rpc.js +2 -1
  58. package/server.js +2 -2
  59. package/tui.tsx +2 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,179 @@ 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
+
140
+ ## [3.0.0] - 2026-10-12
141
+
142
+ ### Changed
143
+
144
+ - Development: Biome replaces ESLint and Prettier for linting and formatting.
145
+ FTA, knip, gitleaks, the pre-commit hooks and the Python tooling now run
146
+ locally and in CI. The limits are cognitive complexity 12 (tests 14), 600
147
+ lines per file (tests 800) and an FTA cap of 55 (tests not measured); see
148
+ `docs/DEVELOPMENT.md`.
149
+ - Changes made in this fork are now licensed under the MIT License. Code from
150
+ the upstream project remains under the Apache License 2.0, which now ships as
151
+ `LICENSE-APACHE` alongside `NOTICE`. The package `license` field is
152
+ `MIT AND Apache-2.0`.
153
+ - The real-host compatibility matrix now pins OpenCode 1.18.35 and 2.0.26 as
154
+ the verified V1 and V2 references. 2.0.20 moves to the optional V2 window.
155
+ Hosts from 2.0.22 expose `session.remove` to plugins; the reviewer does not
156
+ use it, and the contract test accepts either shape.
157
+ - `NOTICE` now says the reviewer policy is adapted from OpenAI Codex Guardian,
158
+ matching the attribution in `src/policy.ts`, and links the Codex commit it
159
+ was adapted from.
160
+ - Split the README into a short overview and reference pages under `docs/`
161
+ (configuration, reviewer models, how it works, safety, supply chain,
162
+ compatibility, development).
163
+
164
+ ### Removed
165
+
166
+ - **Breaking:** The `./tui` entry no longer re-exports `DEFAULT_CONFIG`,
167
+ `decodeUiStatus` and `ReviewUiState`; it exports only the TUI plugin.
168
+ Import `decodeUiStatus` and `ReviewUiState` from the main entry, and use
169
+ `resolveConfig({})` for the default configuration. This needs the next
170
+ major version.
171
+
172
+ ### Security
173
+
174
+ - The emergency brake recognises more forms of unmistakably destructive
175
+ commands, and the capability analyzer classifies more wrapped commands.
176
+ Tracked privately per SECURITY.md.
177
+ - The command analysis that feeds the reviewer and the emergency brake reads
178
+ more command shapes correctly, and script evidence that follows package
179
+ scripts stays inside the session's approved roots. Host events,
180
+ configuration lookups and audit tallies are handled more strictly. Tracked
181
+ privately per SECURITY.md.
182
+
10
183
  ## [2.4.2] - 2026-10-09
11
184
 
12
185
  ### Added
@@ -150,7 +323,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
150
323
  - Add Jev as a reviewer model choice through OpenCode Zen, TypeSafe AI, or the
151
324
  Command Code Provider API. Use Jev alone, or configure a second LLM such as
152
325
  Luna for difficult decisions. See the [Jev setup
153
- guide](./README.md#jev-system-one-reviewer).
326
+ guide](./docs/REVIEWER-MODELS.md#jev-system-one-reviewer).
154
327
 
155
328
  ### Changed
156
329
 
package/LICENSE CHANGED
@@ -1,201 +1,21 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is generally included in or associated with
38
- the work (for an example, see the appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright 2026 Warc0s
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Noppu Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/LICENSE-APACHE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is generally included in or associated with
38
+ the work (for an example, see the appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Warc0s
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
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/NOTICE CHANGED
@@ -1,13 +1,21 @@
1
1
  OpenCode Permission Reviewer
2
+ Copyright 2026 Noppu Labs
2
3
 
3
- The reviewer policy design is inspired by OpenAI Codex Guardian:
4
+ This project is a fork of warc0s/opencode-permission-reviewer
5
+ (https://github.com/warc0s/opencode-permission-reviewer), Copyright 2026 Warc0s,
6
+ licensed under the Apache License, Version 2.0 (see ./LICENSE-APACHE). Code from
7
+ that project remains under the Apache License, Version 2.0. Changes made in this
8
+ fork are licensed under the MIT License (see ./LICENSE).
4
9
 
5
- https://github.com/openai/codex/tree/main/codex-rs/core/src/guardian
10
+ The reviewer policy in src/policy.ts is adapted from the OpenAI Codex Guardian
11
+ auto-review policy and policy template:
6
12
 
7
- The policy wording and implementation are independent. The plugin adds
8
- OpenCode permission semantics, human escalation, confidence validation,
13
+ https://github.com/openai/codex/tree/c82cb044f3413e6584308d969b94e7a1430711ab/codex-rs/core/src/guardian
14
+
15
+ Its user-authorization ladder, risk taxonomy, tenant policy structure, and
16
+ several definitions are paraphrased or derived from that source. The plugin
17
+ adds OpenCode permission semantics, human escalation, confidence validation,
9
18
  isolated review, and SSH, local-script, and Git evidence enrichment.
10
19
 
11
20
  OpenAI Codex is Copyright OpenAI and contributors and is licensed under the
12
- Apache License, Version 2.0. This project is licensed under the Apache License,
13
- Version 2.0 (see ./LICENSE).
21
+ Apache License, Version 2.0 (see ./LICENSE-APACHE).