@noppu-labs/opencode-permission-reviewer 2.4.1 → 2.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/README.md +40 -3
- package/dist/index.d.ts +47 -1
- package/dist/index.js +79 -23
- package/dist/tui/types.ts +60 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.4.2] - 2026-10-09
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Record Jev's own scores in an additive `systemOne` audit field whenever it
|
|
15
|
+
returns a valid decision, on V1 and V2 hosts, including after a hand-off to
|
|
16
|
+
the reasoning reviewer, which previously kept only the System One model and
|
|
17
|
+
reason. The README's audit section lists the fields and when the field is
|
|
18
|
+
absent. Outcomes and routing are unchanged. Audit `schemaVersion` stays 3.
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Update the `@opencode/client` dependency to 2.0.26, from upstream.
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- Audit records credit the reasoning reviewer, not Jev, when a configuration
|
|
27
|
+
or evidence gate downgrades its allow, and when it fails after a hand-off
|
|
28
|
+
(the failure reason now names the reasoning reviewer).
|
|
29
|
+
|
|
10
30
|
## [2.4.1] - 2026-10-09
|
|
11
31
|
|
|
12
32
|
### Changed
|
package/README.md
CHANGED
|
@@ -433,6 +433,35 @@ deny from fail-closed escalate→deny), optional System One escalation origin,
|
|
|
433
433
|
and a bounded SSH summary. Remote commands
|
|
434
434
|
are stored as **SHA-256**, never in clear text. Set `audit: false` to disable.
|
|
435
435
|
|
|
436
|
+
When Jev (System One) returns a valid decision, the record also carries
|
|
437
|
+
`systemOne` with Jev's own scores, even when a reasoning reviewer made the
|
|
438
|
+
final call and the top-level `confidence` and `riskLevel` are that reviewer's.
|
|
439
|
+
It holds the model ID the provider reported, the outcome with its
|
|
440
|
+
probabilities, the choice and confidence of each supporting classification,
|
|
441
|
+
the nine 0–1 safety signals, the consistency checks that failed, and whether
|
|
442
|
+
reasoning was recommended. The model ID is capped at 128 characters and
|
|
443
|
+
redacted like other free text; everything else is numbers and fixed labels,
|
|
444
|
+
never evidence or command text. The field is absent when Jev never ran (a
|
|
445
|
+
deterministic route), when its answer was invalid or its call failed, and on
|
|
446
|
+
V1 hosts when a manual answer superseded the automatic review.
|
|
447
|
+
|
|
448
|
+
```json
|
|
449
|
+
"systemOne": {
|
|
450
|
+
"returnedModel": "jev-1.13.0",
|
|
451
|
+
"outcome": { "choice": "allow", "confidence": 0.55, "probabilities": { "allow": 0.55, "deny": 0.05, "escalate": 0.4 } },
|
|
452
|
+
"supporting": {
|
|
453
|
+
"riskLevel": { "choice": "low", "confidence": 0.82 },
|
|
454
|
+
"userAuthorization": { "choice": "high", "confidence": 0.77 },
|
|
455
|
+
"scopeAlignment": { "choice": "aligned", "confidence": 0.9 },
|
|
456
|
+
"evidenceCompleteness": { "choice": "partial", "confidence": 0.61 },
|
|
457
|
+
"primaryBasis": { "choice": "authorized_reversible_change", "confidence": 0.58 }
|
|
458
|
+
},
|
|
459
|
+
"signals": { "materialAuthorization": 0.81, "withinIntentScope": 0.88, "unauthorizedDataLoss": 0.12, "untrustedSensitiveDisclosure": 0.01, "excessiveCredentialAccess": 0.01, "unauthorizedSecurityChange": 0.02, "unauthorizedExternalMutation": 0.03, "essentialEvidenceMissing": 0.27, "absolutePolicyDeny": 0.02 },
|
|
460
|
+
"contradictions": ["an allow with incomplete evidence lacks strong outcome confidence"],
|
|
461
|
+
"reasoningRecommended": true
|
|
462
|
+
}
|
|
463
|
+
```
|
|
464
|
+
|
|
436
465
|
## What you'll see
|
|
437
466
|
|
|
438
467
|
```text
|
|
@@ -685,8 +714,9 @@ binary, blocked, or truncated evidence) remains a reviewer decision.
|
|
|
685
714
|
installs the published tarball in an isolated tree and freezes what a
|
|
686
715
|
consumer actually gets: the platform-specific packages under `@opentui`
|
|
687
716
|
(rendering only), the optional `@msgpackr-extract` accelerators, the exact
|
|
688
|
-
`@babel/core`
|
|
689
|
-
on any high or critical advisory
|
|
717
|
+
`@babel/core` and `solid-js` versions documented below, and an `npm audit`
|
|
718
|
+
gate that fails on any high or critical advisory other than the documented
|
|
719
|
+
`seroval` residuals. Root
|
|
690
720
|
`overrides` in this repository protect the development tree only; npm never
|
|
691
721
|
applies a dependency's overrides to the installing application, which is
|
|
692
722
|
why consumer-side guarantees live in tests against the installed tree
|
|
@@ -702,7 +732,14 @@ binary, blocked, or truncated evidence) remains a reviewer decision.
|
|
|
702
732
|
installed version, and moving off 7.28.0 is a conscious bump (an
|
|
703
733
|
`@opentui/solid` release with a fixed pin, or dropping the exact-pin
|
|
704
734
|
constraint) together with this note. The development tree overrides Babel to
|
|
705
|
-
7.29.7, but that override cannot reach an npm consumer.
|
|
735
|
+
7.29.7, but that override cannot reach an npm consumer. Likewise,
|
|
736
|
+
`@opentui/solid` peer-pins `solid-js@1.9.12` exactly, whose `seroval`
|
|
737
|
+
dependency carries GHSA-p6vx-979v-rg4c and GHSA-jp82-f5mq-hwhp (unsafe
|
|
738
|
+
`fromJSON` deserialization, fixed in `solid-js` 1.9.16). `seroval` is only
|
|
739
|
+
imported by the SSR renderer `solid-js/web`, which neither this package nor
|
|
740
|
+
OpenTUI loads, so the vulnerable code is not reachable at runtime; the
|
|
741
|
+
consumer surveillance test pins `solid-js`, asserts that nothing imports
|
|
742
|
+
`solid-js/web`, and admits only those two advisories. Separately, `esbuild`
|
|
706
743
|
(a build-time dependency here, never shipped) is root-overridden past
|
|
707
744
|
GHSA-g7r4-m6w7-qqqr; that override intentionally does not reach consumers
|
|
708
745
|
because consumers never install `esbuild` from this package at all.
|
package/dist/index.d.ts
CHANGED
|
@@ -336,6 +336,9 @@ interface ReviewAuditRecord {
|
|
|
336
336
|
model: string;
|
|
337
337
|
reason: string;
|
|
338
338
|
};
|
|
339
|
+
/** Jev's scores whenever it returned a parsed decision, including when a
|
|
340
|
+
* reasoning reviewer made the final call. */
|
|
341
|
+
systemOne?: SystemOneScores;
|
|
339
342
|
/** Per-phase timings. Absent on legacy v1 records and on deterministic paths
|
|
340
343
|
* that never reach that phase. */
|
|
341
344
|
timings?: {
|
|
@@ -422,6 +425,47 @@ interface ReviewAuditRecord {
|
|
|
422
425
|
answer: string;
|
|
423
426
|
}>;
|
|
424
427
|
}
|
|
428
|
+
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"];
|
|
429
|
+
type SystemOnePrimaryBasis = (typeof SYSTEM_ONE_BASES)[number];
|
|
430
|
+
interface SystemOneChoiceScore<T extends string> {
|
|
431
|
+
choice: T;
|
|
432
|
+
confidence: number;
|
|
433
|
+
}
|
|
434
|
+
/** Probability (0-1) that each safety question is true. */
|
|
435
|
+
interface SystemOneSignals {
|
|
436
|
+
materialAuthorization: number;
|
|
437
|
+
withinIntentScope: number;
|
|
438
|
+
unauthorizedDataLoss: number;
|
|
439
|
+
untrustedSensitiveDisclosure: number;
|
|
440
|
+
excessiveCredentialAccess: number;
|
|
441
|
+
unauthorizedSecurityChange: number;
|
|
442
|
+
unauthorizedExternalMutation: number;
|
|
443
|
+
essentialEvidenceMissing: number;
|
|
444
|
+
absolutePolicyDeny: number;
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Jev's own answer, kept apart from the final decision because a reasoning
|
|
448
|
+
* reviewer may replace it. Numbers, enum choices, fixed contradiction strings,
|
|
449
|
+
* and the provider-reported model ID only; never evidence text.
|
|
450
|
+
*/
|
|
451
|
+
interface SystemOneScores {
|
|
452
|
+
/** Versioned model ID the provider reported as having answered. */
|
|
453
|
+
returnedModel: string;
|
|
454
|
+
outcome: SystemOneChoiceScore<ReviewOutcome> & {
|
|
455
|
+
probabilities: Record<ReviewOutcome, number>;
|
|
456
|
+
};
|
|
457
|
+
supporting: {
|
|
458
|
+
riskLevel: SystemOneChoiceScore<RiskLevel>;
|
|
459
|
+
userAuthorization: SystemOneChoiceScore<UserAuthorization>;
|
|
460
|
+
scopeAlignment: SystemOneChoiceScore<ScopeAlignment>;
|
|
461
|
+
evidenceCompleteness: SystemOneChoiceScore<EvidenceSufficiency>;
|
|
462
|
+
primaryBasis: SystemOneChoiceScore<SystemOnePrimaryBasis>;
|
|
463
|
+
};
|
|
464
|
+
signals: SystemOneSignals;
|
|
465
|
+
/** Consistency checks that failed; any one marks an allow or deny difficult. */
|
|
466
|
+
contradictions: string[];
|
|
467
|
+
reasoningRecommended: boolean;
|
|
468
|
+
}
|
|
425
469
|
interface ApprovedAnnotation {
|
|
426
470
|
requestID: string;
|
|
427
471
|
sessionID: string;
|
|
@@ -441,6 +485,8 @@ interface ReviewExecutionResult {
|
|
|
441
485
|
model: string;
|
|
442
486
|
reason: string;
|
|
443
487
|
};
|
|
488
|
+
/** Jev's scores whenever it returned a parsed decision. */
|
|
489
|
+
systemOne?: SystemOneScores;
|
|
444
490
|
/**
|
|
445
491
|
* Structured outcome from the reviewer LLM before gates/disposition.
|
|
446
492
|
* Absent when no valid structured decision was produced.
|
|
@@ -1130,4 +1176,4 @@ declare const module$1: {
|
|
|
1130
1176
|
setup: typeof setup;
|
|
1131
1177
|
};
|
|
1132
1178
|
|
|
1133
|
-
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, type ScopeAlignment, type SessionLineage, type SessionNode, type UserAuthorization, applyEscalationDisposition, createAuditWriter, createUiStatus, decodeUiStatus, module$1 as default, emergencyBrakeReason, encodeUiStatus, enforceDecision, enrichGitEvidence, enrichLocalScriptEvidence, enrichSshEvidence, extractPermissionRequest, loadResolvedConfig, parseDecision, permissionAction, redactSecrets, resolveConfig, resolveEscalationDisposition, server };
|
|
1179
|
+
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 };
|
package/dist/index.js
CHANGED
|
@@ -279,6 +279,9 @@ function boundedReason(reason) {
|
|
|
279
279
|
const normalized = reason.replace(/[\r\n]+/g, " ").trim();
|
|
280
280
|
return normalized.length <= 2e3 ? normalized : `${normalized.slice(0, 2e3)}\u2026`;
|
|
281
281
|
}
|
|
282
|
+
function boundedModelID(model) {
|
|
283
|
+
return model.length <= 128 ? model : `${model.slice(0, 128)}\u2026`;
|
|
284
|
+
}
|
|
282
285
|
function createAuditWriter(config, logger) {
|
|
283
286
|
if (!config.audit) return;
|
|
284
287
|
const path = expandHome(config.auditPath ?? DEFAULT_AUDIT_PATH);
|
|
@@ -323,6 +326,13 @@ function createAuditWriter(config, logger) {
|
|
|
323
326
|
...record.reviewerEscalatedFrom,
|
|
324
327
|
reason: redactSecrets(boundedReason(record.reviewerEscalatedFrom.reason))
|
|
325
328
|
}
|
|
329
|
+
},
|
|
330
|
+
// The model ID is the one provider-controlled string in systemOne.
|
|
331
|
+
...record.systemOne === void 0 ? {} : {
|
|
332
|
+
systemOne: {
|
|
333
|
+
...record.systemOne,
|
|
334
|
+
returnedModel: boundedModelID(redactSecrets(record.systemOne.returnedModel))
|
|
335
|
+
}
|
|
326
336
|
}
|
|
327
337
|
};
|
|
328
338
|
try {
|
|
@@ -2990,6 +3000,7 @@ function applyEscalationDisposition(result, config, category = "general") {
|
|
|
2990
3000
|
...reviewerOutcome === void 0 ? {} : { reviewerOutcome },
|
|
2991
3001
|
...result.reviewerModel === void 0 ? {} : { reviewerModel: result.reviewerModel },
|
|
2992
3002
|
...result.reviewerEscalatedFrom === void 0 ? {} : { reviewerEscalatedFrom: result.reviewerEscalatedFrom },
|
|
3003
|
+
...result.systemOne === void 0 ? {} : { systemOne: result.systemOne },
|
|
2993
3004
|
escalationDisposition: "deny"
|
|
2994
3005
|
};
|
|
2995
3006
|
}
|
|
@@ -3083,6 +3094,9 @@ async function evaluateReview(request, config, ports) {
|
|
|
3083
3094
|
reason,
|
|
3084
3095
|
...result.decision === void 0 ? {} : { decision: result.decision },
|
|
3085
3096
|
...result.reviewSessionID === void 0 ? {} : { reviewSessionID: result.reviewSessionID },
|
|
3097
|
+
...result.reviewerModel === void 0 ? {} : { reviewerModel: result.reviewerModel },
|
|
3098
|
+
...result.reviewerEscalatedFrom === void 0 ? {} : { reviewerEscalatedFrom: result.reviewerEscalatedFrom },
|
|
3099
|
+
...result.systemOne === void 0 ? {} : { systemOne: result.systemOne },
|
|
3086
3100
|
decisionSource: "deterministic-policy"
|
|
3087
3101
|
},
|
|
3088
3102
|
config,
|
|
@@ -3880,13 +3894,8 @@ function formatFailureReason(phase, error) {
|
|
|
3880
3894
|
// src/system-one/backend.ts
|
|
3881
3895
|
init_redact();
|
|
3882
3896
|
|
|
3883
|
-
// src/
|
|
3884
|
-
var
|
|
3885
|
-
var RISKS2 = ["low", "medium", "high", "critical"];
|
|
3886
|
-
var AUTHORIZATIONS2 = ["high", "medium", "low", "unknown"];
|
|
3887
|
-
var ALIGNMENTS = ["aligned", "partial", "misaligned", "unknown"];
|
|
3888
|
-
var COMPLETENESS = ["sufficient", "partial", "insufficient", "unknown"];
|
|
3889
|
-
var BASES = [
|
|
3897
|
+
// src/types.ts
|
|
3898
|
+
var SYSTEM_ONE_BASES = [
|
|
3890
3899
|
"authorized_routine",
|
|
3891
3900
|
"authorized_reversible_change",
|
|
3892
3901
|
"insufficient_authorization",
|
|
@@ -3899,6 +3908,13 @@ var BASES = [
|
|
|
3899
3908
|
"trusted_policy_restriction",
|
|
3900
3909
|
"conflicting_evidence"
|
|
3901
3910
|
];
|
|
3911
|
+
|
|
3912
|
+
// src/system-one/review.ts
|
|
3913
|
+
var OUTCOMES2 = ["allow", "deny", "escalate"];
|
|
3914
|
+
var RISKS2 = ["low", "medium", "high", "critical"];
|
|
3915
|
+
var AUTHORIZATIONS2 = ["high", "medium", "low", "unknown"];
|
|
3916
|
+
var ALIGNMENTS = ["aligned", "partial", "misaligned", "unknown"];
|
|
3917
|
+
var COMPLETENESS = ["sufficient", "partial", "insufficient", "unknown"];
|
|
3902
3918
|
var choice = (instructions, criteria) => ({
|
|
3903
3919
|
type: "choice",
|
|
3904
3920
|
instructions,
|
|
@@ -4081,7 +4097,7 @@ function parseSystemOneReview(response, config) {
|
|
|
4081
4097
|
const authorization = parseChoice(answers.user_authorization, AUTHORIZATIONS2);
|
|
4082
4098
|
const alignment = parseChoice(answers.scope_alignment, ALIGNMENTS);
|
|
4083
4099
|
const completeness = parseChoice(answers.evidence_completeness, COMPLETENESS);
|
|
4084
|
-
const basis = parseChoice(answers.primary_basis,
|
|
4100
|
+
const basis = parseChoice(answers.primary_basis, SYSTEM_ONE_BASES);
|
|
4085
4101
|
if (!outcome || !risk || !authorization || !alignment || !completeness || !basis) return;
|
|
4086
4102
|
const signals = {
|
|
4087
4103
|
materialAuthorization: parseNoul(answers.material_authorization),
|
|
@@ -4161,13 +4177,33 @@ function parseSystemOneReview(response, config) {
|
|
|
4161
4177
|
if (decision.evidence_completeness !== "sufficient" && decision.confidence < 0.7)
|
|
4162
4178
|
contradictions.push("an allow with incomplete evidence lacks strong outcome confidence");
|
|
4163
4179
|
}
|
|
4164
|
-
const
|
|
4180
|
+
const uniqueContradictions = [...new Set(contradictions)];
|
|
4181
|
+
const difficultReason = decision.outcome === "escalate" ? "System One explicitly requested a reasoning or human review." : uniqueContradictions.length > 0 ? `System One decision is uncertain or inconsistent: ${uniqueContradictions.join("; ")}.` : void 0;
|
|
4182
|
+
const reasoningRecommended = difficultReason !== void 0 && (decision.outcome === "allow" || decision.outcome === "escalate" && outcome.probabilities.allow + outcome.probabilities.deny >= config.systemOneReasoningThreshold);
|
|
4183
|
+
const score = (parsed) => ({
|
|
4184
|
+
choice: parsed.choice,
|
|
4185
|
+
confidence: parsed.confidence
|
|
4186
|
+
});
|
|
4165
4187
|
return {
|
|
4166
4188
|
decision,
|
|
4167
4189
|
primaryBasis: basis.choice,
|
|
4168
4190
|
...difficultReason === void 0 ? {} : { difficultReason },
|
|
4169
|
-
reasoningRecommended
|
|
4170
|
-
returnedModel: raw.model
|
|
4191
|
+
reasoningRecommended,
|
|
4192
|
+
returnedModel: raw.model,
|
|
4193
|
+
scores: {
|
|
4194
|
+
returnedModel: raw.model,
|
|
4195
|
+
outcome: { ...score(outcome), probabilities: { ...outcome.probabilities } },
|
|
4196
|
+
supporting: {
|
|
4197
|
+
riskLevel: score(risk),
|
|
4198
|
+
userAuthorization: score(authorization),
|
|
4199
|
+
scopeAlignment: score(alignment),
|
|
4200
|
+
evidenceCompleteness: score(completeness),
|
|
4201
|
+
primaryBasis: score(basis)
|
|
4202
|
+
},
|
|
4203
|
+
signals: s,
|
|
4204
|
+
contradictions: uniqueContradictions,
|
|
4205
|
+
reasoningRecommended
|
|
4206
|
+
}
|
|
4171
4207
|
};
|
|
4172
4208
|
}
|
|
4173
4209
|
function enforceSystemOneDecision(decision, config) {
|
|
@@ -4261,6 +4297,8 @@ var SystemOneReviewerBackend = class {
|
|
|
4261
4297
|
}
|
|
4262
4298
|
async runReview(envelope, attempt, escalation) {
|
|
4263
4299
|
const started = performance.now();
|
|
4300
|
+
let systemOne;
|
|
4301
|
+
let reasoning;
|
|
4264
4302
|
try {
|
|
4265
4303
|
const evidence = buildEvidenceResult(envelope, this.config);
|
|
4266
4304
|
envelope.actionEvidenceComplete = envelope.actionEvidenceComplete !== false && evidence.actionEvidenceComplete;
|
|
@@ -4287,27 +4325,35 @@ var SystemOneReviewerBackend = class {
|
|
|
4287
4325
|
"invalid-decision"
|
|
4288
4326
|
);
|
|
4289
4327
|
}
|
|
4328
|
+
systemOne = parsed.scores;
|
|
4290
4329
|
const enforced = enforceParsedSystemOneReview(parsed, this.config);
|
|
4291
4330
|
if (enforced.kind !== "escalate") {
|
|
4292
4331
|
return {
|
|
4293
4332
|
...enforced,
|
|
4294
4333
|
decisionSource: "system-one-reviewer",
|
|
4295
|
-
reviewerModel: this.config.model
|
|
4334
|
+
reviewerModel: this.config.model,
|
|
4335
|
+
systemOne
|
|
4296
4336
|
};
|
|
4297
4337
|
}
|
|
4298
4338
|
if (escalation && this.escalationModel && parsed.reasoningRecommended) {
|
|
4339
|
+
reasoning = {
|
|
4340
|
+
model: this.escalationModel,
|
|
4341
|
+
escalatedFrom: { model: this.config.model, reason: enforced.reason }
|
|
4342
|
+
};
|
|
4299
4343
|
const secondary = reconcileReasoningEscalation(await escalation(envelope, attempt));
|
|
4300
4344
|
return {
|
|
4301
4345
|
...secondary,
|
|
4302
|
-
reviewerModel: secondary.reviewerModel ??
|
|
4303
|
-
reviewerEscalatedFrom:
|
|
4346
|
+
reviewerModel: secondary.reviewerModel ?? reasoning.model,
|
|
4347
|
+
reviewerEscalatedFrom: reasoning.escalatedFrom,
|
|
4348
|
+
systemOne
|
|
4304
4349
|
};
|
|
4305
4350
|
}
|
|
4306
4351
|
return applyEscalationDisposition(
|
|
4307
4352
|
{
|
|
4308
4353
|
...enforced,
|
|
4309
4354
|
decisionSource: "system-one-reviewer",
|
|
4310
|
-
reviewerModel: this.config.model
|
|
4355
|
+
reviewerModel: this.config.model,
|
|
4356
|
+
systemOne
|
|
4311
4357
|
},
|
|
4312
4358
|
this.config,
|
|
4313
4359
|
"general"
|
|
@@ -4316,9 +4362,14 @@ var SystemOneReviewerBackend = class {
|
|
|
4316
4362
|
return applyEscalationDisposition(
|
|
4317
4363
|
{
|
|
4318
4364
|
kind: "escalate",
|
|
4319
|
-
reason: formatFailureReason(
|
|
4365
|
+
reason: formatFailureReason(
|
|
4366
|
+
reasoning === void 0 ? "System One reviewer" : "reasoning reviewer",
|
|
4367
|
+
error
|
|
4368
|
+
),
|
|
4320
4369
|
decisionSource: "failure-safe",
|
|
4321
|
-
reviewerModel: this.config.model
|
|
4370
|
+
reviewerModel: reasoning?.model ?? this.config.model,
|
|
4371
|
+
...reasoning === void 0 ? {} : { reviewerEscalatedFrom: reasoning.escalatedFrom },
|
|
4372
|
+
...systemOne === void 0 ? {} : { systemOne }
|
|
4322
4373
|
},
|
|
4323
4374
|
this.config,
|
|
4324
4375
|
"reviewer-failure"
|
|
@@ -8484,7 +8535,7 @@ function defaultEvidenceProviders() {
|
|
|
8484
8535
|
// package.json
|
|
8485
8536
|
var package_default = {
|
|
8486
8537
|
name: "@noppu-labs/opencode-permission-reviewer",
|
|
8487
|
-
version: "2.4.
|
|
8538
|
+
version: "2.4.2",
|
|
8488
8539
|
description: "Policy-aware permission reviewer for OpenCode V1 and V2",
|
|
8489
8540
|
type: "module",
|
|
8490
8541
|
main: "./dist/index.js",
|
|
@@ -8573,7 +8624,7 @@ var package_default = {
|
|
|
8573
8624
|
devDependencies: {
|
|
8574
8625
|
"@eslint/js": "^10.0.0",
|
|
8575
8626
|
"@opencode-ai/plugin": "1.18.35",
|
|
8576
|
-
"@opencode/plugin": "2.0.
|
|
8627
|
+
"@opencode/plugin": "2.0.26",
|
|
8577
8628
|
"@types/bun": "^1.3.0",
|
|
8578
8629
|
"@types/semver": "7.8.0",
|
|
8579
8630
|
eslint: "^10.8.0",
|
|
@@ -8603,7 +8654,7 @@ var package_default = {
|
|
|
8603
8654
|
},
|
|
8604
8655
|
dependencies: {
|
|
8605
8656
|
"@typesafe-ai/sdk": "0.6.0",
|
|
8606
|
-
"@opencode/client": "2.0.
|
|
8657
|
+
"@opencode/client": "2.0.26",
|
|
8607
8658
|
"jsonc-parser": "3.3.1",
|
|
8608
8659
|
semver: "7.8.5",
|
|
8609
8660
|
"@opentui/core": "0.5.11",
|
|
@@ -8904,6 +8955,7 @@ var ReviewCoordinator = class {
|
|
|
8904
8955
|
actionHash: actionHash(request),
|
|
8905
8956
|
reviewerModel: result.reviewerModel ?? this.config.model,
|
|
8906
8957
|
...result.reviewerEscalatedFrom === void 0 ? {} : { reviewerEscalatedFrom: result.reviewerEscalatedFrom },
|
|
8958
|
+
...result.systemOne === void 0 ? {} : { systemOne: result.systemOne },
|
|
8907
8959
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
8908
8960
|
durationMs: Math.max(0, Date.now() - startedAt),
|
|
8909
8961
|
requestID: request.id,
|
|
@@ -10390,13 +10442,15 @@ async function setupWithServices(ctx, services) {
|
|
|
10390
10442
|
result = {
|
|
10391
10443
|
kind: "deny",
|
|
10392
10444
|
reason: "Pending action changed during its review",
|
|
10393
|
-
decisionSource: "failure-safe"
|
|
10445
|
+
decisionSource: "failure-safe",
|
|
10446
|
+
...result.systemOne === void 0 ? {} : { systemOne: result.systemOne }
|
|
10394
10447
|
};
|
|
10395
10448
|
} catch {
|
|
10396
10449
|
result = {
|
|
10397
10450
|
kind: "deny",
|
|
10398
10451
|
reason: "Pending action could not be revalidated",
|
|
10399
|
-
decisionSource: "failure-safe"
|
|
10452
|
+
decisionSource: "failure-safe",
|
|
10453
|
+
...result.systemOne === void 0 ? {} : { systemOne: result.systemOne }
|
|
10400
10454
|
};
|
|
10401
10455
|
}
|
|
10402
10456
|
const active = !disposed && attempt.active(generation);
|
|
@@ -10404,7 +10458,8 @@ async function setupWithServices(ctx, services) {
|
|
|
10404
10458
|
result = {
|
|
10405
10459
|
kind: "deny",
|
|
10406
10460
|
reason: "Review was cancelled or its total deadline expired",
|
|
10407
|
-
decisionSource: "failure-safe"
|
|
10461
|
+
decisionSource: "failure-safe",
|
|
10462
|
+
...result.systemOne === void 0 ? {} : { systemOne: result.systemOne }
|
|
10408
10463
|
};
|
|
10409
10464
|
input.effect = result.kind === "allow" ? "allow" : result.kind === "deny" ? "deny" : "ask";
|
|
10410
10465
|
if (input.effect === "allow" && envelope?.actionEvidenceComplete !== false)
|
|
@@ -10436,6 +10491,7 @@ async function setupWithServices(ctx, services) {
|
|
|
10436
10491
|
promptVersion: REVIEWER_PROMPT_VERSION,
|
|
10437
10492
|
reviewerModel: result.reviewerModel ?? config.model,
|
|
10438
10493
|
...result.reviewerEscalatedFrom ? { reviewerEscalatedFrom: result.reviewerEscalatedFrom } : {},
|
|
10494
|
+
...result.systemOne ? { systemOne: result.systemOne } : {},
|
|
10439
10495
|
effectiveConfigHash,
|
|
10440
10496
|
...normalized ? {
|
|
10441
10497
|
actionFingerprint: "v2:" + createHash6("sha256").update(
|
package/dist/tui/types.ts
CHANGED
|
@@ -305,6 +305,9 @@ export interface ReviewAuditRecord {
|
|
|
305
305
|
reviewerModel?: string
|
|
306
306
|
/** Present when a System One result was handed to a reasoning reviewer. */
|
|
307
307
|
reviewerEscalatedFrom?: { model: string; reason: string }
|
|
308
|
+
/** Jev's scores whenever it returned a parsed decision, including when a
|
|
309
|
+
* reasoning reviewer made the final call. */
|
|
310
|
+
systemOne?: SystemOneScores
|
|
308
311
|
/** Per-phase timings. Absent on legacy v1 records and on deterministic paths
|
|
309
312
|
* that never reach that phase. */
|
|
310
313
|
timings?: { contextMs?: number; enrichmentMs?: number; reviewerMs?: number; replyMs?: number }
|
|
@@ -374,6 +377,61 @@ export interface ReviewAuditRecord {
|
|
|
374
377
|
askDecisions?: Array<{ at: number; question: string; answer: string }>
|
|
375
378
|
}
|
|
376
379
|
|
|
380
|
+
export const SYSTEM_ONE_BASES = [
|
|
381
|
+
"authorized_routine",
|
|
382
|
+
"authorized_reversible_change",
|
|
383
|
+
"insufficient_authorization",
|
|
384
|
+
"scope_mismatch",
|
|
385
|
+
"insufficient_evidence",
|
|
386
|
+
"destructive_effect",
|
|
387
|
+
"credential_or_private_data",
|
|
388
|
+
"security_or_privilege_change",
|
|
389
|
+
"external_or_remote_effect",
|
|
390
|
+
"trusted_policy_restriction",
|
|
391
|
+
"conflicting_evidence",
|
|
392
|
+
] as const
|
|
393
|
+
export type SystemOnePrimaryBasis = (typeof SYSTEM_ONE_BASES)[number]
|
|
394
|
+
|
|
395
|
+
export interface SystemOneChoiceScore<T extends string> {
|
|
396
|
+
choice: T
|
|
397
|
+
confidence: number
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/** Probability (0-1) that each safety question is true. */
|
|
401
|
+
export interface SystemOneSignals {
|
|
402
|
+
materialAuthorization: number
|
|
403
|
+
withinIntentScope: number
|
|
404
|
+
unauthorizedDataLoss: number
|
|
405
|
+
untrustedSensitiveDisclosure: number
|
|
406
|
+
excessiveCredentialAccess: number
|
|
407
|
+
unauthorizedSecurityChange: number
|
|
408
|
+
unauthorizedExternalMutation: number
|
|
409
|
+
essentialEvidenceMissing: number
|
|
410
|
+
absolutePolicyDeny: number
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Jev's own answer, kept apart from the final decision because a reasoning
|
|
415
|
+
* reviewer may replace it. Numbers, enum choices, fixed contradiction strings,
|
|
416
|
+
* and the provider-reported model ID only; never evidence text.
|
|
417
|
+
*/
|
|
418
|
+
export interface SystemOneScores {
|
|
419
|
+
/** Versioned model ID the provider reported as having answered. */
|
|
420
|
+
returnedModel: string
|
|
421
|
+
outcome: SystemOneChoiceScore<ReviewOutcome> & { probabilities: Record<ReviewOutcome, number> }
|
|
422
|
+
supporting: {
|
|
423
|
+
riskLevel: SystemOneChoiceScore<RiskLevel>
|
|
424
|
+
userAuthorization: SystemOneChoiceScore<UserAuthorization>
|
|
425
|
+
scopeAlignment: SystemOneChoiceScore<ScopeAlignment>
|
|
426
|
+
evidenceCompleteness: SystemOneChoiceScore<EvidenceSufficiency>
|
|
427
|
+
primaryBasis: SystemOneChoiceScore<SystemOnePrimaryBasis>
|
|
428
|
+
}
|
|
429
|
+
signals: SystemOneSignals
|
|
430
|
+
/** Consistency checks that failed; any one marks an allow or deny difficult. */
|
|
431
|
+
contradictions: string[]
|
|
432
|
+
reasoningRecommended: boolean
|
|
433
|
+
}
|
|
434
|
+
|
|
377
435
|
export interface ApprovedAnnotation {
|
|
378
436
|
requestID: string
|
|
379
437
|
sessionID: string
|
|
@@ -391,6 +449,8 @@ export interface ReviewExecutionResult {
|
|
|
391
449
|
reviewerModel?: string
|
|
392
450
|
/** Primary model and routing reason when a second reviewer was used. */
|
|
393
451
|
reviewerEscalatedFrom?: { model: string; reason: string }
|
|
452
|
+
/** Jev's scores whenever it returned a parsed decision. */
|
|
453
|
+
systemOne?: SystemOneScores
|
|
394
454
|
/**
|
|
395
455
|
* Structured outcome from the reviewer LLM before gates/disposition.
|
|
396
456
|
* Absent when no valid structured decision was produced.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noppu-labs/opencode-permission-reviewer",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.2",
|
|
4
4
|
"description": "Policy-aware permission reviewer for OpenCode V1 and V2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"devDependencies": {
|
|
90
90
|
"@eslint/js": "^10.0.0",
|
|
91
91
|
"@opencode-ai/plugin": "1.18.35",
|
|
92
|
-
"@opencode/plugin": "2.0.
|
|
92
|
+
"@opencode/plugin": "2.0.26",
|
|
93
93
|
"@types/bun": "^1.3.0",
|
|
94
94
|
"@types/semver": "7.8.0",
|
|
95
95
|
"eslint": "^10.8.0",
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
},
|
|
120
120
|
"dependencies": {
|
|
121
121
|
"@typesafe-ai/sdk": "0.6.0",
|
|
122
|
-
"@opencode/client": "2.0.
|
|
122
|
+
"@opencode/client": "2.0.26",
|
|
123
123
|
"jsonc-parser": "3.3.1",
|
|
124
124
|
"semver": "7.8.5",
|
|
125
125
|
"@opentui/core": "0.5.11",
|