dsh-permission-rules 0.7.2 → 0.7.3
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 +19 -0
- package/README-es.md +16 -4
- package/README-hi.md +16 -4
- package/README-pt.md +16 -4
- package/README-zh.md +16 -4
- package/README.md +15 -4
- package/lib/client.js +24 -45
- package/lib/client.js.map +1 -1
- package/lib/index.js +13 -7
- package/lib/typert.host.js +24 -45
- package/lib/types/client/remote.d.ts +80 -19
- package/lib/types/client/remote.d.ts.map +1 -1
- package/lib/types/proxy.d.ts.map +1 -1
- package/lib/types/runtime.d.ts.map +1 -1
- package/lib/types/typert.host.d.ts +80 -19
- package/lib/types/typert.host.d.ts.map +1 -1
- package/lib/types/wire.d.ts +160 -38
- package/lib/types/wire.d.ts.map +1 -1
- package/package.json +15 -12
- package/src/proxy.ts +11 -2
- package/src/runtime.ts +8 -6
- package/src/wire.ts +20 -45
package/lib/types/wire.d.ts
CHANGED
|
@@ -215,8 +215,46 @@ export declare const NETWORK_STATUS_DESCRIPTOR: Readonly<{
|
|
|
215
215
|
}>;
|
|
216
216
|
readonly parameters: readonly never[];
|
|
217
217
|
readonly result: Readonly<{
|
|
218
|
+
create: () => z.ZodObject<{
|
|
219
|
+
enabled: z.ZodBoolean;
|
|
220
|
+
mode: z.ZodUnion<readonly [z.ZodLiteral<"deny-all">, z.ZodLiteral<"whitelist">, z.ZodLiteral<"allow-all">]>;
|
|
221
|
+
configuredMode: z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodLiteral<"deny-all">, z.ZodLiteral<"whitelist">, z.ZodLiteral<"allow-all">]>;
|
|
222
|
+
sandboxMode: z.ZodNullable<z.ZodString>;
|
|
223
|
+
proxyPort: z.ZodNumber;
|
|
224
|
+
proxyActive: z.ZodBoolean;
|
|
225
|
+
denied: z.ZodNumber;
|
|
226
|
+
askBlocked: z.ZodNumber;
|
|
227
|
+
recent: z.ZodArray<z.ZodObject<{
|
|
228
|
+
time: z.ZodNumber;
|
|
229
|
+
tool: z.ZodString;
|
|
230
|
+
attributed: z.ZodBoolean;
|
|
231
|
+
domain: z.ZodString;
|
|
232
|
+
scheme: z.ZodUnion<readonly [z.ZodLiteral<"http">, z.ZodLiteral<"https">, z.ZodNull]>;
|
|
233
|
+
port: z.ZodNullable<z.ZodNumber>;
|
|
234
|
+
action: z.ZodUnion<readonly [z.ZodLiteral<"deny">, z.ZodLiteral<"ask">]>;
|
|
235
|
+
mode: z.ZodUnion<readonly [z.ZodLiteral<"deny-all">, z.ZodLiteral<"whitelist">, z.ZodLiteral<"allow-all">]>;
|
|
236
|
+
matched: z.ZodBoolean;
|
|
237
|
+
source: z.ZodString;
|
|
238
|
+
ruleIndex: z.ZodNullable<z.ZodNumber>;
|
|
239
|
+
reason: z.ZodNullable<z.ZodString>;
|
|
240
|
+
cwd: z.ZodNullable<z.ZodString>;
|
|
241
|
+
}, z.core.$strip>>;
|
|
242
|
+
sources: z.ZodArray<z.ZodObject<{
|
|
243
|
+
path: z.ZodString;
|
|
244
|
+
exists: z.ZodBoolean;
|
|
245
|
+
cwd: z.ZodNullable<z.ZodString>;
|
|
246
|
+
}, z.core.$strip>>;
|
|
247
|
+
allowHostAction: z.ZodBoolean;
|
|
248
|
+
upstream: z.ZodObject<{
|
|
249
|
+
mode: z.ZodUnion<readonly [z.ZodLiteral<"off">, z.ZodLiteral<"inherit">, z.ZodLiteral<"url">]>;
|
|
250
|
+
http: z.ZodNullable<z.ZodString>;
|
|
251
|
+
https: z.ZodNullable<z.ZodString>;
|
|
252
|
+
active: z.ZodBoolean;
|
|
253
|
+
chained: z.ZodNumber;
|
|
254
|
+
}, z.core.$strip>;
|
|
255
|
+
}, z.core.$strip>;
|
|
218
256
|
mode: "strict";
|
|
219
|
-
typeSymbol:
|
|
257
|
+
typeSymbol: string;
|
|
220
258
|
schema: z.ZodObject<{
|
|
221
259
|
enabled: z.ZodBoolean;
|
|
222
260
|
mode: z.ZodUnion<readonly [z.ZodLiteral<"deny-all">, z.ZodLiteral<"whitelist">, z.ZodLiteral<"allow-all">]>;
|
|
@@ -276,14 +314,21 @@ export declare const RULES_READ_DESCRIPTOR: Readonly<{
|
|
|
276
314
|
wire: string;
|
|
277
315
|
source: "json";
|
|
278
316
|
codec: Readonly<{
|
|
317
|
+
create: () => z.ZodString;
|
|
279
318
|
mode: "strict";
|
|
280
|
-
typeSymbol:
|
|
319
|
+
typeSymbol: string;
|
|
281
320
|
schema: z.ZodString;
|
|
282
321
|
}>;
|
|
283
322
|
}>[];
|
|
284
323
|
readonly result: Readonly<{
|
|
324
|
+
create: () => z.ZodObject<{
|
|
325
|
+
path: z.ZodString;
|
|
326
|
+
exists: z.ZodBoolean;
|
|
327
|
+
text: z.ZodString;
|
|
328
|
+
error: z.ZodNullable<z.ZodString>;
|
|
329
|
+
}, z.core.$strip>;
|
|
285
330
|
mode: "strict";
|
|
286
|
-
typeSymbol:
|
|
331
|
+
typeSymbol: string;
|
|
287
332
|
schema: z.ZodObject<{
|
|
288
333
|
path: z.ZodString;
|
|
289
334
|
exists: z.ZodBoolean;
|
|
@@ -306,28 +351,25 @@ export declare const RULES_SAVE_DESCRIPTOR: Readonly<{
|
|
|
306
351
|
readonly invocation: Readonly<{
|
|
307
352
|
kind: "direct";
|
|
308
353
|
}>;
|
|
309
|
-
readonly parameters: readonly
|
|
310
|
-
name: string;
|
|
311
|
-
wire: string;
|
|
312
|
-
source: "json";
|
|
313
|
-
codec: Readonly<{
|
|
314
|
-
mode: "strict";
|
|
315
|
-
typeSymbol: "dsh-permission-rules/types#RulesSaveRequestPath";
|
|
316
|
-
schema: z.ZodString;
|
|
317
|
-
}>;
|
|
318
|
-
}> | Readonly<{
|
|
354
|
+
readonly parameters: readonly Readonly<{
|
|
319
355
|
name: string;
|
|
320
356
|
wire: string;
|
|
321
357
|
source: "json";
|
|
322
358
|
codec: Readonly<{
|
|
359
|
+
create: () => z.ZodString;
|
|
323
360
|
mode: "strict";
|
|
324
|
-
typeSymbol:
|
|
361
|
+
typeSymbol: string;
|
|
325
362
|
schema: z.ZodString;
|
|
326
363
|
}>;
|
|
327
|
-
}>
|
|
364
|
+
}>[];
|
|
328
365
|
readonly result: Readonly<{
|
|
366
|
+
create: () => z.ZodObject<{
|
|
367
|
+
ok: z.ZodBoolean;
|
|
368
|
+
error: z.ZodNullable<z.ZodString>;
|
|
369
|
+
reloaded: z.ZodNullable<z.ZodNumber>;
|
|
370
|
+
}, z.core.$strip>;
|
|
329
371
|
mode: "strict";
|
|
330
|
-
typeSymbol:
|
|
372
|
+
typeSymbol: string;
|
|
331
373
|
schema: z.ZodObject<{
|
|
332
374
|
ok: z.ZodBoolean;
|
|
333
375
|
error: z.ZodNullable<z.ZodString>;
|
|
@@ -351,8 +393,12 @@ export declare const RULES_RELOAD_DESCRIPTOR: Readonly<{
|
|
|
351
393
|
}>;
|
|
352
394
|
readonly parameters: readonly never[];
|
|
353
395
|
readonly result: Readonly<{
|
|
396
|
+
create: () => z.ZodObject<{
|
|
397
|
+
ok: z.ZodBoolean;
|
|
398
|
+
error: z.ZodNullable<z.ZodString>;
|
|
399
|
+
}, z.core.$strip>;
|
|
354
400
|
mode: "strict";
|
|
355
|
-
typeSymbol:
|
|
401
|
+
typeSymbol: string;
|
|
356
402
|
schema: z.ZodObject<{
|
|
357
403
|
ok: z.ZodBoolean;
|
|
358
404
|
error: z.ZodNullable<z.ZodString>;
|
|
@@ -381,8 +427,14 @@ export declare const ALLOW_HOST_DESCRIPTOR: Readonly<{
|
|
|
381
427
|
wire: string;
|
|
382
428
|
source: "json";
|
|
383
429
|
codec: Readonly<{
|
|
430
|
+
create: () => z.ZodObject<{
|
|
431
|
+
host: z.ZodString;
|
|
432
|
+
scheme: z.ZodUnion<readonly [z.ZodLiteral<"http">, z.ZodLiteral<"https">, z.ZodNull]>;
|
|
433
|
+
port: z.ZodNullable<z.ZodNumber>;
|
|
434
|
+
cwd: z.ZodNullable<z.ZodString>;
|
|
435
|
+
}, z.core.$strip>;
|
|
384
436
|
mode: "strict";
|
|
385
|
-
typeSymbol:
|
|
437
|
+
typeSymbol: string;
|
|
386
438
|
schema: z.ZodObject<{
|
|
387
439
|
host: z.ZodString;
|
|
388
440
|
scheme: z.ZodUnion<readonly [z.ZodLiteral<"http">, z.ZodLiteral<"https">, z.ZodNull]>;
|
|
@@ -392,8 +444,17 @@ export declare const ALLOW_HOST_DESCRIPTOR: Readonly<{
|
|
|
392
444
|
}>;
|
|
393
445
|
}>[];
|
|
394
446
|
readonly result: Readonly<{
|
|
447
|
+
create: () => z.ZodObject<{
|
|
448
|
+
ok: z.ZodBoolean;
|
|
449
|
+
path: z.ZodNullable<z.ZodString>;
|
|
450
|
+
created: z.ZodBoolean;
|
|
451
|
+
reloaded: z.ZodNumber;
|
|
452
|
+
outcome: z.ZodUnion<readonly [z.ZodLiteral<"allow">, z.ZodLiteral<"deny">, z.ZodLiteral<"ask">, z.ZodNull]>;
|
|
453
|
+
alreadyAllowed: z.ZodBoolean;
|
|
454
|
+
error: z.ZodNullable<z.ZodString>;
|
|
455
|
+
}, z.core.$strip>;
|
|
395
456
|
mode: "strict";
|
|
396
|
-
typeSymbol:
|
|
457
|
+
typeSymbol: string;
|
|
397
458
|
schema: z.ZodObject<{
|
|
398
459
|
ok: z.ZodBoolean;
|
|
399
460
|
path: z.ZodNullable<z.ZodString>;
|
|
@@ -425,8 +486,46 @@ export declare const PERMISSION_RULES_INVOCATIONS: readonly (Readonly<{
|
|
|
425
486
|
}>;
|
|
426
487
|
readonly parameters: readonly never[];
|
|
427
488
|
readonly result: Readonly<{
|
|
489
|
+
create: () => z.ZodObject<{
|
|
490
|
+
enabled: z.ZodBoolean;
|
|
491
|
+
mode: z.ZodUnion<readonly [z.ZodLiteral<"deny-all">, z.ZodLiteral<"whitelist">, z.ZodLiteral<"allow-all">]>;
|
|
492
|
+
configuredMode: z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodLiteral<"deny-all">, z.ZodLiteral<"whitelist">, z.ZodLiteral<"allow-all">]>;
|
|
493
|
+
sandboxMode: z.ZodNullable<z.ZodString>;
|
|
494
|
+
proxyPort: z.ZodNumber;
|
|
495
|
+
proxyActive: z.ZodBoolean;
|
|
496
|
+
denied: z.ZodNumber;
|
|
497
|
+
askBlocked: z.ZodNumber;
|
|
498
|
+
recent: z.ZodArray<z.ZodObject<{
|
|
499
|
+
time: z.ZodNumber;
|
|
500
|
+
tool: z.ZodString;
|
|
501
|
+
attributed: z.ZodBoolean;
|
|
502
|
+
domain: z.ZodString;
|
|
503
|
+
scheme: z.ZodUnion<readonly [z.ZodLiteral<"http">, z.ZodLiteral<"https">, z.ZodNull]>;
|
|
504
|
+
port: z.ZodNullable<z.ZodNumber>;
|
|
505
|
+
action: z.ZodUnion<readonly [z.ZodLiteral<"deny">, z.ZodLiteral<"ask">]>;
|
|
506
|
+
mode: z.ZodUnion<readonly [z.ZodLiteral<"deny-all">, z.ZodLiteral<"whitelist">, z.ZodLiteral<"allow-all">]>;
|
|
507
|
+
matched: z.ZodBoolean;
|
|
508
|
+
source: z.ZodString;
|
|
509
|
+
ruleIndex: z.ZodNullable<z.ZodNumber>;
|
|
510
|
+
reason: z.ZodNullable<z.ZodString>;
|
|
511
|
+
cwd: z.ZodNullable<z.ZodString>;
|
|
512
|
+
}, z.core.$strip>>;
|
|
513
|
+
sources: z.ZodArray<z.ZodObject<{
|
|
514
|
+
path: z.ZodString;
|
|
515
|
+
exists: z.ZodBoolean;
|
|
516
|
+
cwd: z.ZodNullable<z.ZodString>;
|
|
517
|
+
}, z.core.$strip>>;
|
|
518
|
+
allowHostAction: z.ZodBoolean;
|
|
519
|
+
upstream: z.ZodObject<{
|
|
520
|
+
mode: z.ZodUnion<readonly [z.ZodLiteral<"off">, z.ZodLiteral<"inherit">, z.ZodLiteral<"url">]>;
|
|
521
|
+
http: z.ZodNullable<z.ZodString>;
|
|
522
|
+
https: z.ZodNullable<z.ZodString>;
|
|
523
|
+
active: z.ZodBoolean;
|
|
524
|
+
chained: z.ZodNumber;
|
|
525
|
+
}, z.core.$strip>;
|
|
526
|
+
}, z.core.$strip>;
|
|
428
527
|
mode: "strict";
|
|
429
|
-
typeSymbol:
|
|
528
|
+
typeSymbol: string;
|
|
430
529
|
schema: z.ZodObject<{
|
|
431
530
|
enabled: z.ZodBoolean;
|
|
432
531
|
mode: z.ZodUnion<readonly [z.ZodLiteral<"deny-all">, z.ZodLiteral<"whitelist">, z.ZodLiteral<"allow-all">]>;
|
|
@@ -484,14 +583,21 @@ export declare const PERMISSION_RULES_INVOCATIONS: readonly (Readonly<{
|
|
|
484
583
|
wire: string;
|
|
485
584
|
source: "json";
|
|
486
585
|
codec: Readonly<{
|
|
586
|
+
create: () => z.ZodString;
|
|
487
587
|
mode: "strict";
|
|
488
|
-
typeSymbol:
|
|
588
|
+
typeSymbol: string;
|
|
489
589
|
schema: z.ZodString;
|
|
490
590
|
}>;
|
|
491
591
|
}>[];
|
|
492
592
|
readonly result: Readonly<{
|
|
593
|
+
create: () => z.ZodObject<{
|
|
594
|
+
path: z.ZodString;
|
|
595
|
+
exists: z.ZodBoolean;
|
|
596
|
+
text: z.ZodString;
|
|
597
|
+
error: z.ZodNullable<z.ZodString>;
|
|
598
|
+
}, z.core.$strip>;
|
|
493
599
|
mode: "strict";
|
|
494
|
-
typeSymbol:
|
|
600
|
+
typeSymbol: string;
|
|
495
601
|
schema: z.ZodObject<{
|
|
496
602
|
path: z.ZodString;
|
|
497
603
|
exists: z.ZodBoolean;
|
|
@@ -512,28 +618,25 @@ export declare const PERMISSION_RULES_INVOCATIONS: readonly (Readonly<{
|
|
|
512
618
|
readonly invocation: Readonly<{
|
|
513
619
|
kind: "direct";
|
|
514
620
|
}>;
|
|
515
|
-
readonly parameters: readonly
|
|
516
|
-
name: string;
|
|
517
|
-
wire: string;
|
|
518
|
-
source: "json";
|
|
519
|
-
codec: Readonly<{
|
|
520
|
-
mode: "strict";
|
|
521
|
-
typeSymbol: "dsh-permission-rules/types#RulesSaveRequestPath";
|
|
522
|
-
schema: z.ZodString;
|
|
523
|
-
}>;
|
|
524
|
-
}> | Readonly<{
|
|
621
|
+
readonly parameters: readonly Readonly<{
|
|
525
622
|
name: string;
|
|
526
623
|
wire: string;
|
|
527
624
|
source: "json";
|
|
528
625
|
codec: Readonly<{
|
|
626
|
+
create: () => z.ZodString;
|
|
529
627
|
mode: "strict";
|
|
530
|
-
typeSymbol:
|
|
628
|
+
typeSymbol: string;
|
|
531
629
|
schema: z.ZodString;
|
|
532
630
|
}>;
|
|
533
|
-
}>
|
|
631
|
+
}>[];
|
|
534
632
|
readonly result: Readonly<{
|
|
633
|
+
create: () => z.ZodObject<{
|
|
634
|
+
ok: z.ZodBoolean;
|
|
635
|
+
error: z.ZodNullable<z.ZodString>;
|
|
636
|
+
reloaded: z.ZodNullable<z.ZodNumber>;
|
|
637
|
+
}, z.core.$strip>;
|
|
535
638
|
mode: "strict";
|
|
536
|
-
typeSymbol:
|
|
639
|
+
typeSymbol: string;
|
|
537
640
|
schema: z.ZodObject<{
|
|
538
641
|
ok: z.ZodBoolean;
|
|
539
642
|
error: z.ZodNullable<z.ZodString>;
|
|
@@ -555,8 +658,12 @@ export declare const PERMISSION_RULES_INVOCATIONS: readonly (Readonly<{
|
|
|
555
658
|
}>;
|
|
556
659
|
readonly parameters: readonly never[];
|
|
557
660
|
readonly result: Readonly<{
|
|
661
|
+
create: () => z.ZodObject<{
|
|
662
|
+
ok: z.ZodBoolean;
|
|
663
|
+
error: z.ZodNullable<z.ZodString>;
|
|
664
|
+
}, z.core.$strip>;
|
|
558
665
|
mode: "strict";
|
|
559
|
-
typeSymbol:
|
|
666
|
+
typeSymbol: string;
|
|
560
667
|
schema: z.ZodObject<{
|
|
561
668
|
ok: z.ZodBoolean;
|
|
562
669
|
error: z.ZodNullable<z.ZodString>;
|
|
@@ -580,8 +687,14 @@ export declare const PERMISSION_RULES_INVOCATIONS: readonly (Readonly<{
|
|
|
580
687
|
wire: string;
|
|
581
688
|
source: "json";
|
|
582
689
|
codec: Readonly<{
|
|
690
|
+
create: () => z.ZodObject<{
|
|
691
|
+
host: z.ZodString;
|
|
692
|
+
scheme: z.ZodUnion<readonly [z.ZodLiteral<"http">, z.ZodLiteral<"https">, z.ZodNull]>;
|
|
693
|
+
port: z.ZodNullable<z.ZodNumber>;
|
|
694
|
+
cwd: z.ZodNullable<z.ZodString>;
|
|
695
|
+
}, z.core.$strip>;
|
|
583
696
|
mode: "strict";
|
|
584
|
-
typeSymbol:
|
|
697
|
+
typeSymbol: string;
|
|
585
698
|
schema: z.ZodObject<{
|
|
586
699
|
host: z.ZodString;
|
|
587
700
|
scheme: z.ZodUnion<readonly [z.ZodLiteral<"http">, z.ZodLiteral<"https">, z.ZodNull]>;
|
|
@@ -591,8 +704,17 @@ export declare const PERMISSION_RULES_INVOCATIONS: readonly (Readonly<{
|
|
|
591
704
|
}>;
|
|
592
705
|
}>[];
|
|
593
706
|
readonly result: Readonly<{
|
|
707
|
+
create: () => z.ZodObject<{
|
|
708
|
+
ok: z.ZodBoolean;
|
|
709
|
+
path: z.ZodNullable<z.ZodString>;
|
|
710
|
+
created: z.ZodBoolean;
|
|
711
|
+
reloaded: z.ZodNumber;
|
|
712
|
+
outcome: z.ZodUnion<readonly [z.ZodLiteral<"allow">, z.ZodLiteral<"deny">, z.ZodLiteral<"ask">, z.ZodNull]>;
|
|
713
|
+
alreadyAllowed: z.ZodBoolean;
|
|
714
|
+
error: z.ZodNullable<z.ZodString>;
|
|
715
|
+
}, z.core.$strip>;
|
|
594
716
|
mode: "strict";
|
|
595
|
-
typeSymbol:
|
|
717
|
+
typeSymbol: string;
|
|
596
718
|
schema: z.ZodObject<{
|
|
597
719
|
ok: z.ZodBoolean;
|
|
598
720
|
path: z.ZodNullable<z.ZodString>;
|
package/lib/types/wire.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../../src/wire.ts"],"names":[],"mappings":"AAAA;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MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;EASM,CAAA;AAE1C;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAcQ,CAAA;AAE1C;;;;GAIG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAMvC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-permission-rules",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"description": "Declarative Claude Code-style permission rules plus a Codex-style process-level network policy for DeepSeek Harness: ordered allow/deny/ask rules with tool-name, argument (glob/regex), workspace-path, and network-target (domain/ip/port/scheme) matching on the tools/pre-execute waterfall, a built-in local HTTP/CONNECT proxy governing shell subprocess traffic, three network modes mapped onto the official sandbox presets, full session-log audit, HMR rule reload, and a settings page with a rule editor, block counters, and recent interception lists.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
],
|
|
39
39
|
"sideEffects": false,
|
|
40
40
|
"dsh": {
|
|
41
|
+
"manifestVersion": 1,
|
|
41
42
|
"bundle": {
|
|
42
43
|
"patch": "./cordis.patch.yml"
|
|
43
44
|
},
|
|
@@ -114,22 +115,23 @@
|
|
|
114
115
|
"url": "https://github.com/PerryLink/dsh-permission-rules/issues"
|
|
115
116
|
},
|
|
116
117
|
"engines": {
|
|
117
|
-
"node": "^22.19.0 || >=24.0.0"
|
|
118
|
+
"node": "^22.19.0 || >=24.0.0",
|
|
119
|
+
"dsh": ">=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0 || >=0.1.6-0 <0.2.0"
|
|
118
120
|
},
|
|
119
121
|
"peerDependencies": {
|
|
120
122
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
121
|
-
"@deepseek-ai/dsh-agent": ">=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0",
|
|
122
|
-
"@deepseek-ai/dsh-commands": ">=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0",
|
|
123
|
-
"@deepseek-ai/dsh-llm": ">=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0",
|
|
124
|
-
"@deepseek-ai/dsh-session": ">=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0",
|
|
125
|
-
"@deepseek-ai/dsh-tools": ">=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0",
|
|
126
|
-
"@deepseek-ai/dsh-typert-protocol": ">=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0",
|
|
123
|
+
"@deepseek-ai/dsh-agent": ">=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0 || >=0.1.6-0 <0.2.0",
|
|
124
|
+
"@deepseek-ai/dsh-commands": ">=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0 || >=0.1.6-0 <0.2.0",
|
|
125
|
+
"@deepseek-ai/dsh-llm": ">=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0 || >=0.1.6-0 <0.2.0",
|
|
126
|
+
"@deepseek-ai/dsh-session": ">=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0 || >=0.1.6-0 <0.2.0",
|
|
127
|
+
"@deepseek-ai/dsh-tools": ">=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0 || >=0.1.6-0 <0.2.0",
|
|
128
|
+
"@deepseek-ai/dsh-typert-protocol": ">=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0 || >=0.1.6-0 <0.2.0",
|
|
127
129
|
"@deepseek-ai/schemastery": "^3.18.2",
|
|
128
130
|
"react": "^18.2.0",
|
|
129
|
-
"@deepseek-ai/dsh-client-connection": ">=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0",
|
|
130
|
-
"@deepseek-ai/dsh-client-locale": ">=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0",
|
|
131
|
-
"@deepseek-ai/dsh-client-ui-settings": ">=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0",
|
|
132
|
-
"@deepseek-ai/dsh-client-web": ">=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0"
|
|
131
|
+
"@deepseek-ai/dsh-client-connection": ">=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0 || >=0.1.6-0 <0.2.0",
|
|
132
|
+
"@deepseek-ai/dsh-client-locale": ">=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0 || >=0.1.6-0 <0.2.0",
|
|
133
|
+
"@deepseek-ai/dsh-client-ui-settings": ">=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0 || >=0.1.6-0 <0.2.0",
|
|
134
|
+
"@deepseek-ai/dsh-client-web": ">=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0 || >=0.1.6-0 <0.2.0"
|
|
133
135
|
},
|
|
134
136
|
"peerDependenciesMeta": {
|
|
135
137
|
"@deepseek-ai/dsh-client-connection": {
|
|
@@ -189,6 +191,7 @@
|
|
|
189
191
|
"scripts": {
|
|
190
192
|
"build": "node scripts/prepare.mjs",
|
|
191
193
|
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json --noEmit",
|
|
194
|
+
"typecheck:ci": "tsc -p tsconfig.ci.json --noEmit",
|
|
192
195
|
"lint": "eslint src test scripts",
|
|
193
196
|
"test": "vitest run",
|
|
194
197
|
"test:coverage": "vitest run --coverage",
|
package/src/proxy.ts
CHANGED
|
@@ -342,12 +342,21 @@ export class NetworkProxy {
|
|
|
342
342
|
// The forwarded connection is pinned to the addresses the decision was
|
|
343
343
|
// made on, so a hostname that re-resolves between adjudication and
|
|
344
344
|
// connect (DNS rebinding) cannot reach an address the rules never
|
|
345
|
-
// approved.
|
|
345
|
+
// approved. An allow decision with NO adjudicated address (the name
|
|
346
|
+
// failed to resolve during adjudication) fails closed here — issue #23:
|
|
347
|
+
// dialing the name would be a second resolution whose answer the rules
|
|
348
|
+
// never saw, the same invariant connectUpstream enforces for CONNECT.
|
|
346
349
|
const pinned = pinnedAddresses(adjudicated)
|
|
350
|
+
if (pinned.length === 0) {
|
|
351
|
+
this.options.logger.warn(`permission-rules: plain-HTTP upstream refused: no adjudicated address for ${adjudicated.host}`)
|
|
352
|
+
res.writeHead(502, { 'content-type': 'text/plain; charset=utf-8' })
|
|
353
|
+
res.end(`[network: upstream error] no adjudicated address for ${adjudicated.host}\n`)
|
|
354
|
+
return
|
|
355
|
+
}
|
|
347
356
|
const options: RequestOptions = {
|
|
348
357
|
method: req.method,
|
|
349
358
|
headers: req.headers,
|
|
350
|
-
|
|
359
|
+
lookup: pinnedLookup(pinned),
|
|
351
360
|
}
|
|
352
361
|
proxyReq = (upstream.protocol === 'https:' ? httpsRequest : httpRequest)(upstream, options, onResponse)
|
|
353
362
|
} else {
|
package/src/runtime.ts
CHANGED
|
@@ -1653,6 +1653,14 @@ export async function apply(ctx: Context, config: Config): Promise<void> {
|
|
|
1653
1653
|
return next()
|
|
1654
1654
|
})
|
|
1655
1655
|
attachSettingsSection(ctx, runtime, config)
|
|
1656
|
+
// Register before the first await (A02 T10): an uninstall landing while
|
|
1657
|
+
// attachNetworkProxy() is pending would otherwise lose the /rules command.
|
|
1658
|
+
ctx.commands.register({
|
|
1659
|
+
name: 'rules',
|
|
1660
|
+
description: 'list, reload, audit, dry-test, or inspect the network policy of the active permission rules for this workspace',
|
|
1661
|
+
input: { hint: '[list | reload | network | decisions [n] | test [--cwd <dir>] [--env K=V] [--agent <sel>] [--platform <name>] <tool> <json-args>]' },
|
|
1662
|
+
handler: invocation => runtime.command(invocation),
|
|
1663
|
+
})
|
|
1656
1664
|
if (resolved.network.enabled) await runtime.attachNetworkProxy()
|
|
1657
1665
|
ctx.inject(['systemPrompt'], (scope) => {
|
|
1658
1666
|
const systemPrompt = scope.get('systemPrompt') as { context?: (entry: { name: string; order?: number; text: string }) => void } | undefined
|
|
@@ -1664,12 +1672,6 @@ export async function apply(ctx: Context, config: Config): Promise<void> {
|
|
|
1664
1672
|
})
|
|
1665
1673
|
})
|
|
1666
1674
|
await ctx.plugin(PermissionRulesRemoteService, { runtime })
|
|
1667
|
-
ctx.commands.register({
|
|
1668
|
-
name: 'rules',
|
|
1669
|
-
description: 'list, reload, audit, dry-test, or inspect the network policy of the active permission rules for this workspace',
|
|
1670
|
-
input: { hint: '[list | reload | network | decisions [n] | test [--cwd <dir>] [--env K=V] [--agent <sel>] [--platform <name>] <tool> <json-args>]' },
|
|
1671
|
-
handler: invocation => runtime.command(invocation),
|
|
1672
|
-
})
|
|
1673
1675
|
}
|
|
1674
1676
|
|
|
1675
1677
|
/**
|
package/src/wire.ts
CHANGED
|
@@ -11,6 +11,17 @@
|
|
|
11
11
|
import { z } from 'zod'
|
|
12
12
|
import type { InvocationDescriptor } from '@deepseek-ai/dsh-typert-protocol'
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Strict wire codec carrying BOTH published and checkout faces: the `schema`
|
|
16
|
+
* field feeds the npm-published 0.1.5-rc.2 line, while `create` feeds the
|
|
17
|
+
* 0.1.6-alpha.2+ line, whose typert-loader requires the factory on every
|
|
18
|
+
* codec and materializes schemas lazily on first use. Built through a
|
|
19
|
+
* variable, so neither typecheck ruler flags the other face's field as excess.
|
|
20
|
+
*/
|
|
21
|
+
function strictWire<T>(typeSymbol: string, schema: T) {
|
|
22
|
+
return Object.freeze({ ...{ mode: 'strict' as const, typeSymbol, schema }, create: () => schema })
|
|
23
|
+
}
|
|
24
|
+
|
|
14
25
|
/** The three network policy modes (wire vocabulary). */
|
|
15
26
|
export type NetworkModeWire = 'deny-all' | 'whitelist' | 'allow-all'
|
|
16
27
|
|
|
@@ -230,11 +241,7 @@ export const NETWORK_STATUS_DESCRIPTOR = Object.freeze({
|
|
|
230
241
|
method: 'networkStatus',
|
|
231
242
|
invocation: Object.freeze({ kind: 'direct' }),
|
|
232
243
|
parameters: Object.freeze([]),
|
|
233
|
-
result:
|
|
234
|
-
mode: 'strict',
|
|
235
|
-
typeSymbol: 'dsh-permission-rules/types#PermissionRulesSnapshot',
|
|
236
|
-
schema: PERMISSION_RULES_SNAPSHOT_SCHEMA,
|
|
237
|
-
}),
|
|
244
|
+
result: strictWire('dsh-permission-rules/types#PermissionRulesSnapshot', PERMISSION_RULES_SNAPSHOT_SCHEMA),
|
|
238
245
|
sourceLocation: Object.freeze({ file: 'src/wire.ts', line: 1, column: 1 }),
|
|
239
246
|
} as const) satisfies InvocationDescriptor
|
|
240
247
|
|
|
@@ -249,17 +256,9 @@ export const RULES_READ_DESCRIPTOR = Object.freeze({
|
|
|
249
256
|
name: 'path',
|
|
250
257
|
wire: 'path',
|
|
251
258
|
source: 'json',
|
|
252
|
-
codec:
|
|
253
|
-
mode: 'strict',
|
|
254
|
-
typeSymbol: 'dsh-permission-rules/types#RulesReadRequestPath',
|
|
255
|
-
schema: z.string(),
|
|
256
|
-
}),
|
|
259
|
+
codec: strictWire('dsh-permission-rules/types#RulesReadRequestPath', z.string()),
|
|
257
260
|
} satisfies InvocationDescriptor['parameters'][number])]),
|
|
258
|
-
result:
|
|
259
|
-
mode: 'strict',
|
|
260
|
-
typeSymbol: 'dsh-permission-rules/types#RulesReadResult',
|
|
261
|
-
schema: RULES_READ_SCHEMA,
|
|
262
|
-
}),
|
|
261
|
+
result: strictWire('dsh-permission-rules/types#RulesReadResult', RULES_READ_SCHEMA),
|
|
263
262
|
sourceLocation: Object.freeze({ file: 'src/wire.ts', line: 1, column: 1 }),
|
|
264
263
|
} as const) satisfies InvocationDescriptor
|
|
265
264
|
|
|
@@ -275,28 +274,16 @@ export const RULES_SAVE_DESCRIPTOR = Object.freeze({
|
|
|
275
274
|
name: 'path',
|
|
276
275
|
wire: 'path',
|
|
277
276
|
source: 'json',
|
|
278
|
-
codec:
|
|
279
|
-
mode: 'strict',
|
|
280
|
-
typeSymbol: 'dsh-permission-rules/types#RulesSaveRequestPath',
|
|
281
|
-
schema: z.string(),
|
|
282
|
-
}),
|
|
277
|
+
codec: strictWire('dsh-permission-rules/types#RulesSaveRequestPath', z.string()),
|
|
283
278
|
} satisfies InvocationDescriptor['parameters'][number]),
|
|
284
279
|
Object.freeze({
|
|
285
280
|
name: 'text',
|
|
286
281
|
wire: 'text',
|
|
287
282
|
source: 'json',
|
|
288
|
-
codec:
|
|
289
|
-
mode: 'strict',
|
|
290
|
-
typeSymbol: 'dsh-permission-rules/types#RulesSaveRequestText',
|
|
291
|
-
schema: z.string(),
|
|
292
|
-
}),
|
|
283
|
+
codec: strictWire('dsh-permission-rules/types#RulesSaveRequestText', z.string()),
|
|
293
284
|
} satisfies InvocationDescriptor['parameters'][number]),
|
|
294
285
|
]),
|
|
295
|
-
result:
|
|
296
|
-
mode: 'strict',
|
|
297
|
-
typeSymbol: 'dsh-permission-rules/types#RulesSaveResult',
|
|
298
|
-
schema: RULES_SAVE_SCHEMA,
|
|
299
|
-
}),
|
|
286
|
+
result: strictWire('dsh-permission-rules/types#RulesSaveResult', RULES_SAVE_SCHEMA),
|
|
300
287
|
sourceLocation: Object.freeze({ file: 'src/wire.ts', line: 1, column: 1 }),
|
|
301
288
|
} as const) satisfies InvocationDescriptor
|
|
302
289
|
|
|
@@ -308,11 +295,7 @@ export const RULES_RELOAD_DESCRIPTOR = Object.freeze({
|
|
|
308
295
|
method: 'reload',
|
|
309
296
|
invocation: Object.freeze({ kind: 'direct' }),
|
|
310
297
|
parameters: Object.freeze([]),
|
|
311
|
-
result:
|
|
312
|
-
mode: 'strict',
|
|
313
|
-
typeSymbol: 'dsh-permission-rules/types#RulesReloadResult',
|
|
314
|
-
schema: RULES_RELOAD_SCHEMA,
|
|
315
|
-
}),
|
|
298
|
+
result: strictWire('dsh-permission-rules/types#RulesReloadResult', RULES_RELOAD_SCHEMA),
|
|
316
299
|
sourceLocation: Object.freeze({ file: 'src/wire.ts', line: 1, column: 1 }),
|
|
317
300
|
} as const) satisfies InvocationDescriptor
|
|
318
301
|
|
|
@@ -330,17 +313,9 @@ export const ALLOW_HOST_DESCRIPTOR = Object.freeze({
|
|
|
330
313
|
name: 'request',
|
|
331
314
|
wire: 'request',
|
|
332
315
|
source: 'json',
|
|
333
|
-
codec:
|
|
334
|
-
mode: 'strict',
|
|
335
|
-
typeSymbol: 'dsh-permission-rules/types#AllowHostRequest',
|
|
336
|
-
schema: ALLOW_HOST_REQUEST_SCHEMA,
|
|
337
|
-
}),
|
|
316
|
+
codec: strictWire('dsh-permission-rules/types#AllowHostRequest', ALLOW_HOST_REQUEST_SCHEMA),
|
|
338
317
|
} satisfies InvocationDescriptor['parameters'][number])]),
|
|
339
|
-
result:
|
|
340
|
-
mode: 'strict',
|
|
341
|
-
typeSymbol: 'dsh-permission-rules/types#AllowHostResult',
|
|
342
|
-
schema: ALLOW_HOST_RESULT_SCHEMA,
|
|
343
|
-
}),
|
|
318
|
+
result: strictWire('dsh-permission-rules/types#AllowHostResult', ALLOW_HOST_RESULT_SCHEMA),
|
|
344
319
|
sourceLocation: Object.freeze({ file: 'src/wire.ts', line: 1, column: 1 }),
|
|
345
320
|
} as const) satisfies InvocationDescriptor
|
|
346
321
|
|