@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
@@ -1,4 +1,25 @@
1
- import type { PermissionRequest } from "../types.ts"
1
+ import { asObjectLike } from "../is-record.ts";
2
+ import type { PermissionRequest } from "../types.ts";
3
+
4
+ type UnknownRecord = Record<string, unknown>;
5
+
6
+ function strings(items: unknown[]): string[] {
7
+ return items.filter((item): item is string => typeof item === "string");
8
+ }
9
+
10
+ /** The `properties` record of a `permission.asked` event, if it has one. */
11
+ function askedProperties(event: unknown): UnknownRecord | undefined {
12
+ const record = asObjectLike(event);
13
+ if (record?.type !== "permission.asked") return;
14
+ return asObjectLike(record.properties);
15
+ }
16
+
17
+ function toolReference(value: unknown): PermissionRequest["tool"] {
18
+ const tool = asObjectLike(value);
19
+ if (typeof tool?.messageID !== "string" || typeof tool.callID !== "string")
20
+ return undefined;
21
+ return { messageID: tool.messageID, callID: tool.callID };
22
+ }
2
23
 
3
24
  /**
4
25
  * Normalize a raw OpenCode event into a {@link PermissionRequest}.
@@ -7,38 +28,27 @@ import type { PermissionRequest } from "../types.ts"
7
28
  * `permission.asked` event, so callers can ignore irrelevant events without
8
29
  * inspecting their shape.
9
30
  */
10
- export function extractPermissionRequest(event: unknown): PermissionRequest | undefined {
11
- if (typeof event !== "object" || event === null) return
12
- const record = event as Record<string, unknown>
13
- if (record.type !== "permission.asked") return
14
- const properties = record.properties
15
- if (typeof properties !== "object" || properties === null) return
16
- const request = properties as Record<string, unknown>
17
- if (typeof request.id !== "string" || typeof request.sessionID !== "string") return
18
- if (typeof request.permission !== "string" || !Array.isArray(request.patterns)) return
31
+ export function extractPermissionRequest(
32
+ event: unknown,
33
+ ): PermissionRequest | undefined {
34
+ const request = askedProperties(event);
35
+ if (!request) return;
36
+ if (typeof request.id !== "string" || typeof request.sessionID !== "string")
37
+ return;
38
+ if (
39
+ typeof request.permission !== "string" ||
40
+ !Array.isArray(request.patterns)
41
+ )
42
+ return;
19
43
 
20
- const patterns = request.patterns.filter((item): item is string => typeof item === "string")
21
- if (patterns.length !== request.patterns.length) return
22
- const metadata =
23
- typeof request.metadata === "object" && request.metadata !== null
24
- ? (request.metadata as Record<string, unknown>)
25
- : {}
26
- const always = Array.isArray(request.always)
27
- ? request.always.filter((item): item is string => typeof item === "string")
28
- : []
44
+ const patterns = strings(request.patterns);
45
+ if (patterns.length !== request.patterns.length) return;
46
+ const metadata = asObjectLike(request.metadata) ?? {};
47
+ const always = Array.isArray(request.always) ? strings(request.always) : [];
29
48
  // `always` is parsed for forward compatibility (a future "persist this
30
49
  // approval" surface) but is not consumed by the reviewer yet.
31
- void always
32
- const tool =
33
- typeof request.tool === "object" &&
34
- request.tool !== null &&
35
- typeof (request.tool as Record<string, unknown>).messageID === "string" &&
36
- typeof (request.tool as Record<string, unknown>).callID === "string"
37
- ? {
38
- messageID: (request.tool as Record<string, unknown>).messageID as string,
39
- callID: (request.tool as Record<string, unknown>).callID as string,
40
- }
41
- : undefined
50
+ void always;
51
+ const tool = toolReference(request.tool);
42
52
 
43
53
  return {
44
54
  id: request.id,
@@ -48,5 +58,5 @@ export function extractPermissionRequest(event: unknown): PermissionRequest | un
48
58
  metadata,
49
59
  always,
50
60
  ...(tool === undefined ? {} : { tool }),
51
- }
61
+ };
52
62
  }
@@ -0,0 +1,87 @@
1
+ import { nonEmptyStringOr } from "./config-fields.ts";
2
+ import { boundedInteger } from "./config-knobs.ts";
3
+ import type { EscalationReviewerConfig, ReviewerConfig } from "./types.ts";
4
+
5
+ export function splitModel(model: string): {
6
+ providerID: string;
7
+ modelID: string;
8
+ } {
9
+ const slash = model.indexOf("/");
10
+ if (slash <= 0 || slash === model.length - 1) {
11
+ throw new Error(
12
+ `Invalid reviewer model "${model}"; expected provider/model`,
13
+ );
14
+ }
15
+ return {
16
+ providerID: model.slice(0, slash),
17
+ modelID: model.slice(slash + 1),
18
+ };
19
+ }
20
+
21
+ export function isSystemOneReviewerModel(model: string): boolean {
22
+ let parsed: { providerID: string; modelID: string };
23
+ try {
24
+ parsed = splitModel(model);
25
+ } catch {
26
+ return false;
27
+ }
28
+ // Jev uses the typed System One API rather than a chat-session transport.
29
+ return (
30
+ ((parsed.providerID === "opencode" ||
31
+ parsed.providerID === "typesafe-ai") &&
32
+ /^jev(?:-|$)/.test(parsed.modelID)) ||
33
+ (parsed.providerID === "commandcode" && parsed.modelID === "typesafe/jev")
34
+ );
35
+ }
36
+
37
+ export function isProviderModelId(value: unknown): value is string {
38
+ return typeof value === "string" && value.includes("/");
39
+ }
40
+
41
+ /** The escalation reviewer object with a provider/model id that is not a
42
+ * System One model, or undefined when the value cannot be one. */
43
+ function escalationReviewerSource(
44
+ value: unknown,
45
+ ): (Record<string, unknown> & { model: string }) | undefined {
46
+ if (typeof value !== "object" || value === null || Array.isArray(value))
47
+ return;
48
+ const source = value as Record<string, unknown>;
49
+ if (
50
+ !isProviderModelId(source.model) ||
51
+ isSystemOneReviewerModel(source.model)
52
+ )
53
+ return;
54
+ return source as Record<string, unknown> & { model: string };
55
+ }
56
+
57
+ export function resolveEscalationReviewer(
58
+ value: unknown,
59
+ defaults: ReviewerConfig,
60
+ ): EscalationReviewerConfig | undefined {
61
+ const source = escalationReviewerSource(value);
62
+ if (source === undefined) return;
63
+ return {
64
+ model: source.model,
65
+ variant: nonEmptyStringOr(source.variant, defaults.variant),
66
+ outputFormat: source.outputFormat === "text" ? "text" : "json_schema",
67
+ timeoutMs: boundedInteger(
68
+ source.timeoutMs,
69
+ defaults.timeoutMs,
70
+ 5_000,
71
+ 600_000,
72
+ ),
73
+ };
74
+ }
75
+
76
+ export function isValidEscalationReviewer(value: unknown): boolean {
77
+ const source = escalationReviewerSource(value);
78
+ if (source === undefined) return false;
79
+ return (
80
+ (source.variant === undefined ||
81
+ (typeof source.variant === "string" && source.variant !== "")) &&
82
+ (source.outputFormat === undefined ||
83
+ source.outputFormat === "text" ||
84
+ source.outputFormat === "json_schema") &&
85
+ (source.timeoutMs === undefined || Number.isInteger(source.timeoutMs))
86
+ );
87
+ }
@@ -0,0 +1,110 @@
1
+ import { isSystemOneReviewerModel } from "./reviewer-model.ts";
2
+ import type { ReviewerConfig } from "./types.ts";
3
+
4
+ /** The least review time a hand-off needs; with less the request escalates. */
5
+ export const HANDOFF_BUDGET_FLOOR_MS = 15_000;
6
+
7
+ export interface SystemOneRouting {
8
+ /** reasoning-first is configured AND active (Jev model + valid escalationReviewer). */
9
+ reasoningFirst: boolean;
10
+ /** denial review is configured AND active (same conditions). */
11
+ denialReview: boolean;
12
+ }
13
+
14
+ /** A non-Jev model is reported first: no escalationReviewer fixes that. */
15
+ function inertCause(
16
+ config: ReviewerConfig,
17
+ ): "not-jev" | "no-reviewer" | undefined {
18
+ if (!isSystemOneReviewerModel(config.model)) return "not-jev";
19
+ if (config.escalationReviewer === undefined) return "no-reviewer";
20
+ return undefined;
21
+ }
22
+
23
+ export function resolveSystemOneRouting(
24
+ config: ReviewerConfig,
25
+ ): SystemOneRouting {
26
+ const active = inertCause(config) === undefined;
27
+ return {
28
+ reasoningFirst: active && config.systemOneEscalation === "reasoning-first",
29
+ denialReview: active && config.systemOneDenialReview,
30
+ };
31
+ }
32
+
33
+ /** Warnings for settings that are on but inert. */
34
+ export function systemOneRoutingWarnings(config: ReviewerConfig): string[] {
35
+ const cause = inertCause(config);
36
+ if (cause === undefined) return [];
37
+ const warnings: string[] = [];
38
+ if (config.systemOneEscalation === "reasoning-first") {
39
+ warnings.push(
40
+ cause === "not-jev"
41
+ ? 'systemOneEscalation "reasoning-first" is inactive: the reviewer model is not Jev'
42
+ : 'systemOneEscalation "reasoning-first" is inactive: no escalationReviewer is configured; Jev escalations still go to you',
43
+ );
44
+ }
45
+ if (config.systemOneDenialReview) {
46
+ warnings.push(
47
+ cause === "not-jev"
48
+ ? "systemOneDenialReview is inactive: the reviewer model is not Jev"
49
+ : "systemOneDenialReview is inactive: no escalationReviewer is configured; Jev denials stay final",
50
+ );
51
+ }
52
+ return warnings;
53
+ }
54
+
55
+ /** Standard routing hands off too, so neither routing key gates this. The
56
+ * default budget always leaves the floor, so only an explicit one can warn. */
57
+ function budgetFloorWarnings(config: ReviewerConfig): string[] {
58
+ const budget = config.reviewBudgetMs;
59
+ if (budget === undefined || inertCause(config) !== undefined) return [];
60
+ if (budget - config.timeoutMs >= HANDOFF_BUDGET_FLOOR_MS) return [];
61
+ return [
62
+ `reviewBudgetMs ${budget} leaves less than ${HANDOFF_BUDGET_FLOOR_MS} ms after timeoutMs; hand-offs to the reasoning reviewer will escalate to you instead`,
63
+ ];
64
+ }
65
+
66
+ const PREVIEW_CHARS = 80;
67
+
68
+ /** A warning names the value; it does not reproduce it. */
69
+ function preview(value: unknown): string {
70
+ const json = JSON.stringify(value) ?? String(value);
71
+ return json.length > PREVIEW_CHARS
72
+ ? `${json.slice(0, PREVIEW_CHARS)}…`
73
+ : json;
74
+ }
75
+
76
+ /** A present source value the resolver did not keep was invalid. */
77
+ function invalidValueWarnings(
78
+ config: ReviewerConfig,
79
+ source: Record<string, unknown>,
80
+ ): string[] {
81
+ const warnings: string[] = [];
82
+ const { systemOneEscalation: escalation, systemOneDenialReview: denial } =
83
+ source;
84
+ if (escalation !== undefined && escalation !== config.systemOneEscalation) {
85
+ warnings.push(
86
+ `systemOneEscalation ${preview(escalation)} is not "standard" or "reasoning-first"; using "standard"`,
87
+ );
88
+ }
89
+ if (denial !== undefined && denial !== config.systemOneDenialReview) {
90
+ warnings.push(
91
+ `systemOneDenialReview ${preview(denial)} is not a boolean; using false`,
92
+ );
93
+ }
94
+ return warnings;
95
+ }
96
+
97
+ /** configWarnings goes last, after configDegraded: resolveConfig's key order is part of its output. */
98
+ export function withSystemOneRoutingWarnings(
99
+ config: ReviewerConfig,
100
+ source: Record<string, unknown>,
101
+ ): ReviewerConfig {
102
+ const warnings = [
103
+ ...invalidValueWarnings(config, source),
104
+ ...systemOneRoutingWarnings(config),
105
+ ...budgetFloorWarnings(config),
106
+ ];
107
+ return warnings.length === 0
108
+ ? config
109
+ : { ...config, configWarnings: warnings };
110
+ }
package/dist/tui/tui.tsx CHANGED
@@ -1,138 +1,126 @@
1
1
  /** @jsxImportSource @opentui/solid */
2
- import type { TuiPlugin, TuiPluginApi } from "@opencode-ai/plugin/tui"
3
- import { createSignal, Show } from "solid-js"
4
- import { DEFAULT_CONFIG, reviewBudgetMs } from "./config.ts"
5
- import { loadResolvedConfig } from "./config/loader.ts"
6
- // Import the normalizer directly. Going through ./runtime.ts would evaluate the
7
- // whole server engine (coordinator, git/ssh evidence, node:child_process) inside
8
- // the TUI process for a single unused re-export.
9
- import { extractPermissionRequest } from "./opencode/event-normalizer.ts"
10
- import { decodeUiStatus, type ReviewUiStatus } from "./ui-protocol.ts"
11
- import { ReviewUiState } from "./ui-state.ts"
12
- import { ReviewOverlay, ReviewResult, SPINNER } from "./ui/components.tsx"
13
- import { setupTuiV2 } from "./ui/v2.tsx"
2
+ import type { PluginOptions } from "@opencode-ai/plugin";
3
+ import type { TuiPlugin, TuiPluginApi } from "@opencode-ai/plugin/tui";
4
+ import type { JSX } from "solid-js";
5
+ import { createSignal, Show } from "solid-js";
6
+ import { loadResolvedConfig } from "./config/loader.ts";
7
+ import { reviewBudgetMs } from "./config.ts";
8
+ // Import the normalizer directly: `./index.ts` re-exports it, but importing that
9
+ // would evaluate the whole server engine (git/ssh evidence, `node:child_process`)
10
+ // inside the TUI process.
11
+ import { extractPermissionRequest } from "./opencode/event-normalizer.ts";
12
+ import { ConfigNoticeSlot, SPINNER } from "./ui/components.tsx";
13
+ import { ReviewOverlay } from "./ui/review-overlay.tsx";
14
+ import { ReviewResult } from "./ui/review-result.tsx";
15
+ import { activeStatus, createV1Host } from "./ui/v1-host.ts";
16
+ import { setupTuiV2 } from "./ui/v2.tsx";
17
+ import type { ReviewUiStatus } from "./ui-protocol.ts";
18
+ import { ReviewUiState } from "./ui-state.ts";
14
19
 
15
- const REVIEW_MODE = "permission-reviewer"
20
+ const REVIEW_MODE = "permission-reviewer";
16
21
 
17
- function routeSessionID(api: TuiPluginApi): string | undefined {
18
- const route = api.route.current
19
- if (route.name !== "session") return
20
- const params = "params" in route ? route.params : undefined
21
- const sessionID = params?.sessionID
22
- return typeof sessionID === "string" ? sessionID : undefined
23
- }
24
-
25
- function parentSessionID(api: TuiPluginApi, sessionID: string): string | undefined {
26
- return api.state.session.get(sessionID)?.parentID
27
- }
28
-
29
- function notifyManual(api: TuiPluginApi, status: ReviewUiStatus): void {
30
- api.ui.toast({
31
- variant: "warning",
32
- title: "Manual review required",
33
- message:
34
- status.reason ?? "The reviewer could not decide. This permission now needs your approval.",
35
- duration: 8_000,
36
- })
37
- }
38
-
39
- export const tui: TuiPlugin = async (api, options) => {
40
- const config = loadResolvedConfig(options)
22
+ export const tui: TuiPlugin = async (
23
+ api: TuiPluginApi,
24
+ options: PluginOptions | undefined,
25
+ ) => {
26
+ // Load inline options as `unknown`, as the server does, so inline routing keys and an inline `escalationReviewer` are dropped here too.
27
+ // Config warnings reach this TUI through server statuses, not this load.
28
+ const config = loadResolvedConfig(options, undefined, "unknown", {
29
+ printConfigWarnings: false,
30
+ });
41
31
  const state = new ReviewUiState({
42
32
  model: config.model,
43
33
  variant: config.variant,
44
34
  timeoutMs: reviewBudgetMs(config),
45
- })
35
+ });
36
+ const host = createV1Host(api, state, config.escalationReviewer?.model);
46
37
 
47
38
  // Signal bumps whenever the UI state changes. Both slot factories read it
48
39
  // directly in their bodies, which makes the host re-render each panel:
49
40
  // a factory that only returns a component without reading any signal in its
50
41
  // own scope renders exactly once at boot and never updates again.
51
- const [revision, setRevision] = createSignal(0)
52
- const [frame, setFrame] = createSignal(0)
53
- const touch = () => {
54
- syncMode()
55
- setRevision((value) => value + 1)
56
- }
42
+ const [revision, setRevision] = createSignal(0);
43
+ const [frame, setFrame] = createSignal(0);
44
+ const touch = (): void => {
45
+ syncMode();
46
+ setRevision((value) => value + 1);
47
+ };
57
48
 
58
- const active = () => {
59
- const sessionID = routeSessionID(api)
60
- if (!sessionID) return
61
- return state.activeFor(sessionID, (id) => parentSessionID(api, id))
62
- }
49
+ const active = (): ReviewUiStatus | undefined => activeStatus(api, state);
63
50
 
64
- let popMode: (() => void) | undefined
65
- const syncMode = () => {
66
- const status = active()
67
- const wanted = status?.phase === "reviewing"
51
+ let popMode: (() => void) | undefined;
52
+ const syncMode = (): void => {
53
+ const status = active();
54
+ const wanted = status?.phase === "reviewing";
68
55
  if (wanted && popMode === undefined) {
69
56
  try {
70
- popMode = api.mode.push(REVIEW_MODE)
57
+ popMode = api.mode.push(REVIEW_MODE);
71
58
  } catch {
72
59
  // mode.push can throw if the host rejects unknown modes; keep the panel.
73
60
  }
74
61
  } else if (!wanted && popMode !== undefined) {
75
- popMode()
76
- popMode = undefined
62
+ popMode();
63
+ popMode = undefined;
77
64
  }
78
- }
65
+ };
79
66
 
80
67
  api.event.on("permission.asked", (event) => {
81
- const request = extractPermissionRequest(event)
82
- if (!request) return
83
- state.asked(request)
84
- touch()
85
- })
68
+ const request = extractPermissionRequest(event);
69
+ if (!request) return;
70
+ state.asked(request);
71
+ touch();
72
+ });
86
73
  api.event.on("permission.replied", (event) => {
87
- state.replied(event.properties.requestID)
88
- touch()
89
- })
74
+ state.replied(event.properties.requestID);
75
+ touch();
76
+ });
90
77
  api.event.on("tui.command.execute", (event) => {
91
- const status = decodeUiStatus(event.properties.command)
92
- if (!status) return
93
- if (!state.apply(status)) return
94
- if (status.phase === "manual") notifyManual(api, status)
95
- touch()
96
- })
78
+ if (host.apply(event.properties.command)) touch();
79
+ });
97
80
 
98
81
  // Keep watchdog and result expiry running even when the UI is hidden.
99
82
  const ticker = setInterval(() => {
100
- if (active()?.phase === "reviewing") setFrame((value) => (value + 1) % SPINNER.length)
101
- const expired = state.expire()
102
- const dismissed = state.dismissResults()
103
- if (expired.length > 0 || dismissed.length > 0) touch()
104
- }, 250)
83
+ if (active()?.phase === "reviewing")
84
+ setFrame((value) => (value + 1) % SPINNER.length);
85
+ const expired = state.expire();
86
+ const dismissed = state.dismissResults();
87
+ if (expired.length > 0 || dismissed.length > 0) touch();
88
+ }, 250);
105
89
 
106
90
  api.lifecycle.onDispose(() => {
107
- clearInterval(ticker)
108
- popMode?.()
109
- popMode = undefined
110
- })
91
+ clearInterval(ticker);
92
+ popMode?.();
93
+ popMode = undefined;
94
+ });
111
95
 
112
96
  api.slots.register({
113
97
  order: 1_000,
114
98
  slots: {
115
- app() {
99
+ app(): JSX.Element {
116
100
  // Load-bearing direct read: it subscribes the slot's render pass to
117
101
  // every state transition (touch), so the factory re-runs and renders
118
102
  // the current status. The spinner frame is deliberately NOT read here
119
103
  // (only inside the panel's text children) so 250ms ticks update those
120
104
  // texts without re-running this factory.
121
- revision()
122
- const status = active()
123
- syncMode()
105
+ revision();
106
+ const status = active();
107
+ syncMode();
124
108
  return (
125
109
  <Show when={status?.phase === "reviewing" ? status : undefined} keyed>
126
- {(current) => (
127
- <ReviewOverlay theme={() => api.theme.current} status={current} frame={frame} />
110
+ {(current: ReviewUiStatus) => (
111
+ <ReviewOverlay
112
+ theme={() => api.theme.current}
113
+ status={current}
114
+ frame={frame}
115
+ />
128
116
  )}
129
117
  </Show>
130
- )
118
+ );
131
119
  },
132
- app_bottom() {
133
- revision()
134
- const status = active()
135
- syncMode()
120
+ app_bottom(): JSX.Element {
121
+ revision();
122
+ const status = active();
123
+ syncMode();
136
124
  return (
137
125
  <Show
138
126
  when={
@@ -144,19 +132,29 @@ export const tui: TuiPlugin = async (api, options) => {
144
132
  }
145
133
  keyed
146
134
  >
147
- {(current) => <ReviewResult theme={() => api.theme.current} status={current} />}
135
+ {(current: ReviewUiStatus) => (
136
+ <ReviewResult theme={() => api.theme.current} status={current} />
137
+ )}
148
138
  </Show>
149
- )
139
+ );
140
+ },
141
+ sidebar_content(): JSX.Element {
142
+ revision();
143
+ return (
144
+ <ConfigNoticeSlot
145
+ theme={() => api.theme.current}
146
+ line={host.sidebar()}
147
+ />
148
+ );
150
149
  },
151
150
  },
152
- })
153
- }
151
+ });
152
+ };
154
153
 
155
- const module = {
154
+ const module: { id: string; tui: TuiPlugin; setup: typeof setupTuiV2 } = {
156
155
  id: "opencode-permission-reviewer",
157
156
  tui,
158
157
  setup: setupTuiV2,
159
- }
158
+ };
160
159
 
161
- export default module
162
- export { ReviewUiState, decodeUiStatus, DEFAULT_CONFIG }
160
+ export default module;