dsh-auto-review 0.4.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/CHANGELOG.md +91 -0
- package/LICENSE +201 -0
- package/README.es.md +226 -0
- package/README.hi.md +226 -0
- package/README.md +226 -0
- package/README.pt.md +226 -0
- package/README.zh.md +226 -0
- package/cordis.patch.yml +27 -0
- package/lib/client.js +494 -0
- package/lib/client.js.map +1 -0
- package/lib/events-CFl6CHZi.js +344 -0
- package/lib/index.js +5305 -0
- package/lib/invariant.js +223 -0
- package/lib/types/client/ReviewPanel.d.ts +29 -0
- package/lib/types/client/ReviewPanel.d.ts.map +1 -0
- package/lib/types/client/ReviewPanel.js +63 -0
- package/lib/types/client/ReviewPanel.js.map +1 -0
- package/lib/types/client/index.d.ts +31 -0
- package/lib/types/client/index.d.ts.map +1 -0
- package/lib/types/client/index.js +51 -0
- package/lib/types/client/index.js.map +1 -0
- package/lib/types/client/locales.d.ts +49 -0
- package/lib/types/client/locales.d.ts.map +1 -0
- package/lib/types/client/locales.js +82 -0
- package/lib/types/client/locales.js.map +1 -0
- package/lib/types/client/present.d.ts +25 -0
- package/lib/types/client/present.d.ts.map +1 -0
- package/lib/types/client/present.js +36 -0
- package/lib/types/client/present.js.map +1 -0
- package/lib/types/client/styles.d.ts +9 -0
- package/lib/types/client/styles.d.ts.map +1 -0
- package/lib/types/client/styles.js +130 -0
- package/lib/types/client/styles.js.map +1 -0
- package/lib/types/config.d.ts +200 -0
- package/lib/types/config.d.ts.map +1 -0
- package/lib/types/config.js +154 -0
- package/lib/types/config.js.map +1 -0
- package/lib/types/events.d.ts +347 -0
- package/lib/types/events.d.ts.map +1 -0
- package/lib/types/events.js +369 -0
- package/lib/types/events.js.map +1 -0
- package/lib/types/index.d.ts +26 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +26 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/invariant.d.ts +28 -0
- package/lib/types/invariant.d.ts.map +1 -0
- package/lib/types/invariant.js +306 -0
- package/lib/types/invariant.js.map +1 -0
- package/lib/types/messages.d.ts +38 -0
- package/lib/types/messages.d.ts.map +1 -0
- package/lib/types/messages.js +65 -0
- package/lib/types/messages.js.map +1 -0
- package/lib/types/projection-types.d.ts +61 -0
- package/lib/types/projection-types.d.ts.map +1 -0
- package/lib/types/projection-types.js +8 -0
- package/lib/types/projection-types.js.map +1 -0
- package/lib/types/projection.d.ts +93 -0
- package/lib/types/projection.d.ts.map +1 -0
- package/lib/types/projection.js +197 -0
- package/lib/types/projection.js.map +1 -0
- package/lib/types/review.d.ts +141 -0
- package/lib/types/review.d.ts.map +1 -0
- package/lib/types/review.js +389 -0
- package/lib/types/review.js.map +1 -0
- package/lib/types/runtime.d.ts +160 -0
- package/lib/types/runtime.d.ts.map +1 -0
- package/lib/types/runtime.js +486 -0
- package/lib/types/runtime.js.map +1 -0
- package/package.json +132 -0
- package/src/client/ReviewPanel.tsx +164 -0
- package/src/client/index.ts +72 -0
- package/src/client/locales.ts +87 -0
- package/src/client/present.ts +58 -0
- package/src/client/styles.ts +131 -0
- package/src/config.ts +346 -0
- package/src/events.ts +553 -0
- package/src/index.ts +28 -0
- package/src/invariant.ts +326 -0
- package/src/messages.ts +91 -0
- package/src/projection-types.ts +61 -0
- package/src/projection.ts +224 -0
- package/src/review.ts +428 -0
- package/src/runtime.ts +562 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scoped stylesheet for the review panel. Standalone bundles cannot use the
|
|
3
|
+
* in-repo CSS-module pipeline, so the panel injects one `<style>` element
|
|
4
|
+
* whose selectors are all scoped under `[data-dsh-auto-review]`.
|
|
5
|
+
* @module dsh-auto-review/client/styles
|
|
6
|
+
*/
|
|
7
|
+
/** Install the scoped stylesheet once per plugin fiber. */
|
|
8
|
+
export declare function installPanelStyles(): () => void;
|
|
9
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/client/styles.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmHH,2DAA2D;AAC3D,wBAAgB,kBAAkB,IAAI,MAAM,IAAI,CAS/C"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scoped stylesheet for the review panel. Standalone bundles cannot use the
|
|
3
|
+
* in-repo CSS-module pipeline, so the panel injects one `<style>` element
|
|
4
|
+
* whose selectors are all scoped under `[data-dsh-auto-review]`.
|
|
5
|
+
* @module dsh-auto-review/client/styles
|
|
6
|
+
*/
|
|
7
|
+
const STYLE_ID = 'dsh-auto-review-panel-styles';
|
|
8
|
+
const CSS = `
|
|
9
|
+
[data-dsh-auto-review] {
|
|
10
|
+
--ar-allow: var(--dsw-color-success, #16a34a);
|
|
11
|
+
--ar-deny: var(--dsw-color-danger, #dc2626);
|
|
12
|
+
--ar-fallback: var(--dsw-color-warning, #d97706);
|
|
13
|
+
--ar-escalation: var(--dsw-color-warning, #d97706);
|
|
14
|
+
--ar-border: var(--dsw-color-border, rgba(128, 128, 128, 0.3));
|
|
15
|
+
--ar-bg: var(--dsw-color-surface, #ffffff);
|
|
16
|
+
--ar-fg: var(--dsw-color-text, #1f2328);
|
|
17
|
+
--ar-muted: var(--dsw-color-text-muted, #6b7280);
|
|
18
|
+
font-family: inherit;
|
|
19
|
+
color: var(--ar-fg);
|
|
20
|
+
}
|
|
21
|
+
[data-dsh-auto-review-panel] {
|
|
22
|
+
position: absolute;
|
|
23
|
+
z-index: 40;
|
|
24
|
+
min-width: 320px;
|
|
25
|
+
max-width: 420px;
|
|
26
|
+
max-height: 70vh;
|
|
27
|
+
overflow-y: auto;
|
|
28
|
+
background: var(--ar-bg);
|
|
29
|
+
border: 1px solid var(--ar-border);
|
|
30
|
+
border-radius: 8px;
|
|
31
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
|
|
32
|
+
padding: 12px;
|
|
33
|
+
font-size: 12px;
|
|
34
|
+
line-height: 1.5;
|
|
35
|
+
}
|
|
36
|
+
[data-dsh-auto-review-button] {
|
|
37
|
+
display: inline-flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
gap: 4px;
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
background: transparent;
|
|
42
|
+
border: 1px solid var(--ar-border);
|
|
43
|
+
border-radius: 6px;
|
|
44
|
+
padding: 3px 8px;
|
|
45
|
+
font-size: 12px;
|
|
46
|
+
color: var(--ar-fg);
|
|
47
|
+
}
|
|
48
|
+
[data-dsh-auto-review-button]:hover {
|
|
49
|
+
background: rgba(128, 128, 128, 0.12);
|
|
50
|
+
}
|
|
51
|
+
[data-dsh-auto-review-section] {
|
|
52
|
+
margin: 8px 0;
|
|
53
|
+
border-top: 1px solid var(--ar-border);
|
|
54
|
+
padding-top: 8px;
|
|
55
|
+
}
|
|
56
|
+
[data-dsh-auto-review-title] {
|
|
57
|
+
font-weight: 600;
|
|
58
|
+
margin-bottom: 6px;
|
|
59
|
+
}
|
|
60
|
+
[data-dsh-auto-review-row] {
|
|
61
|
+
display: flex;
|
|
62
|
+
justify-content: space-between;
|
|
63
|
+
gap: 8px;
|
|
64
|
+
padding: 2px 0;
|
|
65
|
+
align-items: baseline;
|
|
66
|
+
}
|
|
67
|
+
[data-dsh-auto-review-muted] {
|
|
68
|
+
color: var(--ar-muted);
|
|
69
|
+
}
|
|
70
|
+
[data-dsh-auto-review-verdict] {
|
|
71
|
+
display: flex;
|
|
72
|
+
justify-content: space-between;
|
|
73
|
+
gap: 8px;
|
|
74
|
+
padding: 3px 0;
|
|
75
|
+
border-bottom: 1px dashed var(--ar-border);
|
|
76
|
+
}
|
|
77
|
+
[data-dsh-auto-review-tone-allow] { color: var(--ar-allow); }
|
|
78
|
+
[data-dsh-auto-review-tone-deny] { color: var(--ar-deny); }
|
|
79
|
+
[data-dsh-auto-review-tone-fallback] { color: var(--ar-fallback); }
|
|
80
|
+
[data-dsh-auto-review-tone-escalation] { color: var(--ar-escalation); }
|
|
81
|
+
[data-dsh-auto-review-approve] {
|
|
82
|
+
cursor: pointer;
|
|
83
|
+
border: 1px solid var(--ar-border);
|
|
84
|
+
border-radius: 4px;
|
|
85
|
+
background: transparent;
|
|
86
|
+
color: var(--ar-fg);
|
|
87
|
+
padding: 1px 6px;
|
|
88
|
+
font-size: 11px;
|
|
89
|
+
}
|
|
90
|
+
[data-dsh-auto-review-approve]:hover {
|
|
91
|
+
background: rgba(128, 128, 128, 0.12);
|
|
92
|
+
}
|
|
93
|
+
[data-dsh-auto-review-switch] {
|
|
94
|
+
cursor: pointer;
|
|
95
|
+
border: 1px solid var(--ar-border);
|
|
96
|
+
border-radius: 4px;
|
|
97
|
+
background: transparent;
|
|
98
|
+
color: var(--ar-fg);
|
|
99
|
+
padding: 1px 6px;
|
|
100
|
+
font-size: 11px;
|
|
101
|
+
}
|
|
102
|
+
[data-dsh-auto-review-switch] + [data-dsh-auto-review-switch] {
|
|
103
|
+
margin-left: 4px;
|
|
104
|
+
}
|
|
105
|
+
[data-dsh-auto-review-switch]:hover:not(:disabled) {
|
|
106
|
+
background: rgba(128, 128, 128, 0.12);
|
|
107
|
+
}
|
|
108
|
+
[data-dsh-auto-review-approve]:disabled,
|
|
109
|
+
[data-dsh-auto-review-switch]:disabled {
|
|
110
|
+
opacity: 0.45;
|
|
111
|
+
cursor: default;
|
|
112
|
+
}
|
|
113
|
+
[data-dsh-auto-review-circuit] {
|
|
114
|
+
color: var(--ar-deny);
|
|
115
|
+
font-weight: 600;
|
|
116
|
+
}
|
|
117
|
+
`;
|
|
118
|
+
/** Install the scoped stylesheet once per plugin fiber. */
|
|
119
|
+
export function installPanelStyles() {
|
|
120
|
+
if (document.getElementById(STYLE_ID) !== null)
|
|
121
|
+
return () => undefined;
|
|
122
|
+
const element = document.createElement('style');
|
|
123
|
+
element.id = STYLE_ID;
|
|
124
|
+
element.textContent = CSS;
|
|
125
|
+
document.head.appendChild(element);
|
|
126
|
+
return () => {
|
|
127
|
+
element.remove();
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/client/styles.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,QAAQ,GAAG,8BAA8B,CAAA;AAE/C,MAAM,GAAG,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6GX,CAAA;AAED,2DAA2D;AAC3D,MAAM,UAAU,kBAAkB;IAChC,IAAI,QAAQ,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,IAAI;QAAE,OAAO,GAAG,EAAE,CAAC,SAAS,CAAA;IACtE,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;IAC/C,OAAO,CAAC,EAAE,GAAG,QAAQ,CAAA;IACrB,OAAO,CAAC,WAAW,GAAG,GAAG,CAAA;IACzB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;IAClC,OAAO,GAAG,EAAE;QACV,OAAO,CAAC,MAAM,EAAE,CAAA;IAClB,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config schema and resolution for `dsh-auto-review`. Every tunable is a
|
|
3
|
+
* validated {@link Config} field changeable from cordis.yml; the resolution
|
|
4
|
+
* step compiles risk-rule regexes and fails loud on invalid input.
|
|
5
|
+
* @module dsh-auto-review/config
|
|
6
|
+
*/
|
|
7
|
+
import z from '@deepseek-ai/schemastery';
|
|
8
|
+
import type { UiLanguage } from './messages.ts';
|
|
9
|
+
/**
|
|
10
|
+
* What one approval request does at the auto-review answerer:
|
|
11
|
+
*
|
|
12
|
+
* - `'ai'` — the AI reviewer decides (allow/deny) and the request never
|
|
13
|
+
* reaches a human answerer.
|
|
14
|
+
* - `'human'` — the request is delegated (`next()`) to the human answerer;
|
|
15
|
+
* auto-review does not short-circuit the chain.
|
|
16
|
+
* - `'never'` — the answerer rejects deterministically. Only for tools an
|
|
17
|
+
* admin wants hard-disabled whenever approval is required.
|
|
18
|
+
*/
|
|
19
|
+
export type ToolReviewPolicy = 'ai' | 'human' | 'never';
|
|
20
|
+
/** Risk levels the reviewer may attach to a verdict. */
|
|
21
|
+
export type RiskLevel = 'low' | 'medium' | 'high';
|
|
22
|
+
/** The risk-level ordering, low first — the comparison base of {@link RiskPolicyConfig}. */
|
|
23
|
+
export declare const RISK_ORDER: readonly RiskLevel[];
|
|
24
|
+
/** What a risk-rule pattern is matched against. */
|
|
25
|
+
export type RiskRuleField = 'reason' | 'toolName' | 'arguments';
|
|
26
|
+
/**
|
|
27
|
+
* What happens when the reviewer cannot deliver a verdict (crash, timeout,
|
|
28
|
+
* subagent unavailable, schema mismatch):
|
|
29
|
+
*
|
|
30
|
+
* - `'rejected'` — fail closed; the request is denied (the default).
|
|
31
|
+
* - `'delegate'` — the request is passed down the answerer chain (a human
|
|
32
|
+
* answerer, when one is composed).
|
|
33
|
+
* - `'allow-once'` — the request is granted once. Deliberately dangerous:
|
|
34
|
+
* the grant is unconditional, not "readonly" in any enforced sense; it
|
|
35
|
+
* exists for unattended deployments whose admin accepts that risk. Renamed
|
|
36
|
+
* from `allow-readonly` in 0.2.0 for honesty; the old spelling is rejected
|
|
37
|
+
* loudly.
|
|
38
|
+
*/
|
|
39
|
+
export type FallbackPolicy = 'rejected' | 'delegate' | 'allow-once';
|
|
40
|
+
/**
|
|
41
|
+
* How much of the session transcript the reviewer receives as compact
|
|
42
|
+
* context (the calling session's recent user/assistant messages and tool
|
|
43
|
+
* results, redacted and truncated). `turns: 0` disables the section.
|
|
44
|
+
*/
|
|
45
|
+
export interface ContextBudgetConfig {
|
|
46
|
+
/** How many completed turns (plus the current one) of transcript to include; 0 disables. */
|
|
47
|
+
readonly turns: number;
|
|
48
|
+
/** Character cap applied to the whole context section. */
|
|
49
|
+
readonly maxChars: number;
|
|
50
|
+
}
|
|
51
|
+
/** What a tripped rejection circuit breaker does to later ai-policy requests in the turn. */
|
|
52
|
+
export type CircuitAction = 'delegate' | 'reject' | 'abort-turn';
|
|
53
|
+
/**
|
|
54
|
+
* The rejection circuit breaker: after a run of denials the turn stops
|
|
55
|
+
* asking the reviewer. Trips on {@link consecutiveDenies} consecutive deny
|
|
56
|
+
* verdicts in the turn OR {@link windowDenies} denials inside the last
|
|
57
|
+
* {@link windowSize} verdicts of the turn, whichever comes first.
|
|
58
|
+
*/
|
|
59
|
+
export interface CircuitBreakerConfig {
|
|
60
|
+
/** Consecutive deny verdicts in one turn that trip the breaker. */
|
|
61
|
+
readonly consecutiveDenies: number;
|
|
62
|
+
/** Deny count inside the window that trips the breaker. */
|
|
63
|
+
readonly windowDenies: number;
|
|
64
|
+
/** How many recent verdicts the window counts. */
|
|
65
|
+
readonly windowSize: number;
|
|
66
|
+
/** What later requests in the turn do once tripped. */
|
|
67
|
+
readonly action: CircuitAction;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* How the reviewer's verdict risk level constrains the outcome: an `allow`
|
|
71
|
+
* verdict whose risk exceeds {@link maxAutoAllow} never settles the request
|
|
72
|
+
* — it delegates to the human chain (or denies) per {@link onHighRisk}.
|
|
73
|
+
*/
|
|
74
|
+
export interface RiskPolicyConfig {
|
|
75
|
+
/** The highest risk level an allow verdict may settle with. */
|
|
76
|
+
readonly maxAutoAllow: RiskLevel;
|
|
77
|
+
/** What happens to an allow verdict above the cap. */
|
|
78
|
+
readonly onHighRisk: 'delegate' | 'deny';
|
|
79
|
+
}
|
|
80
|
+
/** One risk rule: a regex matched against the request reason, tool name, or redacted call arguments. */
|
|
81
|
+
export interface RiskRuleConfig {
|
|
82
|
+
/** Regular expression source (compiled without flags). */
|
|
83
|
+
pattern: string;
|
|
84
|
+
/** The policy a matching request resolves to. */
|
|
85
|
+
policy: ToolReviewPolicy;
|
|
86
|
+
/** What the pattern is matched against. Default `'reason'`; `'arguments'` matches the redacted presented call arguments. */
|
|
87
|
+
field?: RiskRuleField;
|
|
88
|
+
}
|
|
89
|
+
/** Per-tool policy table: explicit overrides, then a default for unlisted tools. */
|
|
90
|
+
export interface ToolsPolicyConfig {
|
|
91
|
+
/** Policy for tools not named in {@link overrides}. Default `'human'` (delegate). */
|
|
92
|
+
default: ToolReviewPolicy;
|
|
93
|
+
/** Exact tool-name → policy mapping. */
|
|
94
|
+
overrides: Record<string, ToolReviewPolicy>;
|
|
95
|
+
}
|
|
96
|
+
/** Raw plugin config — every field optional; {@link Config} supplies the defaults. */
|
|
97
|
+
export interface Config {
|
|
98
|
+
/**
|
|
99
|
+
* Whether sessions start with auto-review enabled. The `/auto-review`
|
|
100
|
+
* command writes a durable per-session override that beats this default.
|
|
101
|
+
*/
|
|
102
|
+
enableByDefault?: boolean;
|
|
103
|
+
/** Tool policy table (defaults + per-tool overrides). */
|
|
104
|
+
toolsPolicy?: Partial<ToolsPolicyConfig>;
|
|
105
|
+
/** Risk rules matched (first match wins) against the request reason before the tool table. */
|
|
106
|
+
riskRules?: RiskRuleConfig[];
|
|
107
|
+
/** Subagent provider name for the reviewer (default `fork`, the in-process fork backend). */
|
|
108
|
+
reviewerProvider?: string;
|
|
109
|
+
/** Reviewer model id; when unset the reviewer inherits the session agent's route. */
|
|
110
|
+
reviewerModel?: string;
|
|
111
|
+
/** Verdict deadline in milliseconds. Default 60000. */
|
|
112
|
+
reviewerTimeoutMs?: number;
|
|
113
|
+
/**
|
|
114
|
+
* The reviewer's tool allow-list — read-only tools by default. The subagent
|
|
115
|
+
* `toolFilter` is an allow-list: anything not named here is invisible to
|
|
116
|
+
* and unexecutable by the reviewer child. Must be non-empty.
|
|
117
|
+
*/
|
|
118
|
+
reviewerTools?: string[];
|
|
119
|
+
/** Reviewer failure policy (see {@link FallbackPolicy}). Default `'rejected'`. */
|
|
120
|
+
fallbackPolicy?: FallbackPolicy;
|
|
121
|
+
/** Maximum real AI verdicts per open turn; further requests delegate to humans. */
|
|
122
|
+
maxReviewsPerTurn?: number;
|
|
123
|
+
/**
|
|
124
|
+
* Maximum reviewer failures (timeout/unavailable/schema — not user
|
|
125
|
+
* cancellations) per open turn; beyond it, further requests delegate
|
|
126
|
+
* instead of paying another full timeout. Defaults to
|
|
127
|
+
* {@link maxReviewsPerTurn}.
|
|
128
|
+
*/
|
|
129
|
+
maxFailuresPerTurn?: number;
|
|
130
|
+
/** Cap applied to reviewer reasons, the request reason, and the redacted argument preview before they enter prompts or logs. */
|
|
131
|
+
reasonMaxChars?: number;
|
|
132
|
+
/** Optional extra guidance appended to the reviewer prompt (advisory, not a hard rule). */
|
|
133
|
+
reviewerGuidance?: string;
|
|
134
|
+
/**
|
|
135
|
+
* Optional policy text injected into the reviewer prompt as the ruling
|
|
136
|
+
* policy (Markdown: always-deny / always-allow / require-justification
|
|
137
|
+
* sections), like Codex `auto_review.policy`. A template ships at
|
|
138
|
+
* `fixtures/config/policy-template.md`.
|
|
139
|
+
*/
|
|
140
|
+
reviewerPolicyText?: string;
|
|
141
|
+
/** Guidance appended to every injected deny reason (anti-circumvention). */
|
|
142
|
+
denyGuidance?: string;
|
|
143
|
+
/** Compact transcript budget for the reviewer prompt (see {@link ContextBudgetConfig}). */
|
|
144
|
+
contextBudget?: Partial<ContextBudgetConfig>;
|
|
145
|
+
/** Verdict risk-level constraints (see {@link RiskPolicyConfig}). */
|
|
146
|
+
riskPolicy?: Partial<RiskPolicyConfig>;
|
|
147
|
+
/** The rejection circuit breaker (see {@link CircuitBreakerConfig}). */
|
|
148
|
+
circuitBreaker?: Partial<CircuitBreakerConfig>;
|
|
149
|
+
/** How long a `/auto-review approve` override stays usable, in milliseconds. Default 5 minutes. */
|
|
150
|
+
overrideTtlMs?: number;
|
|
151
|
+
/** UI language of the `/auto-review` command output (`en` | `zh`). Default `'en'`. */
|
|
152
|
+
language?: UiLanguage;
|
|
153
|
+
}
|
|
154
|
+
/** Config after {@link resolveConfig}: every optional field has its explicit default. */
|
|
155
|
+
export interface ResolvedConfig {
|
|
156
|
+
readonly enableByDefault: boolean;
|
|
157
|
+
readonly toolsPolicy: ToolsPolicyConfig;
|
|
158
|
+
readonly riskRules: readonly ResolvedRiskRule[];
|
|
159
|
+
readonly reviewerProvider: string;
|
|
160
|
+
readonly reviewerModel: string | undefined;
|
|
161
|
+
readonly reviewerTimeoutMs: number;
|
|
162
|
+
readonly reviewerTools: readonly string[];
|
|
163
|
+
readonly fallbackPolicy: FallbackPolicy;
|
|
164
|
+
readonly maxReviewsPerTurn: number;
|
|
165
|
+
readonly maxFailuresPerTurn: number;
|
|
166
|
+
readonly reasonMaxChars: number;
|
|
167
|
+
readonly reviewerGuidance: string | undefined;
|
|
168
|
+
readonly reviewerPolicyText: string | undefined;
|
|
169
|
+
readonly denyGuidance: string;
|
|
170
|
+
readonly contextBudget: ContextBudgetConfig;
|
|
171
|
+
readonly riskPolicy: RiskPolicyConfig;
|
|
172
|
+
readonly circuitBreaker: CircuitBreakerConfig;
|
|
173
|
+
readonly overrideTtlMs: number;
|
|
174
|
+
readonly language: UiLanguage;
|
|
175
|
+
}
|
|
176
|
+
/** A compiled {@link RiskRuleConfig}, ready to test against its configured field. */
|
|
177
|
+
export interface ResolvedRiskRule {
|
|
178
|
+
/** The original pattern source, kept for prompts and audit. */
|
|
179
|
+
readonly pattern: string;
|
|
180
|
+
readonly regex: RegExp;
|
|
181
|
+
readonly policy: ToolReviewPolicy;
|
|
182
|
+
readonly field: RiskRuleField;
|
|
183
|
+
}
|
|
184
|
+
/** Default anti-circumvention guidance appended to every injected deny reason. */
|
|
185
|
+
export declare const DEFAULT_DENY_GUIDANCE: string;
|
|
186
|
+
/** Schemastery schema: the loader validates and fills defaults before `apply`. */
|
|
187
|
+
export declare const Config: z<Config>;
|
|
188
|
+
/** Whether `level` ranks strictly above `cap` in {@link RISK_ORDER}. */
|
|
189
|
+
export declare function riskExceeds(level: RiskLevel, cap: RiskLevel): boolean;
|
|
190
|
+
/**
|
|
191
|
+
* Validate raw values and compile the resolved config. Defaults are applied
|
|
192
|
+
* HERE — the explicit resolution step — so a partially-specified config from
|
|
193
|
+
* a direct `ctx.plugin` mount behaves like the loader-filled one.
|
|
194
|
+
* @param config - raw (possibly partial) plugin config.
|
|
195
|
+
* @returns the fully resolved config.
|
|
196
|
+
* @throws TypeError on invalid risk-rule regexes, non-positive budgets, or
|
|
197
|
+
* out-of-range numbers (misconfiguration fails loud).
|
|
198
|
+
*/
|
|
199
|
+
export declare function resolveConfig(config?: Config): ResolvedConfig;
|
|
200
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,CAAC,MAAM,0BAA0B,CAAA;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE/C;;;;;;;;;GASG;AACH,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,OAAO,GAAG,OAAO,CAAA;AAEvD,wDAAwD;AACxD,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAA;AAEjD,4FAA4F;AAC5F,eAAO,MAAM,UAAU,EAAE,SAAS,SAAS,EAA8B,CAAA;AAEzE,mDAAmD;AACnD,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAA;AAE/D;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,UAAU,GAAG,YAAY,CAAA;AAEnE;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,4FAA4F;IAC5F,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,0DAA0D;IAC1D,QAAQ,CAAC,QAAQ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config} field changeable from cordis.yml; the resolution
|
|
4
|
+
* step compiles risk-rule regexes and fails loud on invalid input.
|
|
5
|
+
* @module dsh-auto-review/config
|
|
6
|
+
*/
|
|
7
|
+
import z from '@deepseek-ai/schemastery';
|
|
8
|
+
/** The risk-level ordering, low first — the comparison base of {@link RiskPolicyConfig}. */
|
|
9
|
+
export const RISK_ORDER = ['low', 'medium', 'high'];
|
|
10
|
+
const POLICY = z.union(['ai', 'human', 'never']);
|
|
11
|
+
const FALLBACK = z.union(['rejected', 'delegate', 'allow-once']);
|
|
12
|
+
const RISK = z.union(['low', 'medium', 'high']);
|
|
13
|
+
const FIELD = z.union(['reason', 'toolName', 'arguments']);
|
|
14
|
+
const CIRCUIT_ACTION = z.union(['delegate', 'reject', 'abort-turn']);
|
|
15
|
+
/** Default anti-circumvention guidance appended to every injected deny reason. */
|
|
16
|
+
export const DEFAULT_DENY_GUIDANCE = 'Do not attempt to work around this denial. '
|
|
17
|
+
+ 'Choose a materially safer alternative that stays inside your permissions, or ask the user before retrying this action.';
|
|
18
|
+
/** Schemastery schema: the loader validates and fills defaults before `apply`. */
|
|
19
|
+
export const Config = z.object({
|
|
20
|
+
enableByDefault: z.boolean().default(true),
|
|
21
|
+
toolsPolicy: z.object({
|
|
22
|
+
default: POLICY.default('human'),
|
|
23
|
+
overrides: z.dict(POLICY).default({}),
|
|
24
|
+
}).default({ default: 'human', overrides: {} }),
|
|
25
|
+
riskRules: z.array(z.object({
|
|
26
|
+
pattern: z.string(),
|
|
27
|
+
policy: POLICY,
|
|
28
|
+
field: FIELD.default('reason'),
|
|
29
|
+
})).default([]),
|
|
30
|
+
reviewerProvider: z.string().default('fork'),
|
|
31
|
+
reviewerModel: z.string(),
|
|
32
|
+
reviewerTimeoutMs: z.number().default(60_000),
|
|
33
|
+
reviewerTools: z.array(z.string()).default(['read', 'glob', 'grep']),
|
|
34
|
+
fallbackPolicy: FALLBACK.default('rejected'),
|
|
35
|
+
maxReviewsPerTurn: z.number().default(10),
|
|
36
|
+
maxFailuresPerTurn: z.number(),
|
|
37
|
+
reasonMaxChars: z.number().default(2000),
|
|
38
|
+
reviewerGuidance: z.string(),
|
|
39
|
+
reviewerPolicyText: z.string(),
|
|
40
|
+
denyGuidance: z.string().default(DEFAULT_DENY_GUIDANCE),
|
|
41
|
+
contextBudget: z.object({
|
|
42
|
+
turns: z.number().default(0),
|
|
43
|
+
maxChars: z.number().default(4000),
|
|
44
|
+
}).default({ turns: 0, maxChars: 4000 }),
|
|
45
|
+
riskPolicy: z.object({
|
|
46
|
+
maxAutoAllow: RISK.default('high'),
|
|
47
|
+
onHighRisk: z.union(['delegate', 'deny']).default('delegate'),
|
|
48
|
+
}).default({ maxAutoAllow: 'high', onHighRisk: 'delegate' }),
|
|
49
|
+
circuitBreaker: z.object({
|
|
50
|
+
consecutiveDenies: z.number().default(3),
|
|
51
|
+
// The window defaults must stay reachable under the default
|
|
52
|
+
// maxReviewsPerTurn (10): a window trip needs 6 denies inside the turn's
|
|
53
|
+
// at most 10 verdicts, so interleaved denials trip it even when no
|
|
54
|
+
// 3-deny run occurs (a 10-in-50 default could never trip first).
|
|
55
|
+
windowDenies: z.number().default(6),
|
|
56
|
+
windowSize: z.number().default(10),
|
|
57
|
+
action: CIRCUIT_ACTION.default('delegate'),
|
|
58
|
+
}).default({ consecutiveDenies: 3, windowDenies: 6, windowSize: 10, action: 'delegate' }),
|
|
59
|
+
overrideTtlMs: z.number().default(5 * 60_000),
|
|
60
|
+
language: z.union(['en', 'zh']).default('en'),
|
|
61
|
+
});
|
|
62
|
+
/** Whether `level` ranks strictly above `cap` in {@link RISK_ORDER}. */
|
|
63
|
+
export function riskExceeds(level, cap) {
|
|
64
|
+
return RISK_ORDER.indexOf(level) > RISK_ORDER.indexOf(cap);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Validate raw values and compile the resolved config. Defaults are applied
|
|
68
|
+
* HERE — the explicit resolution step — so a partially-specified config from
|
|
69
|
+
* a direct `ctx.plugin` mount behaves like the loader-filled one.
|
|
70
|
+
* @param config - raw (possibly partial) plugin config.
|
|
71
|
+
* @returns the fully resolved config.
|
|
72
|
+
* @throws TypeError on invalid risk-rule regexes, non-positive budgets, or
|
|
73
|
+
* out-of-range numbers (misconfiguration fails loud).
|
|
74
|
+
*/
|
|
75
|
+
export function resolveConfig(config = {}) {
|
|
76
|
+
if (!Number.isSafeInteger(config.reviewerTimeoutMs ?? 60_000) || (config.reviewerTimeoutMs ?? 60_000) <= 0) {
|
|
77
|
+
throw new TypeError(`reviewerTimeoutMs must be a positive safe integer, got ${String(config.reviewerTimeoutMs)}`);
|
|
78
|
+
}
|
|
79
|
+
if (!Number.isSafeInteger(config.maxReviewsPerTurn ?? 10) || (config.maxReviewsPerTurn ?? 10) <= 0) {
|
|
80
|
+
throw new TypeError(`maxReviewsPerTurn must be a positive safe integer, got ${String(config.maxReviewsPerTurn)}`);
|
|
81
|
+
}
|
|
82
|
+
if (!Number.isSafeInteger(config.maxFailuresPerTurn ?? 10) || (config.maxFailuresPerTurn ?? 10) <= 0) {
|
|
83
|
+
throw new TypeError(`maxFailuresPerTurn must be a positive safe integer, got ${String(config.maxFailuresPerTurn)}`);
|
|
84
|
+
}
|
|
85
|
+
if (!Number.isSafeInteger(config.reasonMaxChars ?? 2000) || (config.reasonMaxChars ?? 2000) <= 0) {
|
|
86
|
+
throw new TypeError(`reasonMaxChars must be a positive safe integer, got ${String(config.reasonMaxChars)}`);
|
|
87
|
+
}
|
|
88
|
+
const turns = config.contextBudget?.turns ?? 0;
|
|
89
|
+
if (!Number.isSafeInteger(turns) || turns < 0) {
|
|
90
|
+
throw new TypeError(`contextBudget.turns must be a non-negative safe integer, got ${String(turns)}`);
|
|
91
|
+
}
|
|
92
|
+
const contextChars = config.contextBudget?.maxChars ?? 4000;
|
|
93
|
+
if (!Number.isSafeInteger(contextChars) || contextChars <= 0) {
|
|
94
|
+
throw new TypeError(`contextBudget.maxChars must be a positive safe integer, got ${String(contextChars)}`);
|
|
95
|
+
}
|
|
96
|
+
const breaker = config.circuitBreaker ?? {};
|
|
97
|
+
for (const [key, value] of [['consecutiveDenies', breaker.consecutiveDenies ?? 3], ['windowDenies', breaker.windowDenies ?? 6], ['windowSize', breaker.windowSize ?? 10]]) {
|
|
98
|
+
if (!Number.isSafeInteger(value) || value <= 0) {
|
|
99
|
+
throw new TypeError(`circuitBreaker.${key} must be a positive safe integer, got ${String(value)}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (!Number.isSafeInteger(config.overrideTtlMs ?? 5 * 60_000) || (config.overrideTtlMs ?? 5 * 60_000) <= 0) {
|
|
103
|
+
throw new TypeError(`overrideTtlMs must be a positive safe integer, got ${String(config.overrideTtlMs)}`);
|
|
104
|
+
}
|
|
105
|
+
const reviewerTools = config.reviewerTools ?? ['read', 'glob', 'grep'];
|
|
106
|
+
if (reviewerTools.length === 0) {
|
|
107
|
+
throw new TypeError('reviewerTools must name at least one tool: an empty allow-list would leave the reviewer with no tool face');
|
|
108
|
+
}
|
|
109
|
+
const riskRules = (config.riskRules ?? []).map((rule) => {
|
|
110
|
+
let regex;
|
|
111
|
+
try {
|
|
112
|
+
// Flags are stripped: a global flag would make repeated .test() calls
|
|
113
|
+
// stateful (lastIndex), and other flags would silently change semantics.
|
|
114
|
+
regex = new RegExp(rule.pattern, 'u');
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
throw new TypeError(`risk rule pattern ${JSON.stringify(rule.pattern)} is not a valid regular expression: ${String(error)}`);
|
|
118
|
+
}
|
|
119
|
+
return { pattern: rule.pattern, regex, policy: rule.policy, field: rule.field ?? 'reason' };
|
|
120
|
+
});
|
|
121
|
+
return {
|
|
122
|
+
enableByDefault: config.enableByDefault ?? true,
|
|
123
|
+
toolsPolicy: {
|
|
124
|
+
default: config.toolsPolicy?.default ?? 'human',
|
|
125
|
+
overrides: config.toolsPolicy?.overrides ?? {},
|
|
126
|
+
},
|
|
127
|
+
riskRules,
|
|
128
|
+
reviewerProvider: config.reviewerProvider ?? 'fork',
|
|
129
|
+
reviewerModel: config.reviewerModel,
|
|
130
|
+
reviewerTimeoutMs: config.reviewerTimeoutMs ?? 60_000,
|
|
131
|
+
reviewerTools,
|
|
132
|
+
fallbackPolicy: config.fallbackPolicy ?? 'rejected',
|
|
133
|
+
maxReviewsPerTurn: config.maxReviewsPerTurn ?? 10,
|
|
134
|
+
maxFailuresPerTurn: config.maxFailuresPerTurn ?? config.maxReviewsPerTurn ?? 10,
|
|
135
|
+
reasonMaxChars: config.reasonMaxChars ?? 2000,
|
|
136
|
+
reviewerGuidance: config.reviewerGuidance,
|
|
137
|
+
reviewerPolicyText: config.reviewerPolicyText,
|
|
138
|
+
denyGuidance: config.denyGuidance ?? DEFAULT_DENY_GUIDANCE,
|
|
139
|
+
contextBudget: { turns, maxChars: contextChars },
|
|
140
|
+
riskPolicy: {
|
|
141
|
+
maxAutoAllow: config.riskPolicy?.maxAutoAllow ?? 'high',
|
|
142
|
+
onHighRisk: config.riskPolicy?.onHighRisk ?? 'delegate',
|
|
143
|
+
},
|
|
144
|
+
circuitBreaker: {
|
|
145
|
+
consecutiveDenies: breaker.consecutiveDenies ?? 3,
|
|
146
|
+
windowDenies: breaker.windowDenies ?? 6,
|
|
147
|
+
windowSize: breaker.windowSize ?? 10,
|
|
148
|
+
action: breaker.action ?? 'delegate',
|
|
149
|
+
},
|
|
150
|
+
overrideTtlMs: config.overrideTtlMs ?? 5 * 60_000,
|
|
151
|
+
language: config.language ?? 'en',
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAkBxC,4FAA4F;AAC5F,MAAM,CAAC,MAAM,UAAU,GAAyB,CAAC,KAAK,EAAE,QAAQ,EAAE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