@noppu-labs/opencode-permission-reviewer 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,179 +1,220 @@
1
- import { Plugin as Plugin$1 } from '@opencode-ai/plugin';
2
- import { Plugin } from '@opencode/plugin';
3
-
1
+ import { TypeSafeClient } from "@typesafe-ai/sdk";
2
+ import "@opencode/client";
3
+ import { Plugin } from "@opencode-ai/plugin";
4
+ import { Plugin as Plugin$1 } from "@opencode/plugin";
5
+ import "@opencode/plugin/promise/permission";
6
+ //#region src/verified-ssh-script.d.ts
4
7
  interface VerifiedScriptEvidence {
5
- sha256: string;
6
- destination: string;
7
- port?: number;
8
- shell: "bash" | "sh";
9
- bytes?: number;
10
- status: "full" | "reused" | "unavailable";
11
- text: string;
12
- cacheKey?: string;
8
+ sha256: string;
9
+ destination: string;
10
+ port?: number;
11
+ shell: "bash" | "sh";
12
+ bytes?: number;
13
+ status: "full" | "reused" | "unavailable";
14
+ text: string;
15
+ cacheKey?: string;
16
+ }
17
+ //#endregion
18
+ //#region src/shell-token.d.ts
19
+ /** A run of a token's value that shares one quoting. `opaque` marks text the
20
+ * lexer kept whole from a substitution (an unquoted backtick form): it is
21
+ * the substitution's command, not the outer command's, so no operator in it
22
+ * acts on the outer command. It stays unquoted otherwise: a glob character
23
+ * in it reads as it did before. */
24
+ interface TokenSpan {
25
+ text: string;
26
+ quoted: boolean;
27
+ opaque?: true;
13
28
  }
14
-
15
29
  interface ShellToken {
16
- /** Original text including any surrounding quotes. */
17
- raw: string;
18
- /** Unquoted/normalized value used for comparisons. */
19
- value: string;
20
- /** Value split into spans by quoting: every character of `value` appears
21
- * in exactly one span, marked `quoted` when it came from inside quotes
22
- * or from a backslash escape. An operator character (`>`, `*`, …) only
23
- * acts as an operator while it sits in an UNQUOTED span: a glued, partly
24
- * quoted `>"/dev/sda"` still redirects, while `'>/dev/sda'` is data. */
25
- spans?: Array<{
26
- text: string;
27
- quoted: boolean;
28
- }>;
30
+ /** Original text including any surrounding quotes. */
31
+ raw: string;
32
+ /** Unquoted/normalized value used for comparisons. */
33
+ value: string;
34
+ /** Value split into spans by quoting: every character of `value` appears
35
+ * in exactly one span, marked `quoted` when it came from inside quotes
36
+ * or from a backslash escape. An operator character (`>`, `*`, …) only
37
+ * acts as an operator while it sits in an UNQUOTED span: a glued, partly
38
+ * quoted `>"/dev/sda"` still redirects, while `'>/dev/sda'` is data.
39
+ * A zero-width quoted span can end a word: it marks an empty quote right
40
+ * after text that ends like a redirection operator (`<<<''`), and holds no
41
+ * character of `value`. */
42
+ spans?: TokenSpan[];
29
43
  }
30
44
  interface ShellSegment {
31
- tokens: ShellToken[];
32
- /** Separator that terminated this segment (`;`, `|`, `||`, `&`, `&&`, `(`,
33
- * `)`). Newlines and carriage returns are reported as `;`. Absent for the
34
- * final segment when the command does not end with a separator. A segment
35
- * with no tokens and `endedBy` `(` or `)` is a paren marker: it exists so
36
- * grouping events are never lost, and carries no command of its own. */
37
- endedBy?: string;
38
- /** The last separator seen before this segment's first token, counting
39
- * separators whose (empty) segment was dropped: in `( a ) | b`, segment
40
- * `b` ended up after a dropped empty segment, so its separator lineage is
41
- * `)` and then `|`, and `precededBy` reports `|`. Absent for the first
42
- * segment. */
43
- precededBy?: string;
45
+ tokens: ShellToken[];
46
+ /** Separator that terminated this segment (`;`, `|`, `||`, `&`, `&&`, `(`,
47
+ * `)`). Newlines and carriage returns are reported as `;`. Absent for the
48
+ * final segment when the command does not end with a separator. A segment
49
+ * with no tokens and `endedBy` `(` or `)` is a paren marker: it exists so
50
+ * grouping events are never lost, and carries no command of its own. */
51
+ endedBy?: string;
52
+ /** The last separator seen before this segment's first token, counting
53
+ * separators whose (empty) segment was dropped: in `( a ) | b`, segment
54
+ * `b` ended up after a dropped empty segment, so its separator lineage is
55
+ * `)` and then `|`, and `precededBy` reports `|`. Absent for the first
56
+ * segment. */
57
+ precededBy?: string;
44
58
  }
45
-
59
+ //#endregion
60
+ //#region src/walk-sink.d.ts
61
+ /** A command the walk resolves, wrapper or not: its basename, the words of
62
+ * its level and its index among them, and whether it runs inside the
63
+ * remote command of an ssh, mosh or autossh. */
64
+ interface PeeledHead {
65
+ head: string;
66
+ tokens: readonly ShellToken[];
67
+ index: number;
68
+ remote: boolean;
69
+ }
70
+ //#endregion
71
+ //#region src/capability/capability-types.d.ts
46
72
  /** How completely the command could be statically analyzed. */
47
- type ParserCompleteness =
73
+ type ParserCompleteness =
48
74
  /** Fully parsed: no variables, globs, substitutions, or heredoc bodies. */
49
- "complete-for-supported-form"
75
+ "complete-for-supported-form" |
50
76
  /** Some constructs could not be resolved (variables, partial heredoc). */
51
- | "partial"
77
+ "partial" |
52
78
  /** Heavy dynamic constructs (command substitution, eval, dynamic heredoc). */
53
- | "opaque";
79
+ "opaque";
54
80
  /** A redirection extracted from a parsed command segment. */
55
81
  interface Redirection {
56
- /** `>` `>>` `<` `2>` `&>` etc. */
57
- operator: string;
58
- /** Target path (file descriptor targets normalized to a path when possible). */
59
- target: string;
60
- /** Whether the target was quoted in the source (affects literal-ness). */
61
- quoted: boolean;
82
+ /** `>` `>>` `<` `2>` `&>` etc. */
83
+ operator: string;
84
+ /** Target path (file descriptor targets normalized to a path when possible). */
85
+ target: string;
86
+ /** Whether the target was quoted in the source (affects literal-ness). */
87
+ quoted: boolean;
62
88
  }
63
89
  /** A heredoc extracted before lexing so its body never reaches the lexer/brake. */
64
90
  interface HeredocRecord {
65
- /** The literal delimiter token as it appeared (`EOF`, `END`, …). */
66
- delimiter: string;
67
- /** `<<` (expansion on) or `<<-` (tabs stripped) — normalized form. */
68
- operator: string;
69
- /** Whether the delimiter was quoted, disabling expansion (`<<'EOF'`). */
70
- expansionDisabled: boolean;
71
- /** Bounded + redacted body (truncated to a safe length). */
72
- bodyBounded: string;
73
- /** SHA-256 of the full, unredacted body (stable identity without leaking it). */
74
- bodySha256: string;
75
- /** Whether the body was truncated for storage. */
76
- truncated: boolean;
77
- /** Output path associated with the heredoc when a `> path` precedes it. */
78
- outputTarget?: string;
79
- /** Whether the body is dynamically constructed (unresolvable expansion). */
80
- dynamic: boolean;
91
+ /** The literal delimiter token as it appeared (`EOF`, `END`, …). */
92
+ delimiter: string;
93
+ /** `<<` (expansion on) or `<<-` (tabs stripped) — normalized form. */
94
+ operator: string;
95
+ /** Whether the delimiter was quoted, disabling expansion (`<<'EOF'`). */
96
+ expansionDisabled: boolean;
97
+ /** Bounded + redacted body (truncated to a safe length). */
98
+ bodyBounded: string;
99
+ /** SHA-256 of the full, unredacted body (stable identity without leaking it). */
100
+ bodySha256: string;
101
+ /** Whether the body was truncated for storage. */
102
+ truncated: boolean;
103
+ /** Output path associated with the heredoc when a `> path` precedes it. */
104
+ outputTarget?: string;
105
+ /** Whether the body is dynamically constructed (unresolvable expansion). */
106
+ dynamic: boolean;
81
107
  }
82
108
  /** A command parsed into a reusable structure. Wraps the existing lexer output
83
109
  * plus pre-extracted redirections and heredocs. */
84
110
  interface ParsedCommand {
85
- /** The command after heredoc bodies were replaced with placeholders. */
86
- sanitizedCommand: string;
87
- /** Lexed segments of the sanitized command. */
88
- segments: ShellSegment[];
89
- /** Effective commands (wrappers peeled) per segment. */
90
- effective: ShellToken[][];
91
- /** Redirections grouped by segment index. */
92
- redirections: Redirection[][];
93
- /** Heredocs extracted before lexing. */
94
- heredocs: HeredocRecord[];
95
- /** Whether the original command contained any dynamic constructs. */
96
- hasDynamicConstructs: boolean;
97
- /** True when the lexer's depth or expansion budget stopped command-string
98
- * resolution early; `effective` is then a prefix of the real structure and
99
- * deterministic facts do not cover the whole command. */
100
- analysisTruncated: boolean;
111
+ /** The command after heredoc bodies were replaced with placeholders. */
112
+ sanitizedCommand: string;
113
+ /** Lexed segments of the sanitized command. */
114
+ segments: ShellSegment[];
115
+ /** Effective commands (wrappers peeled) per segment. */
116
+ effective: ShellToken[][];
117
+ /** Redirections grouped by segment index. */
118
+ redirections: Redirection[][];
119
+ /** Heredocs extracted before lexing. */
120
+ heredocs: HeredocRecord[];
121
+ /** Whether the original command contained any dynamic constructs. */
122
+ hasDynamicConstructs: boolean;
123
+ /** True when the lexer's depth or expansion budget stopped command-string
124
+ * resolution early; `effective` is then a prefix of the real structure and
125
+ * deterministic facts do not cover the whole command. */
126
+ analysisTruncated: boolean;
127
+ /** The effective commands that run on the far side of an ssh with no
128
+ * remote command, from the script it reads. They are among `effective`
129
+ * too. */
130
+ remoteCommands?: ShellToken[][];
131
+ /** Every command the walk resolves, wrappers among them, at every level:
132
+ * command strings, `env -S`, `watch` and ssh remote commands. */
133
+ heads: readonly PeeledHead[];
134
+ /** The redirections each walked segment and command string carries
135
+ * itself, whether or not it yields an effective command: the shell
136
+ * opens them before it runs anything (`>f ssh h`). */
137
+ segmentRedirections: readonly (readonly Redirection[])[];
138
+ /** An interpreter among the commands runs code from a heredoc or
139
+ * here-string. */
140
+ stdinCode?: boolean;
101
141
  }
102
142
  /** What the action can do, what it appears to do, and analysis confidence. */
103
143
  interface CapabilityAssessment {
104
- /** Best single-label summary of the dominant capability. */
105
- actionClass: Provenanced<CapabilityActionClass>;
106
- /** Human-readable summary of the detected surface. */
107
- summary: string;
108
- /** Executes an interpreter or runtime (sh, python, node, bun, …). */
109
- executesCode: Provenanced<boolean | "unknown">;
110
- /** Executes code that lives in the repository (scripts, test files). */
111
- executesRepositoryCode: Provenanced<boolean | "unknown">;
112
- /** Executes ad-hoc code generated by the agent (heredoc/inline). */
113
- createsAdHocCode: Provenanced<boolean | "unknown">;
114
- /** Invokes a known test runner (pytest, jest, bun test, …). */
115
- invokesExistingTestRunner: Provenanced<boolean | "unknown">;
116
- /** Runs a package manager that may execute lifecycle scripts. */
117
- invokesPackageLifecycleScripts: Provenanced<boolean | "unknown">;
118
- /** Reads literal credential material through a known file reader. */
119
- credentialRead: Provenanced<boolean | "unknown">;
120
- /** Detected file-write surface. */
121
- writeEffects: {
122
- temporaryWrite: Provenanced<boolean | "unknown">;
123
- workspaceWrite: Provenanced<boolean | "unknown">;
124
- externalWrite: Provenanced<boolean | "unknown">;
125
- deletion: Provenanced<boolean | "unknown">;
126
- };
127
- /** Detected network surface. */
128
- network: {
129
- observed: Provenanced<boolean | "unknown">;
130
- possible: Provenanced<boolean | "unknown">;
131
- /** Hosts/destinations observed literally in the command. */
132
- destinations: string[];
133
- observedAccess: Provenanced<boolean | "unknown">;
134
- possibleAccess: Provenanced<boolean | "unknown">;
135
- };
136
- /** Detected process side-effects. */
137
- process: {
138
- childProcesses: Provenanced<boolean | "unknown">;
139
- persistence: Provenanced<boolean | "unknown">;
140
- privilegeEscalation: Provenanced<boolean | "unknown">;
141
- };
142
- /** Detected remote-operation surface (ssh, etc.). */
143
- remote: {
144
- enabled: Provenanced<boolean | "unknown">;
145
- mutationHint: Provenanced<boolean | "unknown">;
146
- };
147
- /** Detected git mutation surface. */
148
- git: {
149
- observed: Provenanced<boolean | "unknown">;
150
- possible: Provenanced<boolean | "unknown">;
151
- observedAccess: Provenanced<boolean | "unknown">;
152
- possibleAccess: Provenanced<boolean | "unknown">;
153
- };
154
- /** How completely the command could be analyzed. */
155
- parserCompleteness: ParserCompleteness;
156
- /** Free-form warnings about analysis limitations. */
157
- analysisWarnings: string[];
144
+ /** Best single-label summary of the dominant capability. */
145
+ actionClass: Provenanced<CapabilityActionClass>;
146
+ /** Human-readable summary of the detected surface. */
147
+ summary: string;
148
+ /** Executes an interpreter or runtime (sh, python, node, bun, …). */
149
+ executesCode: Provenanced<boolean | "unknown">;
150
+ /** Executes code that lives in the repository (scripts, test files). */
151
+ executesRepositoryCode: Provenanced<boolean | "unknown">;
152
+ /** Executes ad-hoc code generated by the agent (heredoc/inline). */
153
+ createsAdHocCode: Provenanced<boolean | "unknown">;
154
+ /** Invokes a known test runner (pytest, jest, bun test, …). */
155
+ invokesExistingTestRunner: Provenanced<boolean | "unknown">;
156
+ /** Runs a package manager that may execute lifecycle scripts. */
157
+ invokesPackageLifecycleScripts: Provenanced<boolean | "unknown">;
158
+ /** Reads literal credential material through a known file reader. */
159
+ credentialRead: Provenanced<boolean | "unknown">;
160
+ /** Detected file-write surface. */
161
+ writeEffects: {
162
+ temporaryWrite: Provenanced<boolean | "unknown">;
163
+ workspaceWrite: Provenanced<boolean | "unknown">;
164
+ externalWrite: Provenanced<boolean | "unknown">;
165
+ deletion: Provenanced<boolean | "unknown">;
166
+ };
167
+ /** Detected network surface. */
168
+ network: {
169
+ observed: Provenanced<boolean | "unknown">;
170
+ possible: Provenanced<boolean | "unknown">;
171
+ /** Hosts/destinations observed literally in the command. */
172
+ destinations: string[];
173
+ observedAccess: Provenanced<boolean | "unknown">;
174
+ possibleAccess: Provenanced<boolean | "unknown">;
175
+ };
176
+ /** Detected process side-effects. */
177
+ process: {
178
+ childProcesses: Provenanced<boolean | "unknown">;
179
+ persistence: Provenanced<boolean | "unknown">;
180
+ privilegeEscalation: Provenanced<boolean | "unknown">;
181
+ };
182
+ /** Detected remote-operation surface (ssh, etc.). */
183
+ remote: {
184
+ enabled: Provenanced<boolean | "unknown">;
185
+ mutationHint: Provenanced<boolean | "unknown">;
186
+ };
187
+ /** Detected git mutation surface. */
188
+ git: {
189
+ observed: Provenanced<boolean | "unknown">;
190
+ possible: Provenanced<boolean | "unknown">;
191
+ observedAccess: Provenanced<boolean | "unknown">;
192
+ possibleAccess: Provenanced<boolean | "unknown">;
193
+ };
194
+ /** How completely the command could be analyzed. */
195
+ parserCompleteness: ParserCompleteness;
196
+ /** Free-form warnings about analysis limitations. */
197
+ analysisWarnings: string[];
158
198
  }
159
-
199
+ //#endregion
200
+ //#region src/system-one/system-one-types.d.ts
160
201
  declare const SYSTEM_ONE_BASES: readonly ["authorized_routine", "authorized_reversible_change", "insufficient_authorization", "scope_mismatch", "insufficient_evidence", "destructive_effect", "credential_or_private_data", "security_or_privilege_change", "external_or_remote_effect", "trusted_policy_restriction", "conflicting_evidence"];
161
202
  type SystemOnePrimaryBasis = (typeof SYSTEM_ONE_BASES)[number];
162
203
  interface SystemOneChoiceScore<T extends string> {
163
- choice: T;
164
- confidence: number;
204
+ choice: T;
205
+ confidence: number;
165
206
  }
166
207
  /** Probability (0-1) that each safety question is true. */
167
208
  interface SystemOneSignals {
168
- materialAuthorization: number;
169
- withinIntentScope: number;
170
- unauthorizedDataLoss: number;
171
- untrustedSensitiveDisclosure: number;
172
- excessiveCredentialAccess: number;
173
- unauthorizedSecurityChange: number;
174
- unauthorizedExternalMutation: number;
175
- essentialEvidenceMissing: number;
176
- absolutePolicyDeny: number;
209
+ materialAuthorization: number;
210
+ withinIntentScope: number;
211
+ unauthorizedDataLoss: number;
212
+ untrustedSensitiveDisclosure: number;
213
+ excessiveCredentialAccess: number;
214
+ unauthorizedSecurityChange: number;
215
+ unauthorizedExternalMutation: number;
216
+ essentialEvidenceMissing: number;
217
+ absolutePolicyDeny: number;
177
218
  }
178
219
  /**
179
220
  * Jev's own answer, kept apart from the final decision because a reasoning
@@ -181,24 +222,25 @@ interface SystemOneSignals {
181
222
  * and the provider-reported model ID only; never evidence text.
182
223
  */
183
224
  interface SystemOneScores {
184
- /** Versioned model ID the provider reported as having answered. */
185
- returnedModel: string;
186
- outcome: SystemOneChoiceScore<ReviewOutcome> & {
187
- probabilities: Record<ReviewOutcome, number>;
188
- };
189
- supporting: {
190
- riskLevel: SystemOneChoiceScore<RiskLevel>;
191
- userAuthorization: SystemOneChoiceScore<UserAuthorization>;
192
- scopeAlignment: SystemOneChoiceScore<ScopeAlignment>;
193
- evidenceCompleteness: SystemOneChoiceScore<EvidenceSufficiency>;
194
- primaryBasis: SystemOneChoiceScore<SystemOnePrimaryBasis>;
195
- };
196
- signals: SystemOneSignals;
197
- /** Consistency checks that failed; any one marks an allow or deny difficult. */
198
- contradictions: string[];
199
- reasoningRecommended: boolean;
225
+ /** Versioned model ID the provider reported as having answered. */
226
+ returnedModel: string;
227
+ outcome: SystemOneChoiceScore<ReviewOutcome> & {
228
+ probabilities: Record<ReviewOutcome, number>;
229
+ };
230
+ supporting: {
231
+ riskLevel: SystemOneChoiceScore<RiskLevel>;
232
+ userAuthorization: SystemOneChoiceScore<UserAuthorization>;
233
+ scopeAlignment: SystemOneChoiceScore<ScopeAlignment>;
234
+ evidenceCompleteness: SystemOneChoiceScore<EvidenceSufficiency>;
235
+ primaryBasis: SystemOneChoiceScore<SystemOnePrimaryBasis>;
236
+ };
237
+ signals: SystemOneSignals;
238
+ /** Consistency checks that failed; any one marks an allow or deny difficult. */
239
+ contradictions: string[];
240
+ reasoningRecommended: boolean;
200
241
  }
201
-
242
+ //#endregion
243
+ //#region src/types.d.ts
202
244
  type RiskLevel = "low" | "medium" | "high" | "critical";
203
245
  type UserAuthorization = "high" | "medium" | "low" | "unknown";
204
246
  type ReviewOutcome = "allow" | "deny" | "escalate";
@@ -208,41 +250,43 @@ type EvidenceSufficiency = "sufficient" | "partial" | "insufficient" | "unknown"
208
250
  type EscalationMode = "manual" | "deny";
209
251
  /** Effective disposition applied to an internal escalate result. */
210
252
  type EscalationDisposition = "manual" | "deny";
253
+ /** Where an escalation that starts at Jev goes; `reasoning-first` sends every one to the escalation reviewer. */
254
+ type SystemOneEscalationMode = "standard" | "reasoning-first";
211
255
  interface ReviewDecision {
212
- /** Structured-decision schema version. Always 2 for the current schema. */
213
- version: 2;
214
- outcome: ReviewOutcome;
215
- risk_level: RiskLevel;
216
- user_authorization: UserAuthorization;
217
- /** How well the request aligns with the recovered user/delegated intent. */
218
- scope_alignment: ScopeAlignment;
219
- /** Whether the evidence was sufficient to decide confidently. */
220
- evidence_completeness: EvidenceSufficiency;
221
- rationale: string;
222
- confidence: number;
223
- /** Optional script-only semantic analysis. Never conveys authorization. */
224
- script_analysis?: string;
256
+ /** Structured-decision schema version. Always 2 for the current schema. */
257
+ version: 2;
258
+ outcome: ReviewOutcome;
259
+ risk_level: RiskLevel;
260
+ user_authorization: UserAuthorization;
261
+ /** How well the request aligns with the recovered user/delegated intent. */
262
+ scope_alignment: ScopeAlignment;
263
+ /** Whether the evidence was sufficient to decide confidently. */
264
+ evidence_completeness: EvidenceSufficiency;
265
+ rationale: string;
266
+ confidence: number;
267
+ /** Optional script-only semantic analysis. Never conveys authorization. */
268
+ script_analysis?: string;
225
269
  }
226
270
  interface PermissionToolSource {
227
- messageID: string;
228
- callID: string;
271
+ messageID: string;
272
+ callID: string;
229
273
  }
230
274
  interface PermissionRequest {
231
- id: string;
232
- sessionID: string;
233
- permission: string;
234
- patterns: string[];
235
- metadata: Record<string, unknown>;
236
- always: string[];
237
- tool?: PermissionToolSource;
275
+ id: string;
276
+ sessionID: string;
277
+ permission: string;
278
+ patterns: string[];
279
+ metadata: Record<string, unknown>;
280
+ always: string[];
281
+ tool?: PermissionToolSource;
238
282
  }
239
283
  interface MessageWithParts {
240
- info: Record<string, unknown> & {
241
- id?: string;
242
- role?: string;
243
- structured?: unknown;
244
- };
245
- parts: Array<Record<string, unknown>>;
284
+ info: Record<string, unknown> & {
285
+ id?: string;
286
+ role?: string;
287
+ structured?: unknown;
288
+ };
289
+ parts: Array<Record<string, unknown>>;
246
290
  }
247
291
  /** Deterministic risk×authorization matrix that gates reviewer `allow`
248
292
  * outcomes. For each risk level, lists the authorization levels that permit an
@@ -250,15 +294,15 @@ interface MessageWithParts {
250
294
  * risk (the action is escalated). Only ever RESTRICTS; deny/escalate are always
251
295
  * preserved. */
252
296
  interface RiskPolicy {
253
- allow: {
254
- low: UserAuthorization[];
255
- medium: UserAuthorization[];
256
- high: UserAuthorization[];
257
- critical: UserAuthorization[];
258
- };
259
- minimumConfidence: number;
260
- onInvalidDecision: "manual" | "deny";
261
- onReviewerFailure: "manual" | "deny";
297
+ allow: {
298
+ low: UserAuthorization[];
299
+ medium: UserAuthorization[];
300
+ high: UserAuthorization[];
301
+ critical: UserAuthorization[];
302
+ };
303
+ minimumConfidence: number;
304
+ onInvalidDecision: "manual" | "deny";
305
+ onReviewerFailure: "manual" | "deny";
262
306
  }
263
307
  /** Conservative repository trust model. A repository cannot mark itself trusted
264
308
  * through project configuration alone — trust comes from global config or an
@@ -268,300 +312,320 @@ type RepositoryTrust = "trusted" | "untrusted" | "unknown";
268
312
  * is optional; the rule matches when ALL specified fields match. A missing
269
313
  * `when` (or `{ always: true }`) makes the rule universal. */
270
314
  interface PolicyCondition {
271
- /** Explicit catch-all: valid only as the sole key. */
272
- always?: true;
273
- actionClass?: CapabilityActionClass[];
274
- actorProfile?: ActorProfile[];
275
- writesWorkspace?: boolean;
276
- writesExternal?: boolean;
277
- writesTemporary?: boolean;
278
- deletion?: boolean;
279
- executesCode?: boolean;
280
- createsAdHocCode?: boolean;
281
- packageManagement?: boolean;
282
- gitMutation?: boolean;
283
- networkObserved?: boolean;
284
- credentialRead?: boolean;
285
- privilegeEscalation?: boolean;
286
- remoteEnabled?: boolean;
287
- persistence?: boolean;
288
- repositoryTrust?: RepositoryTrust[];
315
+ /** Explicit catch-all: valid only as the sole key. */
316
+ always?: true;
317
+ actionClass?: CapabilityActionClass[];
318
+ actorProfile?: ActorProfile[];
319
+ writesWorkspace?: boolean;
320
+ writesExternal?: boolean;
321
+ writesTemporary?: boolean;
322
+ deletion?: boolean;
323
+ executesCode?: boolean;
324
+ createsAdHocCode?: boolean;
325
+ packageManagement?: boolean;
326
+ gitMutation?: boolean;
327
+ networkObserved?: boolean;
328
+ credentialRead?: boolean;
329
+ privilegeEscalation?: boolean;
330
+ remoteEnabled?: boolean;
331
+ persistence?: boolean;
332
+ repositoryTrust?: RepositoryTrust[];
289
333
  }
290
334
  /** A declarative rule that routes a request based on capability+actor facts.
291
335
  * `when` is optional: omitting it (or `{ always: true }`) matches every
292
336
  * request. An explicitly empty `when: {}` is rejected at load. */
293
337
  interface PolicyRule {
294
- id: string;
295
- source: "builtin" | "global" | "project" | "inline";
296
- when?: PolicyCondition;
297
- effect: "review" | "manual" | "deny" | "allow";
298
- reason: string;
338
+ id: string;
339
+ source: "builtin" | "global" | "project" | "inline";
340
+ when?: PolicyCondition;
341
+ effect: "review" | "manual" | "deny" | "allow";
342
+ reason: string;
299
343
  }
300
344
  /** The result of evaluating the declarative policy. */
301
345
  interface PolicyTrace {
302
- /** Stable hash of the effective rule set (not the matched rules) for audit
303
- * reproducibility. */
304
- effectivePolicyHash: string;
305
- matchedRules: Array<{
306
- id: string;
307
- source: string;
308
- effect: string;
309
- reason: string;
310
- }>;
311
- /** The route the engine computed (counterfactual in observe mode: what enforce
312
- * mode WOULD have done with the same facts and rules). */
313
- finalRoute: "review" | "manual" | "deny" | "allow";
314
- mode: "observe" | "enforce";
346
+ /** Stable hash of the effective rule set (not the matched rules) for audit
347
+ * reproducibility. */
348
+ effectivePolicyHash: string;
349
+ matchedRules: Array<{
350
+ id: string;
351
+ source: string;
352
+ effect: string;
353
+ reason: string;
354
+ }>;
355
+ /** The route the engine computed (counterfactual in observe mode: what enforce
356
+ * mode WOULD have done with the same facts and rules). */
357
+ finalRoute: "review" | "manual" | "deny" | "allow";
358
+ mode: "observe" | "enforce";
315
359
  }
316
360
  type ReviewerOutputFormat = "json_schema" | "text";
317
361
  interface EscalationReviewerConfig {
318
- model: string;
319
- variant: string;
320
- outputFormat: ReviewerOutputFormat;
321
- timeoutMs: number;
362
+ model: string;
363
+ variant: string;
364
+ outputFormat: ReviewerOutputFormat;
365
+ timeoutMs: number;
322
366
  }
323
367
  interface ReviewerConfig {
324
- model: string;
325
- variant: string;
326
- /** How the reviewer model returns its decision. `json_schema` requests
327
- * OpenCode's structured-output format (requires provider support); `text`
328
- * asks the model to emit JSON in plain text and parses it locally. */
329
- outputFormat: ReviewerOutputFormat;
330
- /** Optional reasoning reviewer for valid System One decisions that remain
331
- * uncertain or conflict with deterministic review gates. */
332
- escalationReviewer?: EscalationReviewerConfig;
333
- /** Calibrated outcome-confidence floor for System One decisions. */
334
- systemOneConfidenceThreshold: number;
335
- /** Minimum combined non-escalate probability for routing an explicit
336
- * System One escalation to the optional reasoning reviewer. */
337
- systemOneReasoningThreshold: number;
338
- timeoutMs: number;
339
- /** Total review budget, including context, queueing, and retries. */
340
- reviewBudgetMs?: number;
341
- maxContextChars: number;
342
- maxPartChars: number;
343
- maxEnrichmentChars: number;
344
- maxIntentChars: number;
345
- transcriptMessages: number;
346
- intentMessages: number;
347
- historyMessages: number;
348
- confidenceThreshold: number;
349
- retainReviewSessions: boolean;
350
- audit: boolean;
351
- auditPath?: string;
352
- policy?: string;
353
- debug: boolean;
354
- /** When "observe", actor evidence is collected and audited but never enforces
355
- * new gates; "enforce" applies declarative policy routes. */
356
- enforcementMode: "observe" | "enforce";
357
- /**
358
- * How internal `escalate` results are disposed before UI/reply.
359
- * - `manual` (default): leave the request for a human (interactive mode).
360
- * - `deny`: convert every final escalation into a reject with rationale
361
- * (non-interactive fail-closed). Never relaxes an explicit deny.
362
- */
363
- escalationMode: EscalationMode;
364
- /** Max hops when walking session parents (default 8). */
365
- maxSessionDepth: number;
366
- /** Max parent sessions fetched during lineage traversal. */
367
- maxParentSessions: number;
368
- /** Trusted name→profile mappings (empty by default; no mappings shipped). */
369
- actorProfiles: Record<string, ActorProfile>;
370
- /** Deterministic risk×authorization gate, configurable but defaults reproduce
371
- * the previous hard-coded matrix exactly. */
372
- riskPolicy: RiskPolicy;
373
- /** Repository trust level derived from global config (never from project). */
374
- repositoryTrust: RepositoryTrust;
375
- /** Declarative policy rules (empty by default; observe mode audits the trace
376
- * without enforcing). Project-sourced allow rules are rejected. */
377
- policyRules: PolicyRule[];
378
- /** Capture user answers to agent ask dialogs (question tool) and surface
379
- * them to the reviewer as scoped authorization evidence. */
380
- askDecisions: boolean;
381
- /** Non-empty when a TRUSTED config source (global file, inline options)
382
- * existed but could not be fully honored (malformed file, unreadable file,
383
- * or rules dropped by validation). Degraded configs block automatic
384
- * approval: restrictions may have been lost, so requests escalate instead. */
385
- configDegraded?: string[];
368
+ model: string;
369
+ variant: string;
370
+ /** How the reviewer model returns its decision. `json_schema` requests
371
+ * OpenCode's structured-output format (requires provider support); `text`
372
+ * asks the model to emit JSON in plain text and parses it locally. */
373
+ outputFormat: ReviewerOutputFormat;
374
+ /** Optional reasoning reviewer for valid System One decisions that remain
375
+ * uncertain or conflict with deterministic review gates. */
376
+ escalationReviewer?: EscalationReviewerConfig;
377
+ /** Calibrated outcome-confidence floor for System One decisions. */
378
+ systemOneConfidenceThreshold: number;
379
+ /** Minimum combined non-escalate probability for routing an explicit
380
+ * System One escalation to the optional reasoning reviewer. */
381
+ systemOneReasoningThreshold: number;
382
+ /** Read through resolveSystemOneRouting, which applies the Jev and escalationReviewer conditions. */
383
+ systemOneEscalation: SystemOneEscalationMode;
384
+ /** Send uncertain Jev denials to the escalation reviewer. Read through resolveSystemOneRouting. */
385
+ systemOneDenialReview: boolean;
386
+ timeoutMs: number;
387
+ /** Total review budget, including context, queueing, and retries. */
388
+ reviewBudgetMs?: number;
389
+ maxContextChars: number;
390
+ maxPartChars: number;
391
+ maxEnrichmentChars: number;
392
+ maxIntentChars: number;
393
+ transcriptMessages: number;
394
+ intentMessages: number;
395
+ historyMessages: number;
396
+ confidenceThreshold: number;
397
+ retainReviewSessions: boolean;
398
+ audit: boolean;
399
+ auditPath?: string;
400
+ policy?: string;
401
+ debug: boolean;
402
+ /** When "observe", actor evidence is collected and audited but never enforces
403
+ * new gates; "enforce" applies declarative policy routes. */
404
+ enforcementMode: "observe" | "enforce";
405
+ /**
406
+ * How internal `escalate` results are disposed before UI/reply.
407
+ * - `manual` (default): leave the request for a human (interactive mode).
408
+ * - `deny`: convert every final escalation into a reject with rationale
409
+ * (non-interactive fail-closed). Never relaxes an explicit deny.
410
+ */
411
+ escalationMode: EscalationMode;
412
+ /** Max hops when walking session parents (default 8). */
413
+ maxSessionDepth: number;
414
+ /** Max parent sessions fetched during lineage traversal. */
415
+ maxParentSessions: number;
416
+ /** Trusted name→profile mappings (empty by default; no mappings shipped). */
417
+ actorProfiles: Record<string, ActorProfile>;
418
+ /** Deterministic risk×authorization gate, configurable but defaults reproduce
419
+ * the previous hard-coded matrix exactly. */
420
+ riskPolicy: RiskPolicy;
421
+ /** Repository trust level derived from global config (never from project). */
422
+ repositoryTrust: RepositoryTrust;
423
+ /** Declarative policy rules (empty by default; observe mode audits the trace
424
+ * without enforcing). Project-sourced allow rules are rejected. */
425
+ policyRules: PolicyRule[];
426
+ /** Capture user answers to agent ask dialogs (question tool) and surface
427
+ * them to the reviewer as scoped authorization evidence. */
428
+ askDecisions: boolean;
429
+ /** Non-empty when a TRUSTED config source (global file, inline options)
430
+ * existed but could not be fully honored (malformed file, unreadable file,
431
+ * or rules dropped by validation). Degraded configs block automatic
432
+ * approval: restrictions may have been lost, so requests escalate instead. */
433
+ configDegraded?: string[];
434
+ /** Non-empty when a setting was invalid and fell back to its default, or is
435
+ * on but inert. Informational only: never affects a decision. */
436
+ configWarnings?: string[];
386
437
  }
387
438
  interface ReviewEnvelope {
388
- request: PermissionRequest;
389
- directory: string;
390
- worktree: string;
391
- transcript: string;
392
- intentHistory: string;
393
- enrichment: string;
394
- verifiedScript?: VerifiedScriptEvidence;
395
- sshAudit: NonNullable<ReviewAuditRecord["ssh"]>;
396
- preflightDenial?: string;
397
- /** Agent-aware context (actor, lineage, intent). Observe-only: flows into the
398
- * reviewer prompt and audit as evidence, never into enforcement decisions.
399
- * Optional so older callers/tests still compile. */
400
- actor?: ActorContext;
401
- lineage?: SessionLineage;
402
- intent?: IntentContext;
403
- evidenceCompleteness?: EvidenceCompleteness;
404
- /** Structured capability facts derived from the bash command. Observe-only:
405
- * feeds the reviewer prompt and audit, never enforcement. */
406
- capability?: CapabilityAssessment;
407
- /** The policy trace produced for this request, surfaced to the reviewer prompt
408
- * as EFFECTIVE_POLICY_SUMMARY and to audit. Observe-only. */
409
- policyTrace?: PolicyTrace;
410
- /** Per-phase timing captured during evidence assembly (context/enrichment).
411
- * The reviewer and reply phases are timed in the coordinator. */
412
- timings?: {
413
- contextMs?: number;
414
- enrichmentMs?: number;
415
- reviewerMs?: number;
416
- replyMs?: number;
417
- };
418
- /** False when a material part of the action under review (e.g. an elided
419
- * command segment) never reached the rendered evidence. Blocking: the
420
- * coordinator must not auto-approve an action the reviewer could not see
421
- * in full, whatever confidence the model reports. */
422
- actionEvidenceComplete?: boolean;
423
- /** The parsed command reused across evidence providers. */
424
- parsedCommand?: ParsedCommand;
425
- /** Operational purpose of the pending action (evidence, never authorization). */
426
- actionPurpose?: ActionPurpose;
427
- /** User answers to agent ask dialogs in this session or its ancestors,
428
- * captured live from question events. Observe-only: flows into the reviewer
429
- * prompt (USER_ASK_DECISIONS) and audit, never into enforcement. */
430
- askDecisions?: AskDecision[];
439
+ request: PermissionRequest;
440
+ directory: string;
441
+ worktree: string;
442
+ transcript: string;
443
+ intentHistory: string;
444
+ enrichment: string;
445
+ verifiedScript?: VerifiedScriptEvidence;
446
+ sshAudit: NonNullable<ReviewAuditRecord["ssh"]>;
447
+ preflightDenial?: string;
448
+ /** Agent-aware context (actor, lineage, intent). Observe-only: flows into the
449
+ * reviewer prompt and audit as evidence, never into enforcement decisions.
450
+ * Optional so older callers/tests still compile. */
451
+ actor?: ActorContext;
452
+ lineage?: SessionLineage;
453
+ intent?: IntentContext;
454
+ evidenceCompleteness?: EvidenceCompleteness;
455
+ /** Structured capability facts derived from the bash command. Observe-only:
456
+ * feeds the reviewer prompt and audit, never enforcement. */
457
+ capability?: CapabilityAssessment;
458
+ /** The policy trace produced for this request, surfaced to the reviewer prompt
459
+ * as EFFECTIVE_POLICY_SUMMARY and to audit. Observe-only. */
460
+ policyTrace?: PolicyTrace;
461
+ /** Per-phase timing captured during evidence assembly (context/enrichment).
462
+ * The reviewer and reply phases are timed in the coordinator. */
463
+ timings?: {
464
+ contextMs?: number;
465
+ enrichmentMs?: number;
466
+ reviewerMs?: number;
467
+ replyMs?: number;
468
+ };
469
+ /** False when a material part of the action under review (e.g. an elided
470
+ * command segment) never reached the rendered evidence. Blocking: the
471
+ * coordinator must not auto-approve an action the reviewer could not see
472
+ * in full, whatever confidence the model reports. */
473
+ actionEvidenceComplete?: boolean;
474
+ /** The parsed command reused across evidence providers. */
475
+ parsedCommand?: ParsedCommand;
476
+ /** Operational purpose of the pending action (evidence, never authorization). */
477
+ actionPurpose?: ActionPurpose;
478
+ /** User answers to agent ask dialogs in this session or its ancestors,
479
+ * captured live from question events. Observe-only: flows into the reviewer
480
+ * prompt (USER_ASK_DECISIONS) and audit, never into enforcement. */
481
+ askDecisions?: AskDecision[];
431
482
  }
432
483
  interface ApprovedAnnotation {
433
- requestID: string;
434
- sessionID: string;
435
- decision: ReviewDecision;
484
+ requestID: string;
485
+ sessionID: string;
486
+ decision: ReviewDecision;
487
+ }
488
+ /** Why a System One (Jev) result was handed to the reasoning reviewer. */
489
+ type HandoffTrigger = "jev-escalate" | "jev-uncertain-allow" | "jev-gate" | "jev-invalid" | "jev-failure" | "jev-uncertain-deny";
490
+ /** The primary model, routing reason and hand-off trigger of a review a
491
+ * second reviewer decided. */
492
+ interface EscalatedFrom {
493
+ model: string;
494
+ reason: string;
495
+ trigger?: HandoffTrigger;
436
496
  }
497
+ /** How an escalation that left the System One backend was reached. */
498
+ type ManualResolution = "reviewer" | "reasoning-escalated" | "reasoning-unavailable" | "budget-exhausted";
437
499
  interface ReviewExecutionResult {
438
- kind: "allow" | "deny" | "escalate";
439
- decision?: ReviewDecision;
440
- reason: string;
441
- reviewSessionID?: string;
442
- /** Which layer produced this result; threaded into the audit record. */
443
- decisionSource?: DecisionSource;
444
- /** Actual model that produced the final reviewer decision. */
445
- reviewerModel?: string;
446
- /** Primary model and routing reason when a second reviewer was used. */
447
- reviewerEscalatedFrom?: {
448
- model: string;
449
- reason: string;
450
- };
451
- /** Jev's scores whenever it returned a parsed decision. */
452
- systemOne?: SystemOneScores;
453
- /**
454
- * Structured outcome from the reviewer LLM before gates/disposition.
455
- * Absent when no valid structured decision was produced.
456
- */
457
- reviewerOutcome?: ReviewOutcome;
458
- /**
459
- * How an internal escalate was disposed at the enforcement boundary.
460
- * Absent when the result was never an escalate (explicit allow/deny) or when
461
- * the request was already answered manually (`manual-superseded`).
462
- */
463
- escalationDisposition?: EscalationDisposition;
500
+ kind: "allow" | "deny" | "escalate";
501
+ decision?: ReviewDecision;
502
+ reason: string;
503
+ reviewSessionID?: string;
504
+ /** Which layer produced this result; threaded into the audit record. */
505
+ decisionSource?: DecisionSource;
506
+ /** Actual model that produced the final reviewer decision. */
507
+ reviewerModel?: string;
508
+ /** Primary model, routing reason and hand-off trigger when a second
509
+ * reviewer was used. */
510
+ reviewerEscalatedFrom?: EscalatedFrom;
511
+ /** Jev's scores whenever it returned a parsed decision. */
512
+ systemOne?: SystemOneScores;
513
+ /**
514
+ * Structured outcome from the reviewer LLM before gates/disposition.
515
+ * Absent when no valid structured decision was produced.
516
+ */
517
+ reviewerOutcome?: ReviewOutcome;
518
+ /**
519
+ * How an internal escalate was disposed at the enforcement boundary.
520
+ * Absent when the result was never an escalate (explicit allow/deny) or when
521
+ * the request was already answered manually (`manual-superseded`).
522
+ */
523
+ escalationDisposition?: EscalationDisposition;
524
+ /** Set only by the System One backend, on escalations; kept when a
525
+ * disposition turns one into a deny. */
526
+ resolution?: ManualResolution;
464
527
  }
465
528
  /** Generic policy templates, NOT automatic trust levels. */
466
529
  type ActorProfile = "read-only" | "validation" | "workspace" | "operator" | "reviewer" | "unknown";
467
530
  /** High-level classification of what the action does. */
468
531
  type CapabilityActionClass = "read-only" | "workspace-write" | "temporary-write" | "external-write" | "destruction" | "code-execution" | "package-management" | "git-mutation" | "network" | "remote-operation" | "service-management" | "persistence" | "privilege-escalation" | "unknown";
469
-
532
+ //#endregion
533
+ //#region src/actor-context-types.d.ts
470
534
  /** Reliability of a derived fact. */
471
535
  type EvidenceConfidence = "confirmed" | "high" | "medium" | "low" | "unknown";
472
536
  /** Every non-trivial derived fact carries provenance so the LLM and audit can
473
537
  * weigh claims by how reliably they were established. */
474
538
  interface Provenanced<T> {
475
- value: T;
476
- source: "permission-event" | "tool-message" | "session-api" | "parent-session" | "global-config" | "project-config" | "effective-permissions" | "static-analysis" | "heuristic" | "unavailable";
477
- confidence: EvidenceConfidence;
478
- notes?: string[];
539
+ value: T;
540
+ source: "permission-event" | "tool-message" | "session-api" | "parent-session" | "global-config" | "project-config" | "effective-permissions" | "static-analysis" | "heuristic" | "unavailable";
541
+ confidence: EvidenceConfidence;
542
+ notes?: string[];
479
543
  }
480
544
  /** Normalized effective-permission summary when the SDK exposes it.
481
545
  * The v1 SDK does not expose effective rules, so this stays `undefined`. */
482
546
  interface EffectivePermissionSummary {
483
- edit: "allow" | "ask" | "deny" | "mixed" | "unknown";
484
- bash: "allow" | "ask" | "deny" | "mixed" | "unknown";
485
- task: "allow" | "ask" | "deny" | "mixed" | "unknown";
486
- externalDirectory: "allow" | "ask" | "deny" | "mixed" | "unknown";
487
- source: "session" | "agent-config" | "derived" | "unknown";
547
+ edit: "allow" | "ask" | "deny" | "mixed" | "unknown";
548
+ bash: "allow" | "ask" | "deny" | "mixed" | "unknown";
549
+ task: "allow" | "ask" | "deny" | "mixed" | "unknown";
550
+ externalDirectory: "allow" | "ask" | "deny" | "mixed" | "unknown";
551
+ source: "session" | "agent-config" | "derived" | "unknown";
488
552
  }
489
553
  /** Who is requesting the permission. */
490
554
  interface ActorContext {
491
- agentName: Provenanced<string | undefined>;
492
- mode: Provenanced<string | undefined>;
493
- profile: Provenanced<ActorProfile>;
494
- sessionID: string;
495
- parentSessionID: Provenanced<string | undefined>;
496
- rootSessionID: Provenanced<string>;
497
- delegationDepth: Provenanced<number>;
498
- effectivePermissions?: EffectivePermissionSummary;
499
- identityCompleteness: "complete" | "partial" | "unknown";
555
+ agentName: Provenanced<string | undefined>;
556
+ mode: Provenanced<string | undefined>;
557
+ profile: Provenanced<ActorProfile>;
558
+ sessionID: string;
559
+ parentSessionID: Provenanced<string | undefined>;
560
+ rootSessionID: Provenanced<string>;
561
+ delegationDepth: Provenanced<number>;
562
+ effectivePermissions?: EffectivePermissionSummary;
563
+ identityCompleteness: "complete" | "partial" | "unknown";
500
564
  }
501
565
  /** A node in the session ancestry chain. */
502
566
  interface SessionNode {
503
- sessionID: string;
504
- parentID?: string;
505
- title?: string;
506
- version?: string;
507
- actorName?: string;
508
- mode?: string;
509
- createdAt?: number;
567
+ sessionID: string;
568
+ parentID?: string;
569
+ title?: string;
570
+ version?: string;
571
+ actorName?: string;
572
+ mode?: string;
573
+ createdAt?: number;
510
574
  }
511
575
  /** The resolved session ancestry with failure modes made explicit. */
512
576
  interface SessionLineage {
513
- origin?: "human-root" | "delegated" | "unknown";
514
- nodes: SessionNode[];
515
- rootSessionID: string;
516
- depth: number;
517
- cycleDetected: boolean;
518
- truncated: boolean;
519
- missingParents: string[];
577
+ origin?: "human-root" | "delegated" | "unknown";
578
+ nodes: SessionNode[];
579
+ rootSessionID: string;
580
+ depth: number;
581
+ cycleDetected: boolean;
582
+ truncated: boolean;
583
+ missingParents: string[];
520
584
  }
521
585
  /** A single authorization/intent statement. */
522
586
  interface IntentBlock {
523
- sessionID: string;
524
- messageID: string;
525
- actor: "user" | "assistant" | "system" | "unknown";
526
- text: string;
527
- synthetic: boolean;
528
- createdAt?: number;
529
- provenance: Provenanced<"intent">;
587
+ sessionID: string;
588
+ messageID: string;
589
+ actor: "user" | "assistant" | "system" | "unknown";
590
+ text: string;
591
+ synthetic: boolean;
592
+ createdAt?: number;
593
+ provenance: Provenanced<"intent">;
530
594
  }
531
595
  /** One user decision on an agent-initiated ask dialog (question tool). The
532
596
  * question text is agent-generated and untrusted; only the answer is a user
533
597
  * authorization signal, scoped to the subject and time of the ask. */
534
598
  interface AskDecision {
535
- /** Epoch ms when the reply (or dismissal) was observed. */
536
- at: number;
537
- /** What the agent asked, already redacted and truncated. */
538
- question: string;
539
- /** The option labels the user selected, or a dismissal marker. */
540
- answer: string;
599
+ /** Epoch ms when the reply (or dismissal) was observed. */
600
+ at: number;
601
+ /** What the agent asked, already redacted and truncated. */
602
+ question: string;
603
+ /** The option labels the user selected, or a dismissal marker. */
604
+ answer: string;
541
605
  }
542
606
  /** Direct user intent kept separate from delegated task. */
543
607
  interface IntentContext {
544
- directUserIntent: IntentBlock[];
545
- delegatedTask: IntentBlock[];
546
- localSessionIntent: IntentBlock[];
547
- conflictingInstructions: string[];
548
- latestExplicitAuthorization?: IntentBlock;
549
- completeness: "complete" | "partial" | "insufficient";
608
+ directUserIntent: IntentBlock[];
609
+ delegatedTask: IntentBlock[];
610
+ localSessionIntent: IntentBlock[];
611
+ conflictingInstructions: string[];
612
+ latestExplicitAuthorization?: IntentBlock;
613
+ completeness: "complete" | "partial" | "insufficient";
550
614
  }
551
615
  /** Meta-summary of what evidence was available. */
552
616
  interface EvidenceCompleteness {
553
- permission: boolean;
554
- actor: boolean;
555
- lineage: boolean;
556
- directUserIntent: boolean;
557
- delegatedTask: boolean;
558
- /** Whether a non-unavailable ACTION_PURPOSE was recovered. */
559
- purpose: boolean;
560
- capability: boolean;
561
- repositoryState: boolean;
562
- referencedCode: boolean;
563
- reasons: string[];
564
- overall: "sufficient" | "partial" | "insufficient";
617
+ permission: boolean;
618
+ actor: boolean;
619
+ lineage: boolean;
620
+ directUserIntent: boolean;
621
+ delegatedTask: boolean;
622
+ /** Whether a non-unavailable ACTION_PURPOSE was recovered. */
623
+ purpose: boolean;
624
+ capability: boolean;
625
+ repositoryState: boolean;
626
+ referencedCode: boolean;
627
+ reasons: string[];
628
+ overall: "sufficient" | "partial" | "insufficient";
565
629
  }
566
630
  /**
567
631
  * Operational purpose of the pending action — what the agent appears to be
@@ -569,171 +633,183 @@ interface EvidenceCompleteness {
569
633
  * user authorization by itself.
570
634
  */
571
635
  interface ActionPurpose {
572
- text?: string;
573
- source: "agent-context" | "intent-derived" | "unavailable";
574
- confidence: EvidenceConfidence;
636
+ text?: string;
637
+ source: "agent-context" | "intent-derived" | "unavailable";
638
+ confidence: EvidenceConfidence;
575
639
  }
576
-
640
+ //#endregion
641
+ //#region src/audit-record.d.ts
577
642
  /** Which layer produced the final decision for a request. Threaded into the
578
643
  * audit record so reports can split outcomes by source. */
579
644
  type DecisionSource = "emergency-brake" | "deterministic-policy" | "llm-reviewer" | "system-one-reviewer" | "manual-superseded" | "failure-safe";
580
645
  interface ReviewAuditRecord {
581
- /**
582
- * Audit schema version. Present on every record; readers default a missing
583
- * field to `1` (additive — old records are still valid).
584
- * Bump only on a breaking change to the record shape.
585
- */
586
- schemaVersion?: number;
587
- reviewID?: string;
588
- hostRequestID?: string;
589
- hostGeneration?: "v1" | "v2";
590
- hostVersion?: string;
591
- generation?: string;
592
- nativeAction?: string;
593
- directory?: string;
594
- application?: "evaluation-returned" | "reply-accepted" | "human-pending" | "superseded" | "cancelled" | "unknown";
595
- pluginVersion?: string;
596
- effectiveConfigHash?: string;
597
- actionFingerprint?: string;
598
- /** Version of the structured-decision schema the reviewer was asked to emit. */
599
- decisionSchemaVersion?: number;
600
- /** Version of the reviewer system prompt used for this decision. */
601
- promptVersion?: string;
602
- /** Which layer produced the outcome (brake, policy, reviewer, supersede,
603
- * failure-safe). Absent on legacy v1 records. */
604
- decisionSource?: DecisionSource;
605
- timestamp: string;
606
- durationMs: number;
607
- requestID: string;
608
- sessionID: string;
609
- permission: string;
610
- /** Stable hash of the canonical request (permission, patterns, metadata,
611
- * tool) for cross-record correlation. Absent on legacy v1 records. */
612
- actionHash?: string;
613
- outcome: ReviewExecutionResult["kind"];
614
- reason: string;
615
- riskLevel?: RiskLevel;
616
- userAuthorization?: UserAuthorization;
617
- /** How well the action aligned with the recovered intent (from the reviewer
618
- * decision). Absent when no reviewer decision was reached. */
619
- scopeAlignment?: ScopeAlignment;
620
- confidence?: number;
621
- /**
622
- * Structured outcome emitted by the reviewer LLM before gates/disposition.
623
- * Absent when no valid structured decision was produced (brake, policy,
624
- * failure-safe, supersede).
625
- */
626
- reviewerOutcome?: ReviewOutcome;
627
- /**
628
- * How an internal escalate was disposed. Present only when the logical result
629
- * was escalate (or a gate converted allow→escalate) and enforcement chose
630
- * manual or deny. Absent for explicit deny, allow, and manual-superseded.
631
- */
632
- escalationDisposition?: EscalationDisposition;
633
- /** The model that produced the final reviewer decision. */
634
- reviewerModel?: string;
635
- /** Present when a System One result was handed to a reasoning reviewer. */
636
- reviewerEscalatedFrom?: {
637
- model: string;
638
- reason: string;
639
- };
640
- /** Jev's scores whenever it returned a parsed decision, including when a
641
- * reasoning reviewer made the final call. */
642
- systemOne?: SystemOneScores;
643
- /** Per-phase timings. Absent on legacy v1 records and on deterministic paths
644
- * that never reach that phase. */
645
- timings?: {
646
- contextMs?: number;
647
- enrichmentMs?: number;
648
- reviewerMs?: number;
649
- replyMs?: number;
650
- };
651
- /** Non-fatal warnings accumulated during evidence collection/analysis. */
652
- warnings?: string[];
653
- reviewerSessionID?: string;
654
- /** Content identity and inspection mode only; never script text or local path. */
655
- verifiedScript?: {
656
- sha256: string;
657
- status: "full" | "reused" | "unavailable";
658
- bytes?: number;
659
- };
660
- /** Root session of the request's ancestry (additive; absent when lineage was
661
- * unavailable). */
662
- rootSessionID?: string;
663
- /** Overall evidence completeness for the request (additive). */
664
- evidenceCompleteness?: string;
665
- /** Resolved actor snapshot for audit (additive). Uses identityCompleteness
666
- * (not the decision's numeric confidence) to avoid field ambiguity; v2 also
667
- * carries identitySource + confidence. */
668
- actor?: {
669
- name?: string;
670
- mode?: string;
671
- profile: ActorProfile;
672
- identityCompleteness: "complete" | "partial" | "unknown";
673
- /** How the agent identity was established (tool-message, session-api,
674
- * unavailable, …). Absent on legacy v1 records. */
675
- identitySource?: string;
676
- /** Reliability of the identity claim. Absent on legacy v1 records. */
677
- confidence?: EvidenceConfidence;
678
- delegationDepth?: number;
679
- };
680
- ssh?: Array<{
681
- destination: string;
682
- port?: string;
683
- remoteCommandSha256?: string;
684
- stdinSource?: string;
685
- stdinStatus?: string;
686
- stdinReason?: string;
687
- }>;
688
- /** Additive capability snapshot for audit (observe-only). */
689
- capability?: {
690
- actionClass: string;
691
- summary: string;
692
- parserCompleteness: string;
693
- executesCode?: boolean;
694
- createsAdHocCode?: boolean;
695
- invokesPackageLifecycleScripts?: boolean;
696
- writeEffects?: {
697
- temporaryWrite?: boolean;
698
- workspaceWrite?: boolean;
699
- externalWrite?: boolean;
700
- deletion?: boolean;
701
- };
702
- networkObserved?: boolean;
703
- credentialRead?: boolean;
704
- privilegeEscalation?: boolean;
705
- persistence?: boolean;
706
- remoteEnabled?: boolean;
707
- gitMutation?: boolean;
708
- };
709
- /** Additive policy trace for audit (observe-only). */
710
- policyTrace?: {
711
- effectivePolicyHash: string;
712
- matchedRules: Array<{
713
- id: string;
714
- source: string;
715
- effect: string;
716
- reason: string;
717
- }>;
718
- finalRoute: string;
719
- mode: string;
646
+ /**
647
+ * Audit schema version. Present on every record; readers default a missing
648
+ * field to `1` (additive — old records are still valid).
649
+ * Bump only on a breaking change to the record shape.
650
+ */
651
+ schemaVersion?: number;
652
+ reviewID?: string;
653
+ hostRequestID?: string;
654
+ hostGeneration?: "v1" | "v2";
655
+ hostVersion?: string;
656
+ generation?: string;
657
+ nativeAction?: string;
658
+ directory?: string;
659
+ application?: "evaluation-returned" | "reply-accepted" | "human-pending" | "superseded" | "cancelled" | "unknown";
660
+ pluginVersion?: string;
661
+ effectiveConfigHash?: string;
662
+ actionFingerprint?: string;
663
+ /** Version of the structured-decision schema the reviewer was asked to emit. */
664
+ decisionSchemaVersion?: number;
665
+ /** Version of the reviewer system prompt used for this decision. */
666
+ promptVersion?: string;
667
+ /** Which layer produced the outcome (brake, policy, reviewer, supersede,
668
+ * failure-safe). Absent on legacy v1 records. */
669
+ decisionSource?: DecisionSource;
670
+ timestamp: string;
671
+ durationMs: number;
672
+ requestID: string;
673
+ sessionID: string;
674
+ permission: string;
675
+ /** Stable hash of the canonical request (permission, patterns, metadata,
676
+ * tool) for cross-record correlation. Absent on legacy v1 records. */
677
+ actionHash?: string;
678
+ outcome: ReviewExecutionResult["kind"];
679
+ reason: string;
680
+ riskLevel?: RiskLevel;
681
+ userAuthorization?: UserAuthorization;
682
+ /** How well the action aligned with the recovered intent (from the reviewer
683
+ * decision). Absent when no reviewer decision was reached. */
684
+ scopeAlignment?: ScopeAlignment;
685
+ confidence?: number;
686
+ /**
687
+ * Structured outcome emitted by the reviewer LLM before gates/disposition.
688
+ * Absent when no valid structured decision was produced (brake, policy,
689
+ * failure-safe, supersede).
690
+ */
691
+ reviewerOutcome?: ReviewOutcome;
692
+ /**
693
+ * How an internal escalate was disposed. Present only when the logical result
694
+ * was escalate (or a gate converted allow→escalate) and enforcement chose
695
+ * manual or deny. Absent for explicit deny, allow, and manual-superseded.
696
+ */
697
+ escalationDisposition?: EscalationDisposition;
698
+ /** The model that produced the final reviewer decision. */
699
+ reviewerModel?: string;
700
+ /** Present when a System One result was handed to a reasoning reviewer;
701
+ * `trigger` says why. */
702
+ reviewerEscalatedFrom?: EscalatedFrom;
703
+ /** How an escalation from the System One backend was reached. */
704
+ resolution?: ManualResolution;
705
+ /** Warnings on the resolved config (inert or invalid settings); present
706
+ * only when there are any. Not the evidence `warnings` below. */
707
+ configWarnings?: string[];
708
+ /** Jev's scores whenever it returned a parsed decision, including when a
709
+ * reasoning reviewer made the final call. */
710
+ systemOne?: SystemOneScores;
711
+ /** Per-phase timings. Absent on legacy v1 records and on deterministic paths
712
+ * that never reach that phase. */
713
+ timings?: {
714
+ contextMs?: number;
715
+ enrichmentMs?: number;
716
+ reviewerMs?: number;
717
+ replyMs?: number;
718
+ };
719
+ /** Non-fatal warnings accumulated during evidence collection/analysis. */
720
+ warnings?: string[];
721
+ reviewerSessionID?: string;
722
+ /** Content identity and inspection mode only; never script text or local path. */
723
+ verifiedScript?: {
724
+ sha256: string;
725
+ status: "full" | "reused" | "unavailable";
726
+ bytes?: number;
727
+ };
728
+ /** Root session of the request's ancestry (additive; absent when lineage was
729
+ * unavailable). */
730
+ rootSessionID?: string;
731
+ /** Overall evidence completeness for the request (additive). */
732
+ evidenceCompleteness?: string;
733
+ /** Resolved actor snapshot for audit (additive). Uses identityCompleteness
734
+ * (not the decision's numeric confidence) to avoid field ambiguity; v2 also
735
+ * carries identitySource + confidence. */
736
+ actor?: {
737
+ name?: string;
738
+ mode?: string;
739
+ profile: ActorProfile;
740
+ identityCompleteness: "complete" | "partial" | "unknown";
741
+ /** How the agent identity was established (tool-message, session-api,
742
+ * unavailable, …). Absent on legacy v1 records. */
743
+ identitySource?: string;
744
+ /** Reliability of the identity claim. Absent on legacy v1 records. */
745
+ confidence?: EvidenceConfidence;
746
+ delegationDepth?: number;
747
+ };
748
+ ssh?: Array<{
749
+ destination: string;
750
+ port?: string;
751
+ remoteCommandSha256?: string;
752
+ stdinSource?: string;
753
+ stdinStatus?: string;
754
+ stdinReason?: string;
755
+ }>;
756
+ /** Additive capability snapshot for audit (observe-only). */
757
+ capability?: {
758
+ actionClass: string;
759
+ summary: string;
760
+ parserCompleteness: string;
761
+ executesCode?: boolean;
762
+ createsAdHocCode?: boolean;
763
+ invokesPackageLifecycleScripts?: boolean;
764
+ writeEffects?: {
765
+ temporaryWrite?: boolean;
766
+ workspaceWrite?: boolean;
767
+ externalWrite?: boolean;
768
+ deletion?: boolean;
720
769
  };
721
- /** Additive snapshot of the ask decisions surfaced to the reviewer prompt
722
- * (observe-only; capped to the most recent few). */
723
- askDecisions?: Array<{
724
- at: number;
725
- question: string;
726
- answer: string;
770
+ networkObserved?: boolean;
771
+ credentialRead?: boolean;
772
+ privilegeEscalation?: boolean;
773
+ persistence?: boolean;
774
+ remoteEnabled?: boolean;
775
+ gitMutation?: boolean;
776
+ };
777
+ /** Additive policy trace for audit (observe-only). */
778
+ policyTrace?: {
779
+ effectivePolicyHash: string;
780
+ matchedRules: Array<{
781
+ id: string;
782
+ source: string;
783
+ effect: string;
784
+ reason: string;
727
785
  }>;
786
+ finalRoute: string;
787
+ mode: string;
788
+ };
789
+ /** Additive snapshot of the ask decisions surfaced to the reviewer prompt
790
+ * (observe-only; capped to the most recent few). */
791
+ askDecisions?: Array<{
792
+ at: number;
793
+ question: string;
794
+ answer: string;
795
+ }>;
728
796
  }
729
-
730
- declare const DEFAULT_AUDIT_PATH = "~/.local/share/opencode/permission-reviewer-audit.jsonl";
797
+ //#endregion
798
+ //#region src/audit.d.ts
799
+ export declare const DEFAULT_AUDIT_PATH = "~/.local/share/opencode/permission-reviewer-audit.jsonl";
731
800
  type AuditLogger = (message: string, details?: unknown) => void;
732
- declare function createAuditWriter(config: ReviewerConfig, logger?: AuditLogger): ((record: ReviewAuditRecord) => Promise<void>) | undefined;
733
-
801
+ export declare function createAuditWriter(config: ReviewerConfig, logger?: AuditLogger): ((record: ReviewAuditRecord) => Promise<void>) | undefined;
802
+ //#endregion
803
+ //#region src/config/sources.d.ts
734
804
  /** The host passing an options object does not attest who authored it. */
735
805
  type InlineOptionsTrust = "trusted" | "project" | "unknown";
736
-
806
+ //#endregion
807
+ //#region src/config/loader.d.ts
808
+ interface LoadOptions {
809
+ /** Off for a caller that shows `configWarnings` another way, such as the TUI
810
+ * from server statuses. */
811
+ printConfigWarnings?: boolean;
812
+ }
737
813
  /** Load and merge config from global, project, and inline sources.
738
814
  *
739
815
  * Precedence (lowest to highest): builtin defaults → global → project → inline,
@@ -744,47 +820,99 @@ type InlineOptionsTrust = "trusted" | "project" | "unknown";
744
820
  *
745
821
  * When no global or project files exist (the common case), the result is
746
822
  * byte-identical to calling `resolveConfig(inlineOptions)` directly. */
747
- declare function loadResolvedConfig(inlineOptions: Record<string, unknown> | undefined, directory?: string, inlineTrust?: InlineOptionsTrust): ReviewerConfig;
748
-
823
+ export declare function loadResolvedConfig(inlineOptions: Record<string, unknown> | undefined, directory?: string, inlineTrust?: InlineOptionsTrust, { printConfigWarnings }?: LoadOptions): ReviewerConfig;
824
+ //#endregion
825
+ //#region src/system-one/backend.d.ts
826
+ /** Jev's hand-off to the reasoning reviewer, on the second "reviewing" status
827
+ * and on the result of a handed-off review. */
828
+ interface HandoffInfo {
829
+ from: string;
830
+ to: string;
831
+ trigger: HandoffTrigger;
832
+ /** Jev's failure ("timeout"), only when `trigger` is `jev-failure`. */
833
+ failureKind?: string;
834
+ }
835
+ //#endregion
836
+ //#region src/ui-status-extras.d.ts
837
+ interface StatusExtrasOptions {
838
+ handoff?: HandoffInfo;
839
+ resolution?: ManualResolution;
840
+ decidedBy?: string;
841
+ configWarnings?: readonly string[];
842
+ configDegraded?: readonly string[];
843
+ }
844
+ //#endregion
845
+ //#region src/ui-protocol.d.ts
749
846
  type ReviewUiPhase = "reviewing" | "approved" | "denied" | "manual" | "unknown";
847
+ /** One command of a shell action as the server split it, for the TUI to fit
848
+ * to its width. Built by `src/ui-action-segments.ts`. */
849
+ interface ActionSegment {
850
+ /** The segment as typed in the command, heredoc bodies left out,
851
+ * whitespace collapsed, at most 200 code points. */
852
+ text: string;
853
+ /** The operator that ends this segment: "|", "||", "&&", ";", "&". */
854
+ separator?: string;
855
+ /** Total body lines of the segment's heredocs, whose bodies are not
856
+ * shown. */
857
+ heredocLines?: number;
858
+ }
750
859
  interface ReviewUiStatus {
751
- version: 1;
752
- requestID: string;
753
- sessionID: string;
754
- phase: ReviewUiPhase;
755
- permission: string;
756
- action: string;
757
- model: string;
758
- variant: string;
759
- emittedAt: number;
760
- timeoutMs: number;
761
- reason?: string;
762
- decision?: ReviewDecision;
763
- /**
764
- * When phase is `denied` and this is `"deny"`, the block came from fail-closed
765
- * escalation disposition rather than an explicit reviewer/policy deny.
766
- */
767
- escalationDisposition?: EscalationDisposition;
768
- /** Resolved actor (absent on the initial "reviewing" phase, before context
769
- * collection completes). */
770
- actorName?: string;
771
- actorProfile?: ActorProfile;
860
+ version: 1;
861
+ requestID: string;
862
+ sessionID: string;
863
+ phase: ReviewUiPhase;
864
+ permission: string;
865
+ action: string;
866
+ model: string;
867
+ variant: string;
868
+ emittedAt: number;
869
+ timeoutMs: number;
870
+ reason?: string;
871
+ decision?: ReviewDecision;
872
+ /**
873
+ * When phase is `denied` and this is `"deny"`, the block came from fail-closed
874
+ * escalation disposition rather than an explicit reviewer/policy deny.
875
+ */
876
+ escalationDisposition?: EscalationDisposition;
877
+ /** Resolved actor (absent on the initial "reviewing" phase, before context
878
+ * collection completes). */
879
+ actorName?: string;
880
+ actorProfile?: ActorProfile;
881
+ /** Jev's hand-off to the reasoning reviewer, on the second "reviewing"
882
+ * status and on the result of a handed-off review. */
883
+ handoff?: HandoffInfo;
884
+ /** How a manual outcome came about; chooses the manual-review toast. */
885
+ resolution?: ManualResolution;
886
+ /** The model that made the decision, on a final status a reviewer model
887
+ * decided; absent on a brake, policy or failure-safe result. */
888
+ decidedBy?: string;
889
+ /** The server's config warnings and degraded-config reasons. V1 carries them
890
+ * on every status; V2 reads them from the `status` RPC. */
891
+ configWarnings?: string[];
892
+ configDegraded?: string[];
893
+ /** The action split at its top-level shell operators. Absent when the
894
+ * server did not segment it or left the segments off to fit the status
895
+ * cap, and from a server that predates segments. */
896
+ actionSegments?: ActionSegment[];
772
897
  }
773
- declare function permissionAction(request: PermissionRequest): string;
774
- declare function createUiStatus(request: PermissionRequest, phase: ReviewUiPhase, options: {
775
- model: string;
776
- variant: string;
777
- timeoutMs: number;
778
- reason?: string;
779
- decision?: ReviewDecision;
780
- escalationDisposition?: EscalationDisposition;
781
- emittedAt?: number;
782
- actorName?: string;
783
- actorProfile?: ActorProfile;
784
- }): ReviewUiStatus;
785
- declare function encodeUiStatus(status: ReviewUiStatus): string;
786
- declare function decodeUiStatus(command: string): ReviewUiStatus | undefined;
787
-
898
+ export declare function permissionAction(request: PermissionRequest): string;
899
+ type UiStatusOptions = {
900
+ model: string;
901
+ variant: string;
902
+ timeoutMs: number;
903
+ reason?: string;
904
+ decision?: ReviewDecision;
905
+ escalationDisposition?: EscalationDisposition;
906
+ emittedAt?: number;
907
+ actorName?: string;
908
+ actorProfile?: ActorProfile;
909
+ actionSegments?: ActionSegment[];
910
+ } & StatusExtrasOptions;
911
+ export declare function createUiStatus(request: PermissionRequest, phase: ReviewUiPhase, options: UiStatusOptions): ReviewUiStatus;
912
+ export declare function encodeUiStatus(status: ReviewUiStatus): string;
913
+ export declare function decodeUiStatus(command: string): ReviewUiStatus | undefined;
914
+ //#endregion
915
+ //#region src/context/ask-decisions.d.ts
788
916
  /**
789
917
  * Captures user answers to agent ask dialogs (the `question` tool) from the
790
918
  * OpenCode event stream and exposes them as compact, session-scoped
@@ -811,61 +939,66 @@ declare function decodeUiStatus(command: string): ReviewUiStatus | undefined;
811
939
  * as a custom answer must never land in the registry, prompt, or audit.
812
940
  */
813
941
  /** Marker recorded when the user dismisses an ask without answering. */
814
- declare const DISMISSED_ANSWER = "Dismissed by user";
942
+ export declare const DISMISSED_ANSWER = "Dismissed by user";
815
943
  type Logger$1 = (message: string, details?: unknown) => void;
816
944
  /** What the evidence assembler consumes: a bounded, lineage-scoped query. */
817
945
  interface AskDecisionSource {
818
- recentFor(sessionIDs: string[], limit?: number): AskDecision[];
946
+ recentFor(sessionIDs: string[], limit?: number): AskDecision[];
819
947
  }
820
- declare class AskDecisionRegistry implements AskDecisionSource {
821
- private readonly pending;
822
- private readonly resolved;
823
- private readonly log;
824
- private readonly now;
825
- constructor(logger?: Logger$1, now?: () => number);
826
- /**
827
- * Observe one raw event. Total: never throws; anything malformed or
828
- * unrelated is dropped silently. Must be called synchronously from the event
829
- * hook so registry mutations are visible to reviews started later.
830
- */
831
- observe(event: unknown): void;
832
- /**
833
- * Decisions visible to a review running in `sessionIDs` (the requesting
834
- * session plus its resolved ancestors), oldest first, bounded to the most
835
- * recent `limit`. Sibling and unrelated sessions are never visible.
836
- */
837
- recentFor(sessionIDs: string[], limit?: number): AskDecision[];
838
- /** Observed-but-unresolved asks (diagnostics only). */
839
- pendingCount(): number;
840
- /** Resolved decisions retained (diagnostics only). */
841
- resolvedCount(): number;
842
- private onAsked;
843
- private onReplied;
844
- private onRejected;
845
- private store;
948
+ export declare class AskDecisionRegistry implements AskDecisionSource {
949
+ private readonly pending;
950
+ private readonly resolved;
951
+ private readonly log;
952
+ private readonly now;
953
+ constructor(logger?: Logger$1, now?: () => number);
954
+ /**
955
+ * Observe one raw event. Total: never throws; anything malformed or
956
+ * unrelated is dropped silently. Must be called synchronously from the event
957
+ * hook so registry mutations are visible to reviews started later.
958
+ */
959
+ observe(event: unknown): void;
960
+ /**
961
+ * Decisions visible to a review running in `sessionIDs` (the requesting
962
+ * session plus its resolved ancestors), oldest first, bounded to the most
963
+ * recent `limit`. Sibling and unrelated sessions are never visible.
964
+ */
965
+ recentFor(sessionIDs: string[], limit?: number): AskDecision[];
966
+ /** Observed-but-unresolved asks (diagnostics only). */
967
+ pendingCount(): number;
968
+ /** Resolved decisions retained (diagnostics only). */
969
+ resolvedCount(): number;
970
+ private onAsked;
971
+ private onReplied;
972
+ private onRejected;
973
+ private store;
846
974
  }
847
-
848
- type Context = Parameters<Plugin.Plugin["setup"]>[0];
849
-
975
+ //#endregion
976
+ //#region src/opencode/v2/server-state.d.ts
977
+ type Context = Parameters<Plugin$1.Plugin["setup"]>[0];
978
+ //#endregion
979
+ //#region src/opencode/v2/server.d.ts
850
980
  declare function setup(ctx: Context): Promise<() => Promise<void>>;
851
-
852
- declare function resolveConfig(options: Record<string, unknown> | undefined): ReviewerConfig;
853
-
981
+ //#endregion
982
+ //#region src/config.d.ts
983
+ export declare function resolveConfig(options: Record<string, unknown> | undefined): ReviewerConfig;
984
+ //#endregion
985
+ //#region src/ssh-evidence.d.ts
854
986
  interface SshAuditSummary {
855
- destination: string;
856
- port?: string;
857
- remoteCommandSha256?: string;
858
- stdinSource?: string;
859
- stdinStatus?: string;
860
- stdinReason?: string;
987
+ destination: string;
988
+ port?: string;
989
+ remoteCommandSha256?: string;
990
+ stdinSource?: string;
991
+ stdinStatus?: string;
992
+ stdinReason?: string;
861
993
  }
862
994
  interface SshEnrichmentResult {
863
- text: string;
864
- audit: SshAuditSummary[];
865
- preflightDenial?: string;
995
+ text: string;
996
+ audit: SshAuditSummary[];
997
+ preflightDenial?: string;
866
998
  }
867
- declare function enrichSshEvidence(request: PermissionRequest, directory: string, worktree: string, maxChars: number): Promise<SshEnrichmentResult>;
868
-
999
+ export declare function enrichSshEvidence(request: PermissionRequest, directory: string, worktree: string, maxChars: number): Promise<SshEnrichmentResult>;
1000
+ //#endregion
1001
+ //#region src/evidence/provider.d.ts
869
1002
  /**
870
1003
  * A single piece of evidence gathered about a permission request. The runtime
871
1004
  * only consumes `text`, `audit`, and `preflightDenial` today; the remaining
@@ -873,20 +1006,20 @@ declare function enrichSshEvidence(request: PermissionRequest, directory: string
873
1006
  * changing the interface.
874
1007
  */
875
1008
  interface EvidenceFragment {
876
- kind: "ssh" | "local_script" | "git";
877
- text: string;
878
- audit?: SshAuditSummary[];
879
- preflightDenial?: string;
880
- warnings?: string[];
881
- durationMs?: number;
1009
+ kind: "ssh" | "local_script" | "git";
1010
+ text: string;
1011
+ audit?: SshAuditSummary[];
1012
+ preflightDenial?: string;
1013
+ warnings?: string[];
1014
+ durationMs?: number;
882
1015
  }
883
1016
  interface EvidenceScope {
884
- directory: string;
885
- worktree: string;
886
- maxChars: number;
1017
+ directory: string;
1018
+ worktree: string;
1019
+ maxChars: number;
887
1020
  }
888
1021
  interface EvidenceProviderInput extends EvidenceScope {
889
- request: PermissionRequest;
1022
+ request: PermissionRequest;
890
1023
  }
891
1024
  /**
892
1025
  * Enriches a permission request with one category of evidence (SSH analysis,
@@ -894,78 +1027,82 @@ interface EvidenceProviderInput extends EvidenceScope {
894
1027
  * fragments are assembled into a single review envelope.
895
1028
  */
896
1029
  interface EvidenceProvider {
897
- readonly id: string;
898
- collect(input: EvidenceProviderInput): Promise<EvidenceFragment>;
1030
+ readonly id: string;
1031
+ collect(input: EvidenceProviderInput): Promise<EvidenceFragment>;
899
1032
  }
900
-
1033
+ //#endregion
1034
+ //#region src/opencode/adapter.d.ts
901
1035
  /** What the plugin learned about the host client at startup. */
902
1036
  interface OpenCodeCapabilities {
903
- /** A public SDK method to answer a permission request exists. */
904
- publicPermissionReply: boolean;
905
- /** That public method can carry a free-text feedback `message`. */
906
- permissionReplyMessage: boolean;
907
- /** The authenticated raw `_client.post` transport is reachable. */
908
- rawAuthenticatedTransport: boolean;
909
- /** `client.session.get` is available (lineage walking depends on it). */
910
- sessionGet: boolean;
911
- /** Session records expose a `parentID` (lineage traversal). */
912
- sessionParentID: boolean;
913
- /** Assistant messages carry an `agent` field (actor identity). */
914
- assistantAgentMetadata: boolean;
915
- /** Assistant messages carry a `mode` field (actor identity). */
916
- assistantModeMetadata: boolean;
917
- /** Effective permission rules can be resolved per session. */
918
- effectivePermissions: boolean;
919
- /** `client.tui.publish` is available for status broadcasting. */
920
- tuiPublish: boolean;
1037
+ /** A public SDK method to answer a permission request exists. */
1038
+ publicPermissionReply: boolean;
1039
+ /** That public method can carry a free-text feedback `message`. */
1040
+ permissionReplyMessage: boolean;
1041
+ /** The authenticated raw `_client.post` transport is reachable. */
1042
+ rawAuthenticatedTransport: boolean;
1043
+ /** `client.session.get` is available (lineage walking depends on it). */
1044
+ sessionGet: boolean;
1045
+ /** Session records expose a `parentID` (lineage traversal). */
1046
+ sessionParentID: boolean;
1047
+ /** Assistant messages carry an `agent` field (actor identity). */
1048
+ assistantAgentMetadata: boolean;
1049
+ /** Assistant messages carry a `mode` field (actor identity). */
1050
+ assistantModeMetadata: boolean;
1051
+ /** Effective permission rules can be resolved per session. */
1052
+ effectivePermissions: boolean;
1053
+ /** `client.tui.publish` is available for status broadcasting. */
1054
+ tuiPublish: boolean;
921
1055
  }
922
-
1056
+ //#endregion
1057
+ //#region src/opencode/types.d.ts
923
1058
  interface ClientResponse<T> {
924
- data?: T;
925
- error?: unknown;
1059
+ data?: T;
1060
+ error?: unknown;
926
1061
  }
927
1062
  interface OpenCodeClientLike {
928
- session: {
929
- create(options: unknown): Promise<ClientResponse<Record<string, unknown>>>;
930
- messages(options: unknown): Promise<ClientResponse<unknown>>;
931
- prompt(options: unknown): Promise<ClientResponse<Record<string, unknown>>>;
932
- delete?(options: unknown): Promise<ClientResponse<unknown>>;
933
- abort?(options: unknown): Promise<ClientResponse<unknown>>;
934
- /** Fetch session metadata (parentID, title, …). Optional: the actor resolver
935
- * degrades to "lineage unavailable" when the host client does not expose it. */
936
- get?(options: unknown): Promise<ClientResponse<unknown>>;
937
- };
938
- tool: {
939
- ids(options?: unknown): Promise<ClientResponse<string[]>>;
940
- };
941
- /** Host MCP inventory, keyed by server name. The V1 host exposes
942
- * `mcp.status({ query: { directory } })` and returns `{}` for a location
943
- * whose config excludes MCP. Optional so narrow clients still typecheck;
944
- * the reviewer guard fails closed when it is absent. */
945
- mcp?: {
946
- status(options?: unknown): Promise<ClientResponse<Record<string, unknown>>>;
947
- };
1063
+ session: {
1064
+ create(options: unknown): Promise<ClientResponse<Record<string, unknown>>>;
1065
+ messages(options: unknown): Promise<ClientResponse<unknown>>;
1066
+ prompt(options: unknown): Promise<ClientResponse<Record<string, unknown>>>;
1067
+ delete?(options: unknown): Promise<ClientResponse<unknown>>;
1068
+ abort?(options: unknown): Promise<ClientResponse<unknown>>;
1069
+ /** Fetch session metadata (parentID, title, …). Optional: the actor resolver
1070
+ * degrades to "lineage unavailable" when the host client does not expose it. */
1071
+ get?(options: unknown): Promise<ClientResponse<unknown>>;
1072
+ };
1073
+ tool: {
1074
+ ids(options?: unknown): Promise<ClientResponse<string[]>>;
1075
+ };
1076
+ /** Host MCP inventory, keyed by server name. The V1 host exposes
1077
+ * `mcp.status({ query: { directory } })` and returns `{}` for a location
1078
+ * whose config excludes MCP. Optional so narrow clients still typecheck;
1079
+ * the reviewer guard fails closed when it is absent. */
1080
+ mcp?: {
1081
+ status(options?: unknown): Promise<ClientResponse<Record<string, unknown>>>;
1082
+ };
948
1083
  }
949
1084
  interface RuntimeContext {
950
- hostVersion?: string;
951
- client: OpenCodeClientLike;
952
- /** What the plugin learned about the host client at startup (probe result).
953
- * Surfaced to diagnostics and available to any future adapter consumer. */
954
- capabilities: OpenCodeCapabilities;
955
- permissionReply(options: unknown): Promise<ClientResponse<unknown>>;
956
- publishUiStatus?(status: ReviewUiStatus): Promise<ClientResponse<unknown>>;
957
- writeAudit?(record: ReviewAuditRecord): Promise<void>;
958
- directory: string;
959
- worktree: string;
960
- /** Where reviewer sessions run when isolation is available: a directory
961
- * without project instructions or project config. Production resolves the
962
- * shared data directory; tests inject a scratch path so they never touch
963
- * the developer's HOME. */
964
- reviewerDirectoryBase?: string;
1085
+ hostVersion?: string;
1086
+ client: OpenCodeClientLike;
1087
+ /** What the plugin learned about the host client at startup (probe result).
1088
+ * Surfaced to diagnostics and available to any future adapter consumer. */
1089
+ capabilities: OpenCodeCapabilities;
1090
+ permissionReply(options: unknown): Promise<ClientResponse<unknown>>;
1091
+ publishUiStatus?(status: ReviewUiStatus): Promise<ClientResponse<unknown>>;
1092
+ writeAudit?(record: ReviewAuditRecord): Promise<void>;
1093
+ directory: string;
1094
+ worktree: string;
1095
+ /** Where reviewer sessions run when isolation is available: a directory
1096
+ * without project instructions or project config. Production resolves the
1097
+ * shared data directory; tests inject a scratch path so they never touch
1098
+ * the developer's HOME. */
1099
+ reviewerDirectoryBase?: string;
965
1100
  }
966
-
1101
+ //#endregion
1102
+ //#region src/core/coordinator-state.d.ts
967
1103
  type Logger = (message: string, details?: unknown) => void;
968
-
1104
+ //#endregion
1105
+ //#region src/core/review-coordinator.d.ts
969
1106
  /**
970
1107
  * Owns the review lifecycle for permission requests: orchestration, the
971
1108
  * supersede state machine, and the model call. The adapter (transport) and the
@@ -973,87 +1110,92 @@ type Logger = (message: string, details?: unknown) => void;
973
1110
  * races.
974
1111
  */
975
1112
  declare class ReviewCoordinator {
976
- private readonly state;
977
- private readonly limiter;
978
- private readonly pending;
979
- constructor(ctx: RuntimeContext, config: ReviewerConfig, logger?: Logger, providers?: EvidenceProvider[], askDecisions?: AskDecisionSource);
980
- pendingCount(): number;
981
- waitForIdle(): Promise<void>;
982
- dispose(): Promise<void>;
983
- handle(request: PermissionRequest): void;
984
- process(request: PermissionRequest): Promise<ReviewExecutionResult>;
985
- handlePermissionReply(event: unknown): void;
986
- /**
987
- * @deprecated No-op. Approvals no longer annotate tool results so they do not
988
- * contaminate the primary agent context. Kept for public API compatibility;
989
- * the plugin no longer registers a host hook that calls this. Rationale
990
- * remains in audit, TUI, and debug.
991
- */
992
- annotateToolResult(callID: string, output: {
993
- output?: unknown;
994
- metadata?: unknown;
995
- }): void;
1113
+ private readonly state;
1114
+ private readonly limiter;
1115
+ private readonly pending;
1116
+ constructor(ctx: RuntimeContext, config: ReviewerConfig, logger?: Logger, providers?: EvidenceProvider[], askDecisions?: AskDecisionSource);
1117
+ pendingCount(): number;
1118
+ waitForIdle(): Promise<void>;
1119
+ dispose(): Promise<void>;
1120
+ handle(request: PermissionRequest): void;
1121
+ process(request: PermissionRequest): Promise<ReviewExecutionResult>;
1122
+ handlePermissionReply(event: unknown): void;
1123
+ /**
1124
+ * @deprecated No-op. Approvals no longer annotate tool results so they do not
1125
+ * contaminate the primary agent context. Kept for public API compatibility;
1126
+ * the plugin no longer registers a host hook that calls this. Rationale
1127
+ * remains in audit, TUI, and debug.
1128
+ */
1129
+ annotateToolResult(callID: string, output: {
1130
+ output?: unknown;
1131
+ metadata?: unknown;
1132
+ }): void;
996
1133
  }
997
-
998
- declare function parseDecision(value: unknown): ReviewDecision | undefined;
999
-
1000
- declare function enforceDecision(decision: ReviewDecision, config: ReviewerConfig): ReviewExecutionResult;
1001
-
1002
- declare const DECISION_SCHEMA: {
1003
- readonly type: "object";
1004
- readonly additionalProperties: false;
1005
- readonly required: readonly ["version", "outcome", "risk_level", "user_authorization", "scope_alignment", "evidence_completeness", "rationale", "confidence"];
1006
- readonly properties: {
1007
- readonly version: {
1008
- readonly type: "number";
1009
- readonly enum: readonly [2];
1010
- readonly description: "Structured-decision schema version. Must be exactly 2.";
1011
- };
1012
- readonly outcome: {
1013
- readonly type: "string";
1014
- readonly enum: readonly ["allow", "deny", "escalate"];
1015
- readonly description: "allow executes once, deny rejects, escalate leaves the request for a human";
1016
- };
1017
- readonly risk_level: {
1018
- readonly type: "string";
1019
- readonly enum: readonly ["low", "medium", "high", "critical"];
1020
- };
1021
- readonly user_authorization: {
1022
- readonly type: "string";
1023
- readonly enum: readonly ["high", "medium", "low", "unknown"];
1024
- };
1025
- readonly rationale: {
1026
- readonly type: "string";
1027
- readonly minLength: 3;
1028
- readonly maxLength: 2000;
1029
- readonly description: "One concise sentence explaining the main reason for the decision";
1030
- };
1031
- readonly confidence: {
1032
- readonly type: "number";
1033
- readonly minimum: 0;
1034
- readonly maximum: 1;
1035
- };
1036
- readonly scope_alignment: {
1037
- readonly type: "string";
1038
- readonly enum: readonly ["aligned", "partial", "misaligned", "unknown"];
1039
- readonly description: "How well the request aligns with the recovered user or delegated intent: aligned (within scope), partial (tangential), misaligned (outside scope), unknown (insufficient context).";
1040
- };
1041
- readonly evidence_completeness: {
1042
- readonly type: "string";
1043
- readonly enum: readonly ["sufficient", "partial", "insufficient", "unknown"];
1044
- readonly description: "Whether the evidence was sufficient to decide: sufficient, partial (some gaps), insufficient (major gaps), unknown.";
1045
- };
1046
- readonly script_analysis: {
1047
- readonly type: "string";
1048
- readonly minLength: 20;
1049
- readonly maxLength: 1500;
1050
- readonly description: "Optional factual analysis of a fully supplied verified script. Describe effects and uncertainty, never user authorization or an approval.";
1051
- };
1134
+ //#endregion
1135
+ //#region src/decision.d.ts
1136
+ export declare function parseDecision(value: unknown): ReviewDecision | undefined;
1137
+ //#endregion
1138
+ //#region src/decision-gates.d.ts
1139
+ export declare function enforceDecision(decision: ReviewDecision, config: ReviewerConfig): ReviewExecutionResult;
1140
+ //#endregion
1141
+ //#region src/decision-schema.d.ts
1142
+ export declare const DECISION_SCHEMA: {
1143
+ readonly type: "object";
1144
+ readonly additionalProperties: false;
1145
+ readonly required: readonly ["version", "outcome", "risk_level", "user_authorization", "scope_alignment", "evidence_completeness", "rationale", "confidence"];
1146
+ readonly properties: {
1147
+ readonly version: {
1148
+ readonly type: "number";
1149
+ readonly enum: readonly [2];
1150
+ readonly description: "Structured-decision schema version. Must be exactly 2.";
1151
+ };
1152
+ readonly outcome: {
1153
+ readonly type: "string";
1154
+ readonly enum: readonly ["allow", "deny", "escalate"];
1155
+ readonly description: "allow executes once, deny rejects, escalate leaves the request for a human";
1156
+ };
1157
+ readonly risk_level: {
1158
+ readonly type: "string";
1159
+ readonly enum: readonly ["low", "medium", "high", "critical"];
1160
+ };
1161
+ readonly user_authorization: {
1162
+ readonly type: "string";
1163
+ readonly enum: readonly ["high", "medium", "low", "unknown"];
1052
1164
  };
1165
+ readonly rationale: {
1166
+ readonly type: "string";
1167
+ readonly minLength: 3;
1168
+ readonly maxLength: 2000;
1169
+ readonly description: "One concise sentence explaining the main reason for the decision";
1170
+ };
1171
+ readonly confidence: {
1172
+ readonly type: "number";
1173
+ readonly minimum: 0;
1174
+ readonly maximum: 1;
1175
+ };
1176
+ readonly scope_alignment: {
1177
+ readonly type: "string";
1178
+ readonly enum: readonly ["aligned", "partial", "misaligned", "unknown"];
1179
+ readonly description: "How well the request aligns with the recovered user or delegated intent: aligned (within scope), partial (tangential), misaligned (outside scope), unknown (insufficient context).";
1180
+ };
1181
+ readonly evidence_completeness: {
1182
+ readonly type: "string";
1183
+ readonly enum: readonly ["sufficient", "partial", "insufficient", "unknown"];
1184
+ readonly description: "Whether the evidence was sufficient to decide: sufficient, partial (some gaps), insufficient (major gaps), unknown.";
1185
+ };
1186
+ readonly script_analysis: {
1187
+ readonly type: "string";
1188
+ readonly minLength: 20;
1189
+ readonly maxLength: 1500;
1190
+ readonly description: "Optional factual analysis of a fully supplied verified script. Describe effects and uncertainty, never user authorization or an approval.";
1191
+ };
1192
+ };
1053
1193
  };
1054
-
1055
- declare function emergencyBrakeReason(request: PermissionRequest): string | undefined;
1056
-
1194
+ //#endregion
1195
+ //#region src/emergency-brake.d.ts
1196
+ export declare function emergencyBrakeReason(request: PermissionRequest): string | undefined;
1197
+ //#endregion
1198
+ //#region src/escalation.d.ts
1057
1199
  /**
1058
1200
  * Categories that can be hardened independently of the global escalation mode
1059
1201
  * via `riskPolicy.onInvalidDecision` / `riskPolicy.onReviewerFailure`.
@@ -1071,7 +1213,7 @@ type EscalationCategory = "general" | "invalid-decision" | "reviewer-failure";
1071
1213
  *
1072
1214
  * `manual-superseded` is never converted: the request is already closed.
1073
1215
  */
1074
- declare function resolveEscalationDisposition(result: ReviewExecutionResult, config: ReviewerConfig, category?: EscalationCategory): EscalationDisposition;
1216
+ export declare function resolveEscalationDisposition(result: ReviewExecutionResult, config: ReviewerConfig, category?: EscalationCategory): EscalationDisposition;
1075
1217
  /**
1076
1218
  * Single enforcement boundary: convert an internal escalate into the effective
1077
1219
  * disposition used for UI, reply, and audit. Allow/deny and manual-superseded
@@ -1084,20 +1226,23 @@ declare function resolveEscalationDisposition(result: ReviewExecutionResult, con
1084
1226
  * structured decision. `reviewerOutcome` is only set when a structured
1085
1227
  * decision actually existed.
1086
1228
  */
1087
- declare function applyEscalationDisposition(result: ReviewExecutionResult, config: ReviewerConfig, category?: EscalationCategory): ReviewExecutionResult;
1088
-
1229
+ export declare function applyEscalationDisposition(result: ReviewExecutionResult, config: ReviewerConfig, category?: EscalationCategory): ReviewExecutionResult;
1230
+ //#endregion
1231
+ //#region src/git-evidence.d.ts
1089
1232
  interface GitEnrichmentResult {
1090
- text: string;
1233
+ text: string;
1091
1234
  }
1092
- declare function enrichGitEvidence(request: PermissionRequest, directory: string, maxChars: number, worktree?: string): Promise<GitEnrichmentResult>;
1093
-
1235
+ export declare function enrichGitEvidence(request: PermissionRequest, directory: string, maxChars: number, worktree?: string): Promise<GitEnrichmentResult>;
1236
+ //#endregion
1237
+ //#region src/local-script-evidence.d.ts
1094
1238
  interface LocalScriptEnrichmentResult {
1095
- text: string;
1239
+ text: string;
1096
1240
  }
1097
1241
  /** `rootDirectory` is the approved evidence root, which can sit above
1098
1242
  * `directory` (package-script expansion passes the session directory). */
1099
- declare function enrichLocalScriptEvidence(request: PermissionRequest, directory: string, worktree: string, maxChars: number, rootDirectory?: string): Promise<LocalScriptEnrichmentResult>;
1100
-
1243
+ export declare function enrichLocalScriptEvidence(request: PermissionRequest, directory: string, worktree: string, maxChars: number, rootDirectory?: string): Promise<LocalScriptEnrichmentResult>;
1244
+ //#endregion
1245
+ //#region src/opencode/event-normalizer.d.ts
1101
1246
  /**
1102
1247
  * Normalize a raw OpenCode event into a {@link PermissionRequest}.
1103
1248
  *
@@ -1105,36 +1250,39 @@ declare function enrichLocalScriptEvidence(request: PermissionRequest, directory
1105
1250
  * `permission.asked` event, so callers can ignore irrelevant events without
1106
1251
  * inspecting their shape.
1107
1252
  */
1108
- declare function extractPermissionRequest(event: unknown): PermissionRequest | undefined;
1109
-
1110
- declare function redactSecrets(input: string): string;
1111
-
1253
+ export declare function extractPermissionRequest(event: unknown): PermissionRequest | undefined;
1254
+ //#endregion
1255
+ //#region src/redact.d.ts
1256
+ export declare function redactSecrets(input: string): string;
1257
+ //#endregion
1258
+ //#region src/ui-state.d.ts
1112
1259
  interface UiStateOptions {
1113
- model: string;
1114
- variant: string;
1115
- timeoutMs: number;
1260
+ model: string;
1261
+ variant: string;
1262
+ timeoutMs: number;
1116
1263
  }
1117
- declare class ReviewUiState {
1118
- private readonly options;
1119
- private readonly requests;
1120
- private readonly acknowledged;
1121
- constructor(options: UiStateOptions);
1122
- asked(request: PermissionRequest, now?: number): ReviewUiStatus;
1123
- apply(status: ReviewUiStatus): boolean;
1124
- replied(requestID: string): void;
1125
- remove(requestID: string): void;
1126
- get(requestID: string): ReviewUiStatus | undefined;
1127
- all(): ReviewUiStatus[];
1128
- activeFor(sessionID: string, parentOf: (sessionID: string) => string | undefined): ReviewUiStatus | undefined;
1129
- expire(now?: number): ReviewUiStatus[];
1130
- dismissResults(now?: number): string[];
1264
+ export declare class ReviewUiState {
1265
+ private readonly options;
1266
+ private readonly requests;
1267
+ private readonly acknowledged;
1268
+ constructor(options: UiStateOptions);
1269
+ asked(request: PermissionRequest, now?: number): ReviewUiStatus;
1270
+ apply(status: ReviewUiStatus): boolean;
1271
+ replied(requestID: string): void;
1272
+ remove(requestID: string): void;
1273
+ get(requestID: string): ReviewUiStatus | undefined;
1274
+ all(): ReviewUiStatus[];
1275
+ activeFor(sessionID: string, parentOf: (sessionID: string) => string | undefined): ReviewUiStatus | undefined;
1276
+ expire(now?: number): ReviewUiStatus[];
1277
+ dismissResults(now?: number): string[];
1131
1278
  }
1132
-
1133
- declare const server: Plugin$1;
1134
- declare const module$1: {
1135
- id: string;
1136
- server: Plugin$1;
1137
- setup: typeof setup;
1279
+ //#endregion
1280
+ //#region src/index.d.ts
1281
+ export declare const server: Plugin;
1282
+ declare const module: {
1283
+ id: string;
1284
+ server: Plugin;
1285
+ setup: typeof setup;
1138
1286
  };
1139
-
1140
- export { type ActionPurpose, type ActorContext, type ActorProfile, ReviewCoordinator as ApprovalReviewerRuntime, type ApprovedAnnotation, type AskDecision, AskDecisionRegistry, type CapabilityActionClass, type CapabilityAssessment, DECISION_SCHEMA, DEFAULT_AUDIT_PATH, DISMISSED_ANSWER, type DecisionSource, type EffectivePermissionSummary, type EscalationDisposition, type EscalationMode, type EscalationReviewerConfig, type EvidenceCompleteness, type EvidenceConfidence, type EvidenceSufficiency, type HeredocRecord, type IntentBlock, type IntentContext, type MessageWithParts, type ParsedCommand, type ParserCompleteness, type PermissionRequest, type PermissionToolSource, type PolicyCondition, type PolicyRule, type PolicyTrace, type Provenanced, type Redirection, type RepositoryTrust, type ReviewAuditRecord, type ReviewDecision, type ReviewEnvelope, type ReviewExecutionResult, type ReviewOutcome, ReviewUiState, type ReviewerConfig, type ReviewerOutputFormat, type RiskLevel, type RiskPolicy, SYSTEM_ONE_BASES, type ScopeAlignment, type SessionLineage, type SessionNode, type SystemOneChoiceScore, type SystemOnePrimaryBasis, type SystemOneScores, type SystemOneSignals, type UserAuthorization, applyEscalationDisposition, createAuditWriter, createUiStatus, decodeUiStatus, module$1 as default, emergencyBrakeReason, encodeUiStatus, enforceDecision, enrichGitEvidence, enrichLocalScriptEvidence, enrichSshEvidence, extractPermissionRequest, loadResolvedConfig, parseDecision, permissionAction, redactSecrets, resolveConfig, resolveEscalationDisposition, server };
1287
+ //#endregion
1288
+ export { type ActionPurpose, type ActorContext, type ActorProfile, ReviewCoordinator as ApprovalReviewerRuntime, type ApprovedAnnotation, type AskDecision, type CapabilityActionClass, type CapabilityAssessment, type DecisionSource, type EffectivePermissionSummary, type EscalatedFrom, type EscalationDisposition, type EscalationMode, type EscalationReviewerConfig, type EvidenceCompleteness, type EvidenceConfidence, type EvidenceSufficiency, type HandoffTrigger, type HeredocRecord, type IntentBlock, type IntentContext, type ManualResolution, type MessageWithParts, type ParsedCommand, type ParserCompleteness, type PermissionRequest, type PermissionToolSource, type PolicyCondition, type PolicyRule, type PolicyTrace, type Provenanced, type Redirection, type RepositoryTrust, type ReviewAuditRecord, type ReviewDecision, type ReviewEnvelope, type ReviewExecutionResult, type ReviewOutcome, type ReviewerConfig, type ReviewerOutputFormat, type RiskLevel, type RiskPolicy, type SYSTEM_ONE_BASES, type ScopeAlignment, type SessionLineage, type SessionNode, type SystemOneChoiceScore, type SystemOneEscalationMode, type SystemOnePrimaryBasis, type SystemOneScores, type SystemOneSignals, type UserAuthorization, module as default };