@duke-dsh-plugins/dsh-agent-approval 1.7.2 → 1.8.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/README.md +18 -15
- package/client.js +240 -11
- package/cordis.patch.yml +12 -6
- package/index.js +1003 -59
- package/package.json +2 -2
- package/typert.host.js +105 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duke-dsh-plugins/dsh-agent-approval",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Agent-decided approvals for DeepSeek Harness:
|
|
3
|
+
"version": "1.8.0",
|
|
4
|
+
"description": "Agent-decided approvals for DeepSeek Harness: an 自动审批 permission mode where every sandbox escalation is judged automatically (default judge: one direct LLM call with no subagent session; optional isolated judge subagent or the TypeSafe Jev decision model), plus an opt-in 自动审查 per-call review mode (Full access base; every tool call reviewed by the Jev judge before execution, risky calls rejected with no human fallback), with a configurable judge model and a per-session audit trail in the conversation window's 审批 tab.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/MoonlitDropOfBlood/dsh-agent-approval.git"
|
package/typert.host.js
CHANGED
|
@@ -42,6 +42,7 @@ const recordSchema = z
|
|
|
42
42
|
durationMs: z.number(),
|
|
43
43
|
childSessionId: z.string(),
|
|
44
44
|
rationale: z.string(),
|
|
45
|
+
mode: z.enum(["escalation", "review"]),
|
|
45
46
|
})
|
|
46
47
|
.readonly();
|
|
47
48
|
|
|
@@ -52,6 +53,9 @@ const modelRouteSchema = z
|
|
|
52
53
|
})
|
|
53
54
|
.readonly();
|
|
54
55
|
|
|
56
|
+
/** Judge invocation mode (v1.8.0): direct LLM stream call, or the spawn subagent. */
|
|
57
|
+
const judgeModeSchema = z.enum(["llm", "subagent"]);
|
|
58
|
+
|
|
55
59
|
const jevConfigSchema = z
|
|
56
60
|
.object({
|
|
57
61
|
apiKey: z.string(),
|
|
@@ -83,6 +87,9 @@ const ruleSchema = z
|
|
|
83
87
|
const stateValueSchema = z
|
|
84
88
|
.object({
|
|
85
89
|
model: modelRouteSchema,
|
|
90
|
+
judgeMode: judgeModeSchema,
|
|
91
|
+
reviewAvailable: z.boolean(),
|
|
92
|
+
reviewDefault: z.boolean(),
|
|
86
93
|
jev: jevConfigSchema,
|
|
87
94
|
timeoutMs: z.number(),
|
|
88
95
|
enabledSessions: z.array(enabledSessionSchema).readonly(),
|
|
@@ -96,6 +103,18 @@ const setModelValueSchema = z
|
|
|
96
103
|
})
|
|
97
104
|
.readonly();
|
|
98
105
|
|
|
106
|
+
const setJudgeModeValueSchema = z
|
|
107
|
+
.object({
|
|
108
|
+
judgeMode: judgeModeSchema,
|
|
109
|
+
})
|
|
110
|
+
.readonly();
|
|
111
|
+
|
|
112
|
+
const setReviewDefaultValueSchema = z
|
|
113
|
+
.object({
|
|
114
|
+
reviewDefault: z.boolean(),
|
|
115
|
+
})
|
|
116
|
+
.readonly();
|
|
117
|
+
|
|
99
118
|
const setJevValueSchema = z
|
|
100
119
|
.object({
|
|
101
120
|
jev: jevConfigSchema,
|
|
@@ -179,6 +198,8 @@ function okResult(valueSchema) {
|
|
|
179
198
|
|
|
180
199
|
const stateResultSchema = okResult(stateValueSchema);
|
|
181
200
|
const setModelResultSchema = okResult(setModelValueSchema);
|
|
201
|
+
const setJudgeModeResultSchema = okResult(setJudgeModeValueSchema);
|
|
202
|
+
const setReviewDefaultResultSchema = okResult(setReviewDefaultValueSchema);
|
|
182
203
|
const setJevResultSchema = okResult(setJevValueSchema);
|
|
183
204
|
const setTimeoutResultSchema = okResult(setTimeoutValueSchema);
|
|
184
205
|
const toggleResultSchema = okResult(toggleValueSchema);
|
|
@@ -194,6 +215,14 @@ const _agentApproval_setModel_parameter_0$schema = z.object({
|
|
|
194
215
|
model: z.string(),
|
|
195
216
|
});
|
|
196
217
|
|
|
218
|
+
const _agentApproval_setJudgeMode_parameter_0$schema = z.object({
|
|
219
|
+
mode: judgeModeSchema,
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
const _agentApproval_setReviewDefault_parameter_0$schema = z.object({
|
|
223
|
+
on: z.boolean(),
|
|
224
|
+
});
|
|
225
|
+
|
|
197
226
|
const _agentApproval_setJevConfig_parameter_0$schema = z.object({
|
|
198
227
|
apiKey: z.string(),
|
|
199
228
|
endpoint: z.string(),
|
|
@@ -272,6 +301,60 @@ export const TYPERT = {
|
|
|
272
301
|
},
|
|
273
302
|
sourceLocation: { file: "index.js", line: 1, column: 1 },
|
|
274
303
|
},
|
|
304
|
+
{
|
|
305
|
+
id: "dsh-agent-approval#agentApproval/setJudgeMode",
|
|
306
|
+
service: "agentApproval",
|
|
307
|
+
namespace: "agentApproval",
|
|
308
|
+
method: "setJudgeMode",
|
|
309
|
+
invocation: { kind: "direct" },
|
|
310
|
+
parameters: [
|
|
311
|
+
{
|
|
312
|
+
name: "request",
|
|
313
|
+
wire: "request",
|
|
314
|
+
source: "json",
|
|
315
|
+
codec: {
|
|
316
|
+
mode: "strict",
|
|
317
|
+
typeSymbol: "dsh-agent-approval#AgentApprovalSetJudgeModeRequest",
|
|
318
|
+
schema: _agentApproval_setJudgeMode_parameter_0$schema,
|
|
319
|
+
create: () => _agentApproval_setJudgeMode_parameter_0$schema,
|
|
320
|
+
},
|
|
321
|
+
},
|
|
322
|
+
],
|
|
323
|
+
result: {
|
|
324
|
+
mode: "strict",
|
|
325
|
+
typeSymbol: "dsh-agent-approval#AgentApprovalSetJudgeModeResult",
|
|
326
|
+
schema: setJudgeModeResultSchema,
|
|
327
|
+
create: () => setJudgeModeResultSchema,
|
|
328
|
+
},
|
|
329
|
+
sourceLocation: { file: "index.js", line: 1, column: 1 },
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
id: "dsh-agent-approval#agentApproval/setReviewDefault",
|
|
333
|
+
service: "agentApproval",
|
|
334
|
+
namespace: "agentApproval",
|
|
335
|
+
method: "setReviewDefault",
|
|
336
|
+
invocation: { kind: "direct" },
|
|
337
|
+
parameters: [
|
|
338
|
+
{
|
|
339
|
+
name: "request",
|
|
340
|
+
wire: "request",
|
|
341
|
+
source: "json",
|
|
342
|
+
codec: {
|
|
343
|
+
mode: "strict",
|
|
344
|
+
typeSymbol: "dsh-agent-approval#AgentApprovalSetReviewDefaultRequest",
|
|
345
|
+
schema: _agentApproval_setReviewDefault_parameter_0$schema,
|
|
346
|
+
create: () => _agentApproval_setReviewDefault_parameter_0$schema,
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
],
|
|
350
|
+
result: {
|
|
351
|
+
mode: "strict",
|
|
352
|
+
typeSymbol: "dsh-agent-approval#AgentApprovalSetReviewDefaultResult",
|
|
353
|
+
schema: setReviewDefaultResultSchema,
|
|
354
|
+
create: () => setReviewDefaultResultSchema,
|
|
355
|
+
},
|
|
356
|
+
sourceLocation: { file: "index.js", line: 1, column: 1 },
|
|
357
|
+
},
|
|
275
358
|
{
|
|
276
359
|
id: "dsh-agent-approval#agentApproval/setJevConfig",
|
|
277
360
|
service: "agentApproval",
|
|
@@ -539,7 +622,7 @@ export const TYPERT = {
|
|
|
539
622
|
{
|
|
540
623
|
name: "AgentApprovalRecord",
|
|
541
624
|
declaration:
|
|
542
|
-
"export interface AgentApprovalRecord {\n readonly at: string;\n readonly sessionId: string;\n readonly toolName: string;\n readonly reason: string;\n readonly args: string;\n readonly outcome: 'allowed-once' | 'rejected' | 'cancelled' | 'unavailable';\n readonly riskLevel: string;\n readonly model: string;\n readonly durationMs: number;\n readonly childSessionId: string;\n readonly rationale: string;\n}",
|
|
625
|
+
"export interface AgentApprovalRecord {\n readonly at: string;\n readonly sessionId: string;\n readonly toolName: string;\n readonly reason: string;\n readonly args: string;\n readonly outcome: 'allowed-once' | 'rejected' | 'cancelled' | 'unavailable';\n readonly riskLevel: string;\n readonly model: string;\n readonly durationMs: number;\n readonly childSessionId: string;\n readonly rationale: string;\n readonly mode: 'escalation' | 'review';\n}",
|
|
543
626
|
},
|
|
544
627
|
{
|
|
545
628
|
name: "AgentApprovalModelRoute",
|
|
@@ -579,7 +662,27 @@ export const TYPERT = {
|
|
|
579
662
|
{
|
|
580
663
|
name: "AgentApprovalStateValue",
|
|
581
664
|
declaration:
|
|
582
|
-
"export interface AgentApprovalStateValue {\n readonly model: AgentApprovalModelRoute;\n readonly jev: AgentApprovalJevConfig;\n readonly timeoutMs: number;\n readonly enabledSessions: readonly AgentApprovalEnabledSession[];\n readonly rules: readonly AgentApprovalRule[];\n}",
|
|
665
|
+
"export interface AgentApprovalStateValue {\n readonly model: AgentApprovalModelRoute;\n readonly judgeMode: 'llm' | 'subagent';\n readonly reviewAvailable: boolean;\n readonly reviewDefault: boolean;\n readonly jev: AgentApprovalJevConfig;\n readonly timeoutMs: number;\n readonly enabledSessions: readonly AgentApprovalEnabledSession[];\n readonly rules: readonly AgentApprovalRule[];\n}",
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
name: "AgentApprovalSetReviewDefaultRequest",
|
|
669
|
+
declaration:
|
|
670
|
+
"export interface AgentApprovalSetReviewDefaultRequest {\n readonly on: boolean;\n}",
|
|
671
|
+
},
|
|
672
|
+
{
|
|
673
|
+
name: "AgentApprovalSetReviewDefaultResult",
|
|
674
|
+
declaration:
|
|
675
|
+
"export type AgentApprovalSetReviewDefaultResult = { ok: true; value: { readonly reviewDefault: boolean } } | { ok: false; error: { code: string; message?: string } };",
|
|
676
|
+
},
|
|
677
|
+
{
|
|
678
|
+
name: "AgentApprovalSetJudgeModeRequest",
|
|
679
|
+
declaration:
|
|
680
|
+
"export interface AgentApprovalSetJudgeModeRequest {\n readonly mode: 'llm' | 'subagent';\n}",
|
|
681
|
+
},
|
|
682
|
+
{
|
|
683
|
+
name: "AgentApprovalSetJudgeModeResult",
|
|
684
|
+
declaration:
|
|
685
|
+
"export type AgentApprovalSetJudgeModeResult = { ok: true; value: { readonly judgeMode: 'llm' | 'subagent' } } | { ok: false; error: { code: string; message?: string } };",
|
|
583
686
|
},
|
|
584
687
|
{
|
|
585
688
|
name: "AgentApprovalSessionRecordsRequest",
|