@noppu-labs/opencode-permission-reviewer 0.0.0-stage → 2.4.1

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 ADDED
@@ -0,0 +1,632 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [2.4.1] - 2026-10-09
11
+
12
+ ### Changed
13
+
14
+ - Publish this fork to npm as `@noppu-labs/opencode-permission-reviewer`. The
15
+ CLI command stays `opencode-permission-reviewer`.
16
+
17
+ ## [2.4.1-noppu] - 2026-10-09
18
+
19
+ ### Fixed
20
+
21
+ - Keep MCP servers that other plugins add from code, such as
22
+ `@upstash/context7-opencode`, out of the OpenCode V2 reviewer Location. They
23
+ previously made every review fail closed.
24
+
25
+ ## [2.4.0] - 2026-10-02
26
+
27
+ ### Added
28
+
29
+ - Git remote evidence for network subcommands: `git push`, `fetch`, `pull`,
30
+ `ls-remote`, and `git remote` now report each remote operand as a configured
31
+ remote (with the push/fetch URLs it resolves to, credential userinfo
32
+ redacted), a literal URL, or unmatched, plus the default remote an
33
+ operand-less command would contact. The reviewer judges the destination
34
+ from this evidence instead of treating an unresolved alias as unknown.
35
+
36
+ - Recognize `deno` and `tsx` as local script interpreters, attaching the
37
+ executed file as evidence for direct invocations (`deno <file>`,
38
+ `tsx <file>`), `deno run/serve/watch`, and `tsx watch` file targets. Deno
39
+ tasks, package specifiers (`jsr:`/`npm:`/URLs), manifest scripts, and
40
+ ambiguous option forms gather no evidence rather than risk attaching the
41
+ wrong file. Node-family value flags (`--test-reporter-destination` and
42
+ siblings) are skipped for `node` and `tsx` for the same reason.
43
+ - Inspect manifest definitions and bounded local script chains for Bun, npm,
44
+ pnpm, and Yarn script invocations. Referenced local code and conditional
45
+ lifecycle hooks are included as evidence without executing package code or
46
+ assuming the invocation needs network access.
47
+
48
+ ### Changed
49
+
50
+ - Verify compatibility with OpenCode V1 1.18.34 and V2 2.0.21.
51
+ - No lifecycle scripts ship with the package: the `prepare` build hook is
52
+ gone, so installs execute nothing from this repository. The npm registry is
53
+ the supported install source (Git/local installs yield a package without
54
+ `dist/`); build from source explicitly with `bun install && bun run build`.
55
+
56
+ ### Fixed
57
+
58
+ - Attach local script evidence only for the executed interpreter, preserve
59
+ leading-dash file names after `--`, and inspect equally named scripts in
60
+ different working directories separately. Remote commands and interpreter
61
+ mentions no longer attach unrelated local code.
62
+ - Resolve Git repository evidence only for a local Git executable; remote
63
+ commands and command mentions no longer inherit the local repository's state
64
+ or configured destinations.
65
+ - Prevent OpenCode V1's isolated reviewer location from starting another copy
66
+ of globally configured MCP servers. Its local bootstrap excludes MCP, and
67
+ reviews fail closed if the host reports servers or an invalid inventory.
68
+ Isolation files are replaced atomically and reject links and special files.
69
+ Thanks @jg33 for the fix ([#62](https://github.com/warc0s/opencode-permission-reviewer/pull/62)).
70
+ - Preserve reviewer cancellation and timeout errors across garbage collection,
71
+ including waits admitted after a review has already ended.
72
+ - Normalize shell redirections before resolving executables, including glued,
73
+ leading, file-descriptor, clobber, and command-string forms. Redirections can
74
+ no longer hide root destruction, credential reads, network clients, or
75
+ external write targets; heredoc payload text is no longer treated as an
76
+ executed command.
77
+ - Classify `git add`, remote/config/ref mutations, fetch/pull, `dd of=...`,
78
+ attached `sort -o...`, and writes inside worktrees under temporary roots with
79
+ their actual mutation, network, and path effects.
80
+ - Treat V1 inline plugin options as unknown-origin input, matching V2, and keep
81
+ reviewer selection, policy, resource limits, and debug logging under trusted
82
+ global configuration.
83
+ - Redact URL userinfo even when a credential occupies only the username slot,
84
+ and block GitHub config and token-shaped content from file enrichment.
85
+ - Refuse symlinked config files in `init`; planning, backups, and updates now
86
+ hold a no-follow regular-file descriptor through their operation. Config
87
+ parsing and change detection use the same file snapshot.
88
+ - Recognize shell `-c` flag clusters, options after `-c`, `exec`, clustered SSH
89
+ flags, and value-taking wrapper options so they cannot hide destructive
90
+ commands from the emergency brake. Direct `cp` and `install` overwrites of
91
+ block devices are also rejected.
92
+ - Preserve file mutation effects for target-directory options, optional
93
+ option values, rename operands, implicit link destinations, and rsync
94
+ source removal.
95
+ - Keep relative `cd` targets unresolved when the preceding working directory
96
+ is ambiguous, instead of throwing or assuming the initial directory.
97
+ - Resolve attached and trailing Git push `--repo` overrides, and redact URL
98
+ passwords before bounding evidence, including unavailable Git snapshots.
99
+ - Withhold Git snapshots when a successful status process returns incomplete
100
+ output, preserving the planned action without inventing repository state.
101
+ - Include the executed file as local script evidence for `bun run <file>`
102
+ commands; package manifest scripts (`bun run check`) and bun option values
103
+ are not mistaken for the run target.
104
+ - Emergency brake: peel `systemd-run`, `strace`, `ltrace`, and `script -c`
105
+ wrappers (including clustered value-taking options such as `sudo -nu root`
106
+ and `env -iS`), treat a live root glob (`rm -rf /*`) as root destruction,
107
+ and reject shell redirections onto real block devices (`> /dev/sda`,
108
+ glued `2>/dev/sda`, `tee /dev/sda`) in direct and command-string forms.
109
+ - Audit records always land in a mode `0600` file: a pre-existing audit path
110
+ with looser permissions is tightened before receiving new records instead of
111
+ being extended as-is.
112
+ - Recover literal user intent after long operational histories, compaction,
113
+ and host restarts, while keeping synthetic control messages and inherited
114
+ fork messages out of direct authorization evidence.
115
+
116
+ ## [2.3.1] - 2026-09-28
117
+
118
+ ### Fixed
119
+
120
+ - Prevent OpenCode V2 permission reviews from starting additional configured
121
+ MCP processes for each review. Reviews now share an isolated Location without
122
+ MCP servers while keeping their sessions independent.
123
+ - Retry reviewer Location setup after a transient failure and clean up reviewer
124
+ hooks registered after a Location reload.
125
+
126
+ ## [2.3.0] - 2026-09-24
127
+
128
+ ### Added
129
+
130
+ - Add Jev as a reviewer model choice through OpenCode Zen, TypeSafe AI, or the
131
+ Command Code Provider API. Use Jev alone, or configure a second LLM such as
132
+ Luna for difficult decisions. See the [Jev setup
133
+ guide](./README.md#jev-system-one-reviewer).
134
+
135
+ ### Changed
136
+
137
+ - Default to GPT-6 Luna at medium effort and share trusted V1 reviewer settings
138
+ between the server and TUI.
139
+ - Verify compatibility with OpenCode V2 2.0.15.
140
+
141
+ ## [2.2.1] - 2026-09-22
142
+
143
+ ### Changed
144
+
145
+ - Verify compatibility with OpenCode V1 1.18.32 and V2 2.0.14, update the
146
+ matching SDK and client packages, update Zod, and refresh the documented
147
+ support matrix.
148
+
149
+ ## [2.2.0] - 2026-09-20
150
+
151
+ ### Changed
152
+
153
+ - Add a compatibility layer for every stable OpenCode V2 release from 2.0.3
154
+ through 2.0.11. Service connection no longer depends on changing discovery
155
+ endpoints, and the supported host range now covers `>=2.0.3 <3`. Bumped
156
+ `@opencode/client` to 2.0.11; newer V2 releases remain best-effort until
157
+ exercised by the compatibility suite.
158
+ - Negotiate the V2 session wait route by response, use a unique ID for each
159
+ isolated reviewer plugin, dispose host registrations on unload, and load TUI
160
+ snapshots without waiting for an unrelated host event.
161
+
162
+ ### Added
163
+
164
+ - Add a deterministic `credentialRead` capability signal: known file readers
165
+ (`cat`, `head`, `tail`, `less`, `more`, `grep`, `rg`, `sed`, `awk`,
166
+ `base64`, `xxd`, `od`, `strings`, `source`, `.`) with a literal credential
167
+ path operand, or any command with a literal credential path as an input
168
+ (`<`) redirect target, report `credentialRead: true` (otherwise
169
+ `"unknown"`, never `false`). Example and public-key suffixes (`.example`,
170
+ `.sample`, `.template`, `.dist`, `.pub`) never match.
171
+ - Add a `credentialRead` policy condition key (positive-only, AND-composable
172
+ with `networkObserved` and the other keys). No built-in rule uses it; the
173
+ default rule set is unchanged.
174
+ - Record a flattened `credentialRead: true` field in the audit capability
175
+ snapshot (present only when true). Audit `schemaVersion` stays 3.
176
+
177
+ Note: configs using `credentialRead` degrade fail-closed on older plugin
178
+ versions that reject unknown condition keys (the rule is dropped and trusted
179
+ configs block automatic approval until fixed).
180
+
181
+ ### Fixed
182
+
183
+ - Failure-safe denial reasons now include the failure phase and the underlying
184
+ error cause instead of a bare SDK reason word.
185
+
186
+ ## [2.1.0] - 2026-09-17
187
+
188
+ ### Added
189
+
190
+ - Inspect verified remote SSH scripts from bounded local evidence, with a
191
+ SHA-256 check of the staged script before remote execution.
192
+ - Add `script command` to generate the guarded SSH invocation from a local file.
193
+ - Add the repository-only PRB-600 synthetic reviewer benchmark and publish
194
+ results for nine complete model evaluations.
195
+ - Test V2 host connection rejection for unsafe URLs, missing authentication,
196
+ and instance identity mismatch.
197
+
198
+ ### Changed
199
+
200
+ - Clarify V1 and V2 configuration paths and document the limits of automatic
201
+ approval and failure handling.
202
+
203
+ ## [2.0.0] - 2026-09-16
204
+
205
+ ### Added
206
+
207
+ - Separate OpenCode V1 and V2 server adapters with a shared evaluation engine.
208
+ - Isolated V2 reviewer sessions, validated structured output, authenticated
209
+ cleanup, total review deadlines, and generation-aware status RPC.
210
+ - Dual raw TSX interface, host-aware installation, and separate pytest host harnesses.
211
+ - Compact V2 review progress strip with model, action, and elapsed time.
212
+
213
+ ### Changed
214
+
215
+ - Require OpenCode V1 1.18.29 or newer, or the pinned V2 2.0.3 release.
216
+ - Preserve JSONC comments during installation and distinguish planned writes.
217
+ - Record independent review identity and application state for both hosts with audit schema 3.
218
+ - Verify compatibility with OpenCode V1 1.18.31 and reject missing TUI runtime
219
+ dependencies during the build.
220
+
221
+ ### Fixed
222
+
223
+ - Preserve valid denials below the automatic approval confidence threshold.
224
+ - Show unknown UI status after a watchdog timeout instead of inventing a manual request.
225
+ - Preserve reply acknowledgement ordering and bounded failure handling during shutdown or overload.
226
+ - Reject misspelled trusted policy condition values without allowing an unsafe
227
+ fallback, and align UI review deadlines with the server budget.
228
+
229
+ ## [1.3.3] - 2026-09-13
230
+
231
+ ### Changed
232
+
233
+ - Bumped `@opencode-ai/plugin` to 1.18.30 and `@opentui/core`/`@opentui/solid`
234
+ to 0.5.11, with `bun.lock` synchronized (dependency bumps only; no behavior
235
+ change). `solid-js` stays pinned at 1.9.12, matching the exact peer
236
+ requirement of `@opentui/solid`.
237
+
238
+ ### Fixed
239
+
240
+ - The audit report reader no longer drops a complete line at the start of its
241
+ bounded tail window: when the file exceeds the 64 MiB read cap, the reader
242
+ peeks at the byte before the window and only strips the first line when it
243
+ may be partial (no preceding newline). A window that starts at a line
244
+ boundary now summarizes every line it read.
245
+ - A failed audit directory creation degrades the same way an append failure
246
+ does: the record is lost, the failure is logged, and the writer never
247
+ throws. Previously the mkdir rejection propagated to the caller and stuck
248
+ to the cached promise; the writer now logs, drops the record, and retries
249
+ the mkdir on the next record.
250
+
251
+ ## [1.3.2] - 2026-09-12
252
+
253
+ ### Added
254
+
255
+ - The TUI overlay now covers pending reviews: an in-flight review renders in
256
+ the overlay panel while it runs, with resolved results kept below, so the
257
+ user sees what is being decided instead of only learning the outcome.
258
+ - A live host-regression harness exercises provider tools and end-to-end
259
+ review decisions against a real server, guarding the reviewer transport and
260
+ the deterministic brake paths outside unit tests.
261
+
262
+ ### Changed
263
+
264
+ - Bumped `@opencode-ai/plugin` to 1.18.28 and `@opentui/core`/`@opentui/solid`
265
+ to 0.5.10, with `bun.lock` synchronized (dependency bumps only; no behavior
266
+ change).
267
+ - The exact pending action now leads the reviewer evidence and reserves the
268
+ head of the context budget, with actor, lineage, and intent sections
269
+ following it — previously the action could be truncated away while context
270
+ survived. Session lineage additionally records its origin (human root vs
271
+ delegated), and whether the action evidence survived truncation is tracked
272
+ explicitly so the reviewer judges a complete view of the action or the
273
+ decision escalates.
274
+
275
+ ### Fixed
276
+
277
+ - The redaction rule for auth-scheme tokens (`Bearer`/`Basic`/`Token`)
278
+ treated the `-` in its character class as a range, so tokens containing
279
+ dashes were never matched as a whole and could reach the reviewer
280
+ unredacted; the dash is now a literal member of the class.
281
+ - Reviewer sessions now run in a scratch directory outside the project, so
282
+ repository instructions (`AGENTS.md`, project config instructions, project
283
+ MCP context) never enter the reviewer's system prompt; every tool is denied
284
+ by a wildcard session permission rule that also covers MCP tools. If the
285
+ isolated directory cannot be established, the review escalates to the human
286
+ as a reviewer failure instead of running inside the project with degraded
287
+ isolation.
288
+ - Automatic approval is now blocked while the trusted configuration is
289
+ degraded or a material part of the pending action was elided from the
290
+ evidence: invalid policy rules in trusted (global/inline) layers are
291
+ rejected at load and keep auto-approval disabled until fixed, instead of a
292
+ narrowed config silently permitting more.
293
+ - The shared per-directory git conversion-filter scan now parses
294
+ NUL-delimited (`-z`) output, so a legal filter subsection containing a
295
+ space (e.g. `[filter "a b"]`) is neutralized like any other instead of
296
+ being mis-parsed and silently left active. A name containing `=` cannot be
297
+ expressed through `-c` overrides, so it withholds the snapshot (fail
298
+ closed) rather than arming the wrong key — same as the existing over-limit
299
+ refusals.
300
+ - The deterministic emergency brake now peels `timeout`, `xargs`, and `watch`
301
+ wrappers before judging the executable, so `timeout 5 curl …`, `watch -n 5
302
+ curl …`, and piped `xargs curl …` trip the secret-export brake and
303
+ `timeout --signal=KILL 10s rm -rf /` trips root destruction. `timeout`
304
+ skips its mandatory duration operand explicitly; benign commands under
305
+ these wrappers (`watch ls`, `timeout 5 make`) stay quiet.
306
+ - Project config can no longer weaken trusted layers: null and wrong-type
307
+ overrides are dropped instead of resetting defaults, the reviewer model
308
+ and policy text are not project-settable, and malformed config files warn
309
+ instead of silently degrading. User intent is attributed by session origin,
310
+ so no child-session message counts as human authorization.
311
+ - Filesystem reads and writes in the decision path go through explicitly
312
+ opened, verified descriptors: config layers are rejected when symlinked,
313
+ non-regular, or oversized (a committed link to a FIFO or an endless source
314
+ can no longer hang or exhaust startup); audit records are appended through
315
+ a descriptor that refuses symlinked and non-regular targets and applies
316
+ `0600` on creation; evidence file reads loop to completion so a short read
317
+ is reported as truncated instead of partially included; and the audit
318
+ report reader takes its size and bytes from the open descriptor instead of
319
+ a racy stat-then-open pair.
320
+ - `opencode-permission-reviewer init` re-verifies each planned write against
321
+ the current file before touching it: a file that drifted since planning
322
+ (created, deleted, or turned malformed) aborts with a refusal instead of
323
+ being merged or clobbered, new files are created exclusively, and backups
324
+ claim their destination atomically instead of overwriting a collision.
325
+
326
+ ## [1.3.1] - 2026-09-03
327
+
328
+ ### Fixed
329
+
330
+ - The elapsed-time counter in the TUI review panel froze at its mount value:
331
+ the elapsed text read no signal while evaluating, so the renderer evaluated
332
+ it once and never again (the spinner kept animating, masking it). The text
333
+ now reads the 250ms tick signal and advances for the lifetime of the panel,
334
+ and negative clock skew is clamped. Regression-guarded by a headless render
335
+ test that compiles the TUI with the same solid transform the host uses.
336
+
337
+ ## [1.3.0] - 2026-09-01
338
+
339
+ ### Added
340
+
341
+ - The reviewer now sees what the user answered in agent ask dialogs as scoped
342
+ authorization evidence (`USER_ASK_DECISIONS` prompt section plus an additive
343
+ `askDecisions` audit field; only the question and the selected option are
344
+ captured). Configure with `askDecisions` (default `true`).
345
+
346
+ ### Fixed
347
+
348
+ - The TUI overlay never rendered for npm-installed plugins: the app-slot
349
+ factory rendered once at boot and never re-rendered, because it read no
350
+ signal directly in its own scope. The factory now renders from direct signal
351
+ reads, and `solid-js` is pinned to `@opentui/solid`'s exact peer so npm
352
+ installs keep a single Solid runtime. Regression-guarded by headless slot
353
+ contract tests and tarball-install checks.
354
+
355
+ ## [1.2.4] - 2026-09-01
356
+
357
+ ### Changed
358
+
359
+ - Bumped `@opencode-ai/plugin` to 1.18.25 and `@opentui/core`/`@opentui/solid`
360
+ to 0.5.9, with `bun.lock` synchronized (dependency bumps only; no behavior
361
+ change).
362
+
363
+ ## [1.2.3] - 2026-08-25
364
+
365
+ ### Changed
366
+
367
+ - Bumped `@opencode-ai/plugin` to 1.18.21, `@opentui/core`/`@opentui/solid`
368
+ to 0.5.6, and `solid-js` to 1.9.15, with `bun.lock` synchronized
369
+ (dependency bumps only; no behavior change). The OpenTUI updates pull in
370
+ renderer fixes (stale mouse input, GNU Screen OSC 52 passthrough, Sixel
371
+ fallback on Kitty).
372
+ - The live smoke harness now uses `opencode/mimo-v2.5-free` as its driver
373
+ model after `opencode/deepseek-v4-flash-free` was retired from the gateway.
374
+
375
+ ## [1.2.2] - 2026-08-20
376
+
377
+ ### Fixed
378
+
379
+ - Text-mode reviews now re-prompt the reviewer once when the first response is
380
+ missing, invalid, or unparseable, mirroring the auto-retry that `json_schema`
381
+ mode already gets from OpenCode's `retryCount`. This absorbs the occasional
382
+ flaky response from weaker models (e.g. `opencode-go/deepseek-v4-flash`) that
383
+ previously escalated straight to "Manual review required". The retry is
384
+ parsed with the same strict, fail-closed extractor, so it can never approve
385
+ anything the first parse would not; a response that is still invalid after
386
+ the retry escalates as before.
387
+ - Text-mode prompt now explicitly tells the reviewer not to echo the schema as
388
+ an example (a schema copy plus a decision object in one response is
389
+ ambiguous and escalates).
390
+
391
+ ## [1.2.1] - 2026-08-18
392
+
393
+ ### Changed
394
+
395
+ - Bumped `@opencode-ai/plugin` to 1.18.18 and `@opentui/core`/`@opentui/solid`
396
+ to 0.5.3, with `bun.lock` synchronized (dependency bumps only; no behavior
397
+ change).
398
+
399
+ ## [1.2.0] - 2026-08-18
400
+
401
+ ### Added
402
+
403
+ - New `outputFormat` config option (`json_schema` | `text`, default
404
+ `json_schema`). `text` lets reviewer models that do not support OpenCode's
405
+ `json_schema` structured-output format (e.g. `opencode-go/deepseek-v4-flash`)
406
+ be used: the model emits its decision as plain JSON, which the plugin parses
407
+ locally through the same strict `parseDecision` validation and
408
+ `enforceDecision` invariants. Text-mode parsing is fail-closed: the response
409
+ must be exactly one JSON object (optionally in a single code fence); any
410
+ ambiguity escalates to a human. Text mode is safe but produces more
411
+ escalations than structured output.
412
+
413
+ ## [1.1.1] - 2026-08-08
414
+
415
+ ### Fixed
416
+
417
+ - Fail-closed escalate→deny no longer invents a synthetic `ReviewDecision`
418
+ (`risk_level: high`, `confidence: 1`) or a `reviewerOutcome` when no valid
419
+ structured decision existed (timeout, invalid output, policy-manual, etc.).
420
+ Real LLM `escalate` decisions keep `decision.outcome: "escalate"` under
421
+ fail-closed deny.
422
+ - `ACTION_PURPOSE` now recovers prose from the exact assistant message that
423
+ issued the tool call (`request.tool.messageID` / `callID`) before falling
424
+ back to intent-derived evidence.
425
+ - Plugin no longer registers a no-op `tool.execute.after` hook; deprecated
426
+ `annotateToolResult` remains exported for API compatibility.
427
+
428
+ ## [1.1.0] - 2026-08-08
429
+
430
+ Non-interactive fail-closed mode and asymmetric agent feedback, without changing
431
+ the default interactive behavior.
432
+
433
+ ### Added
434
+
435
+ - `escalationMode: "manual" | "deny"` (default `manual`). In `deny` mode every
436
+ final internal escalation is converted to a reject with the original reason,
437
+ so autonomous agents can run without human prompts while remaining fail-closed.
438
+ - Wired `riskPolicy.onInvalidDecision` and `riskPolicy.onReviewerFailure` so
439
+ they harden invalid structured output and reviewer transport/timeout failures
440
+ respectively (under `escalationMode: "manual"`). `escalationMode: "deny"`
441
+ hardens every escalate path globally. Restrictive settings only block more.
442
+ - Central escalation disposition boundary (`applyEscalationDisposition`) applied
443
+ after reviewer/policy/fail-safe produce `allow | deny | escalate`.
444
+ `manual-superseded` is never converted.
445
+ - `ACTION_PURPOSE` evidence section in the reviewer prompt (agent-context →
446
+ intent-derived → unavailable). Never invented; does not prove authorization.
447
+ - Additive audit/UI fields `reviewerOutcome` and `escalationDisposition` so
448
+ reports and the TUI can distinguish an explicit deny from fail-closed
449
+ escalate→deny (`schemaVersion` stays `2`).
450
+ - Trust-boundary clamps for `escalationMode` and risk-policy failure knobs
451
+ (project config can only harden, never relax a trusted deny).
452
+
453
+ ### Changed
454
+
455
+ - Approvals no longer annotate tool results. Allow is silent to the primary
456
+ agent; deny still returns actionable feedback. `annotateToolResult` remains
457
+ as a deprecated no-op for 1.x API compatibility.
458
+ - Reviewer system prompt version bumped to `2.1.0` (ACTION_PURPOSE guidance).
459
+ Structured decision schema stays at version `2`.
460
+
461
+ ### Fixed
462
+
463
+ - Partial project `riskPolicy` objects no longer wipe trusted
464
+ `onInvalidDecision` / `onReviewerFailure` values back to defaults.
465
+
466
+ ## [1.0.0] - 2026-08-07
467
+
468
+ The first stable release. The public configuration schema, the audit schema
469
+ (v2), and the OpenCode 1.x adapter contract are frozen for the 1.x line.
470
+
471
+ ### Added
472
+
473
+ - Reference documentation: migration guide, threat model, policy reference,
474
+ capability model, actor resolution, compatibility policy, and architecture
475
+ decision records (`docs/`).
476
+ - Community health files: code of conduct, issue templates (bug report with
477
+ adapter-diagnostics requirement, feature request with a safety checklist),
478
+ pull-request template, and code owners.
479
+ - Release pipeline: tag-driven workflow that builds, publishes to npm with
480
+ build provenance, generates SHA-256 checksums and a CycloneDX SBOM, and
481
+ creates a GitHub Release with all artifacts attached (`.github/workflows/release.yml`).
482
+ - Security automation: CodeQL scan and Dependabot configuration.
483
+ - Coverage gate: `bun run test:coverage` enforces ≥ 90% global line coverage
484
+ and 100% on safety-critical modules (decision, policy, emergency brake,
485
+ event normalization, reply transport, redaction).
486
+
487
+ ### Fixed
488
+
489
+ - TUI overlay renders again: the `./tui` export points at raw
490
+ `dist/tui/tui.tsx` (copied by `scripts/copy-tui.ts`) instead of a prebundled
491
+ JS file, so the OpenCode host compiles it with its own Solid/OpenTUI
492
+ pipeline. The shipped TUI graph no longer pulls the server engine into the
493
+ TUI process.
494
+ - Overlay selection no longer hides later reviews behind a stale manual toast:
495
+ manual entries are excluded from the panel slot, in-flight reviews win over
496
+ terminal results, and the start grace before "manual" is 15s (was 3s).
497
+ - UI status publishing treats the typed SDK `{ data, error }` resolve shape as
498
+ a failure when `error` is set, and the declarative manual policy route emits
499
+ a UI status. A failed `mode.push` no longer leaves the overlay half-registered.
500
+
501
+ ### Changed
502
+
503
+ - Dropped the unused `@opentui/keymap` dependency.
504
+
505
+ ## [0.9.0] - 2026-08-07
506
+
507
+ ### Added
508
+
509
+ - Layered configuration: merges builtin defaults, global
510
+ (`~/.config/opencode/permission-reviewer.jsonc`), project
511
+ (`.opencode/permission-reviewer.jsonc`), and inline plugin options, with JSONC
512
+ parsing support.
513
+ - Reviewer decision schema v2: `version: 2` is now required, and decisions must
514
+ declare `scope_alignment` and `evidence_completeness`. In enforce mode, new
515
+ deterministic gates escalate allows with misaligned scope or insufficient
516
+ evidence. A model output that omits `version: 2` is rejected and routed to
517
+ manual review, so a model that does not follow the v2 schema never produces an
518
+ automatic decision.
519
+ - Audit schema v2: every record now carries `schemaVersion: 2`, `decisionSource`,
520
+ an `actionHash` for cross-record correlation, per-phase timings, the reviewer
521
+ model, evidence completeness, scope alignment, and actor
522
+ `identitySource`/`confidence`. Capability and policy-trace objects remain
523
+ additive, so v1 readers keep working.
524
+ - Isolated reply transport: permission replies flow through a dedicated module
525
+ with a documented priority chain (public SDK reply with message, then public
526
+ reply plus a feedback channel, then the authenticated raw transport, then
527
+ refuse startup). Host capabilities are probed once at startup.
528
+ - Version gate: refuses to start against OpenCode v2-generation clients until
529
+ their reply contract is verified.
530
+ - CLI subcommands via the `opencode-permission-reviewer` binary (no subcommand
531
+ still runs `explain` for backward compatibility):
532
+ - `doctor` — package/runtime versions, config sources with hashes, resolved
533
+ model, policy mode and rule count, effective policy hash, audit-path
534
+ writability.
535
+ - `config print-effective` — resolved config and engine-equivalent policy hash.
536
+ - `audit report` — summarizes the JSONL audit trail and flags unknown actors
537
+ and records missing required fields.
538
+ - Public npm package: drops the private flag, points `main`/`types`/`exports` at
539
+ the built `dist/` bundle, generates d.ts, rebuilds on install, and ships only
540
+ `dist` plus docs (verified by a pack smoke test).
541
+ - TUI status publishing migrated to the typed v1 `client.tui.publish` API.
542
+ - Reviewer prompt v2.0.0 with new `EFFECTIVE_POLICY_SUMMARY`,
543
+ `LOCAL_SESSION_CONTEXT`, and `REPOSITORY_CONTEXT` sections.
544
+
545
+ ### Security
546
+
547
+ - Trust boundary: project config can no longer redirect or silence the audit
548
+ trail (`auditPath`) or grant its own agent a higher-privilege profile
549
+ (`actorProfiles`) — both are restricted to global/inline config.
550
+ - Project config can no longer downgrade a global `enforcementMode: "enforce"`
551
+ to `observe`.
552
+ - Project policy rules are now combined with trusted (global/inline) rules
553
+ instead of replacing them, so a repository can no longer erase a user's deny
554
+ or manual rules by declaring an empty or narrower set.
555
+
556
+ ### Changed
557
+
558
+ - Model decisions missing `version: 2` are rejected instead of defaulting
559
+ missing v2 fields to unknown.
560
+
561
+ ### Fixed
562
+
563
+ - Bare backtick command substitution (e.g. `echo \`whoami\``) is now correctly
564
+ detected as dynamic instead of being treated as complete.
565
+ - Single-quoted literal strings (e.g. `echo 'literal $VAR'`) are no longer
566
+ misdetected as dynamic.
567
+ - Malformed policy rule conditions no longer crash the engine — the rule is
568
+ dropped defensively.
569
+ - JSONC trailing-comma stripping is now string-aware; `,}` or `,]` inside a
570
+ string value is no longer corrupted.
571
+ - `audit report` expands `~` in `--path`, and `actionHash` excludes
572
+ per-invocation tool IDs so identical commands correlate across runs.
573
+ - Importing the CLI module no longer runs the dispatcher, and the audit
574
+ writability probe creates files with mode `0600`.
575
+
576
+ ## [0.8.0] - 2026-08-06
577
+
578
+ ### Added
579
+
580
+ - Static capability analysis for bash commands: structured facts for code
581
+ execution, write effects, network, process side-effects, remote/git mutation,
582
+ and privilege escalation, with heredoc bodies extracted before lexing and an
583
+ honest completeness marker (complete / partial / opaque).
584
+ - Capability assessment threaded into the reviewer prompt as a new
585
+ `CAPABILITY_ASSESSMENT` section and into the audit record as an additive
586
+ capability snapshot.
587
+ - Declarative policy engine: evaluates capability and actor facts against
588
+ declarative rules with most-restrictive resolution. Default rules ship empty,
589
+ so observe mode produces zero behavior change.
590
+ - Enforce mode: manual/deny policy routes skip the LLM entirely; the emergency
591
+ brake always runs first and is never weakened.
592
+ - `explain` CLI: dry-runs a bash command through the capability analyzer and
593
+ policy engine without a running opencode, reading a permission request from a
594
+ JSON fixture or stdin and printing the capability assessment and policy trace
595
+ as JSON.
596
+ - Configurable risk × authorization matrix via `RiskPolicy` with conservative
597
+ defaults that reproduce the previous behavior exactly, plus a
598
+ `RepositoryTrust` type.
599
+ - Policy traces (effective policy hash, matched rules, final route, mode) in the
600
+ audit record, with a counterfactual trace in observe mode.
601
+
602
+ ## [0.7.0] - 2026-08-06
603
+
604
+ ### Added
605
+
606
+ - Agent-aware context: the requesting tool's `agent`/`mode` is resolved from the
607
+ session, walking parent sessions via the SDK with cycle/depth guards, and
608
+ degrading honestly to "unknown" on any failure — a review always proceeds.
609
+ - Reviewer prompt sections `ACTOR_CONTEXT`, `SESSION_LINEAGE`,
610
+ `DIRECT_USER_INTENT`, `DELEGATED_TASK`, and `EVIDENCE_COMPLETENESS` before
611
+ `PENDING_PERMISSION`.
612
+ - Audit records gain an additive actor snapshot (identity completeness) and
613
+ `rootSessionID`; the TUI shows the actor name.
614
+ - New config knobs: `enforcementMode` (default `observe`), `maxSessionDepth`,
615
+ `maxParentSessions`, and `actorProfiles`.
616
+
617
+ ### Changed
618
+
619
+ - Observe-only release: the decision schema and enforcement gates are
620
+ untouched, so reviewer decisions do not change.
621
+
622
+ ## [0.6.0] - 2026-08-06
623
+
624
+ ### Changed
625
+
626
+ - Internal architecture boundary: the approval pipeline is extracted into a
627
+ dedicated adapter, review coordinator, and evidence providers with
628
+ byte-identical behavior — no user-facing behavior change versus 0.5.2.
629
+ - Audit records now carry an additive `schemaVersion: 1` (readers default
630
+ missing values to 1).
631
+ - Tooling: ESLint 9, tsup ESM build, and Prettier are added; `bun run check`
632
+ now runs format, lint, typecheck, tests, and build as a single gate.