@systemfsoftware/effect-daemon-spec 4.2.0 → 5.0.1

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 CHANGED
@@ -1,5 +1,35 @@
1
1
  # @systemfsoftware/effect-daemon-spec
2
2
 
3
+ ## 5.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies:
8
+ - @systemfsoftware/effect-cell-types@11.0.0
9
+
10
+ ## 5.0.0
11
+
12
+ ### Major Changes
13
+
14
+ - A supervisor that exhausts its restart intensity now stops every child and then fails `Supervisor.awaitTerminated` and `Supervisor.shutdown` with `Supervisor.SupervisorTerminated`. The error's `cause` is the failure of the child that exhausted it. A supervisor running as another supervisor's child ends abnormally when it gives up, so its parent counts it against its own intensity and escalation reaches the top-level owner. A requested shutdown, and a supervisor with `coolDown` declared, still succeed.
15
+
16
+ - The package now exports a single `Supervisor` namespace that builds Erlang/OTP supervision trees: `Supervisor.make(name)` with `strategy`, `intensity`, `autoShutdown`, `coolDown`, `backoff`, `dynamic` and `children`, acquired through `.scoped` or `.layer`. Children run as fibers by default, and `Supervisor.ChildSpecs.on(port)` declares a child on another medium, whose layer the tree's `.layer` then requires. Restart strategies, restart types, restart intensity and shutdown modes follow OTP's `supervisor`, and exhausting the intensity now terminates the supervisor unless `coolDown` is declared. `Daemon`, `LeaderLock`, `LockPrimitive` and the `run` entry points are removed; declare a supervisor with `Supervisor.make` and its children with `Supervisor.ChildSpecs.make` instead. A running supervisor's decisions are observable through `Supervisor.traceOf`.
17
+
18
+ ### Minor Changes
19
+
20
+ - Adds an `@systemfsoftware/effect-daemon-spec/testing` entry point that checks a `LockPrimitive` implementation for linearizability. It exports the lock command schema (`LockCommand`), a pure lock model (`lockModel`, `stepLock`), `leadershipOver(primitive)`, which builds the `LeaderLock` the daemon uses over your primitive, and `runLockCommand`. Pass them to `Conformance.linearizable` from `@systemfsoftware/conformance-spec`, which is an optional peer dependency. The root entry point pulls in no test code.
21
+
22
+ - Add `Supervisor.livenessTick(millis)`, which declares how often the kernel's liveness tick fires for a ready child, beside the other policy knobs. Declare a longer tick when children run on a medium whose lifecycle steps take longer than the default one-second interval.
23
+
24
+ ### Patch Changes
25
+
26
+ - Every tagged error class now has a one-line message built from its fields, so a failure shows what went wrong instead of an empty message.
27
+
28
+ - Update peer and runtime dependency on `effect` and companion packages to `4.0.0-rc.117`.
29
+
30
+ - Updated dependencies:
31
+ - @systemfsoftware/conformance-spec@0.2.0
32
+
3
33
  ## 4.2.0
4
34
 
5
35
  ### Major Changes
package/README.md CHANGED
@@ -153,4 +153,4 @@ The wait succeeds when the supervisor ended because it was asked to shut down or
153
153
 
154
154
  ## License
155
155
 
156
- [Apache-2.0](https://github.com/systemfsoftware/systemfsoftware/blob/main/packages/effect-daemon-spec/LICENSE)
156
+ [Apache-2.0](https://github.com/systemfsoftware/systemfsoftware/blob/main/packages/daemon/effect-daemon-spec/LICENSE)
package/dist/index.d.ts CHANGED
@@ -46,41 +46,6 @@ declare const DynamicKind: Schema.Union<readonly [Schema.TaggedStruct<"NoDynamic
46
46
  readonly probeFailureThreshold: Schema.Int;
47
47
  }>]>;
48
48
  type DynamicKind = typeof DynamicKind.Type;
49
- declare const SupervisionPolicy_base: Schema.Class<SupervisionPolicy, Schema.Struct<{
50
- strategy: Schema.Literals<readonly ["one_for_one", "one_for_all", "rest_for_one"]>;
51
- intensity: Schema.Int;
52
- periodMillis: Schema.Int;
53
- autoShutdown: Schema.Literals<readonly ["never", "any_significant", "all_significant"]>;
54
- coolDown: Schema.Union<readonly [Schema.TaggedStruct<"NoCoolDown", {}>, Schema.TaggedStruct<"CoolDownAfter", {
55
- readonly millis: Schema.Int;
56
- }>]>;
57
- backoff: Schema.Struct<{
58
- readonly baseMillis: Schema.Int;
59
- readonly multiplier: Schema.Int;
60
- readonly capMillis: Schema.Int;
61
- }>;
62
- dynamic: Schema.Union<readonly [Schema.TaggedStruct<"NoDynamicChildren", {}>, Schema.TaggedStruct<"DynamicChildren", {
63
- readonly ceiling: Schema.Int;
64
- readonly restartType: Schema.Literals<readonly ["permanent", "transient", "temporary"]>;
65
- readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
66
- readonly millis: Schema.Int;
67
- }>, Schema.TaggedStruct<"Infinity", {}>]>;
68
- readonly startTimeoutMillis: Schema.Int;
69
- readonly probeFailureThreshold: Schema.Int;
70
- }>]>;
71
- livenessTickMillis: Schema.Int;
72
- childDeclarations: Schema.$Array<Schema.Struct<{
73
- readonly childId: Schema.String;
74
- readonly restartType: Schema.Literals<readonly ["permanent", "transient", "temporary"]>;
75
- readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
76
- readonly millis: Schema.Int;
77
- }>, Schema.TaggedStruct<"Infinity", {}>]>;
78
- readonly significant: Schema.Boolean;
79
- readonly startTimeoutMillis: Schema.Int;
80
- readonly probeFailureThreshold: Schema.Int;
81
- }>>;
82
- }>, {}>;
83
- declare class SupervisionPolicy extends SupervisionPolicy_base {}
84
49
  //#endregion
85
50
  //#region src/kernel/TerminationReport.schema.d.ts
86
51
  /**
@@ -258,8 +223,10 @@ declare const SupervisorTerminated_base: Schema.Class<SupervisorTerminated, Sche
258
223
  }>]>;
259
224
  }>]>;
260
225
  readonly cause: Schema.Cause<Schema.Unknown, Schema.Unknown>;
261
- }>, import("effect/Cause").YieldableError>;
262
- declare class SupervisorTerminated extends SupervisorTerminated_base {}
226
+ }>, Cause.YieldableError>;
227
+ declare class SupervisorTerminated extends SupervisorTerminated_base {
228
+ get message(): string;
229
+ }
263
230
  declare namespace FiberMedium_d_exports {
264
231
  export { BareFiberProgram, FiberProgram, failureCauseOf, fiberPort, medium, mediumFor, readyOnStart };
265
232
  }
@@ -284,7 +251,40 @@ declare class Stale extends Stale_base {
284
251
  }
285
252
  declare const Continue_base: Schema.Class<Continue, Schema.TaggedStruct<"Continue", {
286
253
  readonly core: Schema.Struct<{
287
- readonly policy: typeof SupervisionPolicy;
254
+ readonly policy: Schema.Struct<{
255
+ strategy: Schema.Literals<readonly ["one_for_one", "one_for_all", "rest_for_one"]>;
256
+ intensity: Schema.Int;
257
+ periodMillis: Schema.Int;
258
+ autoShutdown: Schema.Literals<readonly ["never", "any_significant", "all_significant"]>;
259
+ coolDown: Schema.Union<readonly [Schema.TaggedStruct<"NoCoolDown", {}>, Schema.TaggedStruct<"CoolDownAfter", {
260
+ readonly millis: Schema.Int;
261
+ }>]>;
262
+ backoff: Schema.Struct<{
263
+ readonly baseMillis: Schema.Int;
264
+ readonly multiplier: Schema.Int;
265
+ readonly capMillis: Schema.Int;
266
+ }>;
267
+ dynamic: Schema.Union<readonly [Schema.TaggedStruct<"NoDynamicChildren", {}>, Schema.TaggedStruct<"DynamicChildren", {
268
+ readonly ceiling: Schema.Int;
269
+ readonly restartType: Schema.Literals<readonly ["permanent", "transient", "temporary"]>;
270
+ readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
271
+ readonly millis: Schema.Int;
272
+ }>, Schema.TaggedStruct<"Infinity", {}>]>;
273
+ readonly startTimeoutMillis: Schema.Int;
274
+ readonly probeFailureThreshold: Schema.Int;
275
+ }>]>;
276
+ livenessTickMillis: Schema.Int;
277
+ childDeclarations: Schema.$Array<Schema.Struct<{
278
+ readonly childId: Schema.String;
279
+ readonly restartType: Schema.Literals<readonly ["permanent", "transient", "temporary"]>;
280
+ readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
281
+ readonly millis: Schema.Int;
282
+ }>, Schema.TaggedStruct<"Infinity", {}>]>;
283
+ readonly significant: Schema.Boolean;
284
+ readonly startTimeoutMillis: Schema.Int;
285
+ readonly probeFailureThreshold: Schema.Int;
286
+ }>>;
287
+ }>;
288
288
  readonly children: Schema.$Array<Schema.Struct<{
289
289
  readonly childId: Schema.String;
290
290
  readonly generation: Schema.Int;
@@ -350,7 +350,40 @@ declare class Continue extends Continue_base {
350
350
  }
351
351
  declare const RestartChildren_base: Schema.Class<RestartChildren, Schema.TaggedStruct<"RestartChildren", {
352
352
  readonly core: Schema.Struct<{
353
- readonly policy: typeof SupervisionPolicy;
353
+ readonly policy: Schema.Struct<{
354
+ strategy: Schema.Literals<readonly ["one_for_one", "one_for_all", "rest_for_one"]>;
355
+ intensity: Schema.Int;
356
+ periodMillis: Schema.Int;
357
+ autoShutdown: Schema.Literals<readonly ["never", "any_significant", "all_significant"]>;
358
+ coolDown: Schema.Union<readonly [Schema.TaggedStruct<"NoCoolDown", {}>, Schema.TaggedStruct<"CoolDownAfter", {
359
+ readonly millis: Schema.Int;
360
+ }>]>;
361
+ backoff: Schema.Struct<{
362
+ readonly baseMillis: Schema.Int;
363
+ readonly multiplier: Schema.Int;
364
+ readonly capMillis: Schema.Int;
365
+ }>;
366
+ dynamic: Schema.Union<readonly [Schema.TaggedStruct<"NoDynamicChildren", {}>, Schema.TaggedStruct<"DynamicChildren", {
367
+ readonly ceiling: Schema.Int;
368
+ readonly restartType: Schema.Literals<readonly ["permanent", "transient", "temporary"]>;
369
+ readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
370
+ readonly millis: Schema.Int;
371
+ }>, Schema.TaggedStruct<"Infinity", {}>]>;
372
+ readonly startTimeoutMillis: Schema.Int;
373
+ readonly probeFailureThreshold: Schema.Int;
374
+ }>]>;
375
+ livenessTickMillis: Schema.Int;
376
+ childDeclarations: Schema.$Array<Schema.Struct<{
377
+ readonly childId: Schema.String;
378
+ readonly restartType: Schema.Literals<readonly ["permanent", "transient", "temporary"]>;
379
+ readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
380
+ readonly millis: Schema.Int;
381
+ }>, Schema.TaggedStruct<"Infinity", {}>]>;
382
+ readonly significant: Schema.Boolean;
383
+ readonly startTimeoutMillis: Schema.Int;
384
+ readonly probeFailureThreshold: Schema.Int;
385
+ }>>;
386
+ }>;
354
387
  readonly children: Schema.$Array<Schema.Struct<{
355
388
  readonly childId: Schema.String;
356
389
  readonly generation: Schema.Int;
@@ -420,7 +453,40 @@ declare class RestartChildren extends RestartChildren_base {
420
453
  }
421
454
  declare const StartChildren_base: Schema.Class<StartChildren, Schema.TaggedStruct<"StartChildren", {
422
455
  readonly core: Schema.Struct<{
423
- readonly policy: typeof SupervisionPolicy;
456
+ readonly policy: Schema.Struct<{
457
+ strategy: Schema.Literals<readonly ["one_for_one", "one_for_all", "rest_for_one"]>;
458
+ intensity: Schema.Int;
459
+ periodMillis: Schema.Int;
460
+ autoShutdown: Schema.Literals<readonly ["never", "any_significant", "all_significant"]>;
461
+ coolDown: Schema.Union<readonly [Schema.TaggedStruct<"NoCoolDown", {}>, Schema.TaggedStruct<"CoolDownAfter", {
462
+ readonly millis: Schema.Int;
463
+ }>]>;
464
+ backoff: Schema.Struct<{
465
+ readonly baseMillis: Schema.Int;
466
+ readonly multiplier: Schema.Int;
467
+ readonly capMillis: Schema.Int;
468
+ }>;
469
+ dynamic: Schema.Union<readonly [Schema.TaggedStruct<"NoDynamicChildren", {}>, Schema.TaggedStruct<"DynamicChildren", {
470
+ readonly ceiling: Schema.Int;
471
+ readonly restartType: Schema.Literals<readonly ["permanent", "transient", "temporary"]>;
472
+ readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
473
+ readonly millis: Schema.Int;
474
+ }>, Schema.TaggedStruct<"Infinity", {}>]>;
475
+ readonly startTimeoutMillis: Schema.Int;
476
+ readonly probeFailureThreshold: Schema.Int;
477
+ }>]>;
478
+ livenessTickMillis: Schema.Int;
479
+ childDeclarations: Schema.$Array<Schema.Struct<{
480
+ readonly childId: Schema.String;
481
+ readonly restartType: Schema.Literals<readonly ["permanent", "transient", "temporary"]>;
482
+ readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
483
+ readonly millis: Schema.Int;
484
+ }>, Schema.TaggedStruct<"Infinity", {}>]>;
485
+ readonly significant: Schema.Boolean;
486
+ readonly startTimeoutMillis: Schema.Int;
487
+ readonly probeFailureThreshold: Schema.Int;
488
+ }>>;
489
+ }>;
424
490
  readonly children: Schema.$Array<Schema.Struct<{
425
491
  readonly childId: Schema.String;
426
492
  readonly generation: Schema.Int;
@@ -486,7 +552,40 @@ declare class StartChildren extends StartChildren_base {
486
552
  }
487
553
  declare const CoolDown_base: Schema.Class<CoolDown, Schema.TaggedStruct<"CoolDown", {
488
554
  readonly core: Schema.Struct<{
489
- readonly policy: typeof SupervisionPolicy;
555
+ readonly policy: Schema.Struct<{
556
+ strategy: Schema.Literals<readonly ["one_for_one", "one_for_all", "rest_for_one"]>;
557
+ intensity: Schema.Int;
558
+ periodMillis: Schema.Int;
559
+ autoShutdown: Schema.Literals<readonly ["never", "any_significant", "all_significant"]>;
560
+ coolDown: Schema.Union<readonly [Schema.TaggedStruct<"NoCoolDown", {}>, Schema.TaggedStruct<"CoolDownAfter", {
561
+ readonly millis: Schema.Int;
562
+ }>]>;
563
+ backoff: Schema.Struct<{
564
+ readonly baseMillis: Schema.Int;
565
+ readonly multiplier: Schema.Int;
566
+ readonly capMillis: Schema.Int;
567
+ }>;
568
+ dynamic: Schema.Union<readonly [Schema.TaggedStruct<"NoDynamicChildren", {}>, Schema.TaggedStruct<"DynamicChildren", {
569
+ readonly ceiling: Schema.Int;
570
+ readonly restartType: Schema.Literals<readonly ["permanent", "transient", "temporary"]>;
571
+ readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
572
+ readonly millis: Schema.Int;
573
+ }>, Schema.TaggedStruct<"Infinity", {}>]>;
574
+ readonly startTimeoutMillis: Schema.Int;
575
+ readonly probeFailureThreshold: Schema.Int;
576
+ }>]>;
577
+ livenessTickMillis: Schema.Int;
578
+ childDeclarations: Schema.$Array<Schema.Struct<{
579
+ readonly childId: Schema.String;
580
+ readonly restartType: Schema.Literals<readonly ["permanent", "transient", "temporary"]>;
581
+ readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
582
+ readonly millis: Schema.Int;
583
+ }>, Schema.TaggedStruct<"Infinity", {}>]>;
584
+ readonly significant: Schema.Boolean;
585
+ readonly startTimeoutMillis: Schema.Int;
586
+ readonly probeFailureThreshold: Schema.Int;
587
+ }>>;
588
+ }>;
490
589
  readonly children: Schema.$Array<Schema.Struct<{
491
590
  readonly childId: Schema.String;
492
591
  readonly generation: Schema.Int;
@@ -553,7 +652,40 @@ declare class CoolDown extends CoolDown_base {
553
652
  }
554
653
  declare const StopChildren_base: Schema.Class<StopChildren, Schema.TaggedStruct<"StopChildren", {
555
654
  readonly core: Schema.Struct<{
556
- readonly policy: typeof SupervisionPolicy;
655
+ readonly policy: Schema.Struct<{
656
+ strategy: Schema.Literals<readonly ["one_for_one", "one_for_all", "rest_for_one"]>;
657
+ intensity: Schema.Int;
658
+ periodMillis: Schema.Int;
659
+ autoShutdown: Schema.Literals<readonly ["never", "any_significant", "all_significant"]>;
660
+ coolDown: Schema.Union<readonly [Schema.TaggedStruct<"NoCoolDown", {}>, Schema.TaggedStruct<"CoolDownAfter", {
661
+ readonly millis: Schema.Int;
662
+ }>]>;
663
+ backoff: Schema.Struct<{
664
+ readonly baseMillis: Schema.Int;
665
+ readonly multiplier: Schema.Int;
666
+ readonly capMillis: Schema.Int;
667
+ }>;
668
+ dynamic: Schema.Union<readonly [Schema.TaggedStruct<"NoDynamicChildren", {}>, Schema.TaggedStruct<"DynamicChildren", {
669
+ readonly ceiling: Schema.Int;
670
+ readonly restartType: Schema.Literals<readonly ["permanent", "transient", "temporary"]>;
671
+ readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
672
+ readonly millis: Schema.Int;
673
+ }>, Schema.TaggedStruct<"Infinity", {}>]>;
674
+ readonly startTimeoutMillis: Schema.Int;
675
+ readonly probeFailureThreshold: Schema.Int;
676
+ }>]>;
677
+ livenessTickMillis: Schema.Int;
678
+ childDeclarations: Schema.$Array<Schema.Struct<{
679
+ readonly childId: Schema.String;
680
+ readonly restartType: Schema.Literals<readonly ["permanent", "transient", "temporary"]>;
681
+ readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
682
+ readonly millis: Schema.Int;
683
+ }>, Schema.TaggedStruct<"Infinity", {}>]>;
684
+ readonly significant: Schema.Boolean;
685
+ readonly startTimeoutMillis: Schema.Int;
686
+ readonly probeFailureThreshold: Schema.Int;
687
+ }>>;
688
+ }>;
557
689
  readonly children: Schema.$Array<Schema.Struct<{
558
690
  readonly childId: Schema.String;
559
691
  readonly generation: Schema.Int;
@@ -757,7 +889,40 @@ declare const SupervisionDecision: Schema.Union<readonly [typeof Stale, typeof C
757
889
  type SupervisionDecision = typeof SupervisionDecision.Type;
758
890
  declare const Running_base: Schema.Class<Running, Schema.TaggedStruct<"Running", {
759
891
  readonly core: Schema.Struct<{
760
- readonly policy: typeof SupervisionPolicy;
892
+ readonly policy: Schema.Struct<{
893
+ strategy: Schema.Literals<readonly ["one_for_one", "one_for_all", "rest_for_one"]>;
894
+ intensity: Schema.Int;
895
+ periodMillis: Schema.Int;
896
+ autoShutdown: Schema.Literals<readonly ["never", "any_significant", "all_significant"]>;
897
+ coolDown: Schema.Union<readonly [Schema.TaggedStruct<"NoCoolDown", {}>, Schema.TaggedStruct<"CoolDownAfter", {
898
+ readonly millis: Schema.Int;
899
+ }>]>;
900
+ backoff: Schema.Struct<{
901
+ readonly baseMillis: Schema.Int;
902
+ readonly multiplier: Schema.Int;
903
+ readonly capMillis: Schema.Int;
904
+ }>;
905
+ dynamic: Schema.Union<readonly [Schema.TaggedStruct<"NoDynamicChildren", {}>, Schema.TaggedStruct<"DynamicChildren", {
906
+ readonly ceiling: Schema.Int;
907
+ readonly restartType: Schema.Literals<readonly ["permanent", "transient", "temporary"]>;
908
+ readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
909
+ readonly millis: Schema.Int;
910
+ }>, Schema.TaggedStruct<"Infinity", {}>]>;
911
+ readonly startTimeoutMillis: Schema.Int;
912
+ readonly probeFailureThreshold: Schema.Int;
913
+ }>]>;
914
+ livenessTickMillis: Schema.Int;
915
+ childDeclarations: Schema.$Array<Schema.Struct<{
916
+ readonly childId: Schema.String;
917
+ readonly restartType: Schema.Literals<readonly ["permanent", "transient", "temporary"]>;
918
+ readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
919
+ readonly millis: Schema.Int;
920
+ }>, Schema.TaggedStruct<"Infinity", {}>]>;
921
+ readonly significant: Schema.Boolean;
922
+ readonly startTimeoutMillis: Schema.Int;
923
+ readonly probeFailureThreshold: Schema.Int;
924
+ }>>;
925
+ }>;
761
926
  readonly children: Schema.$Array<Schema.Struct<{
762
927
  readonly childId: Schema.String;
763
928
  readonly generation: Schema.Int;
@@ -774,7 +939,40 @@ declare class Running extends Running_base {
774
939
  }
775
940
  declare const Restarting_base: Schema.Class<Restarting, Schema.TaggedStruct<"Restarting", {
776
941
  readonly core: Schema.Struct<{
777
- readonly policy: typeof SupervisionPolicy;
942
+ readonly policy: Schema.Struct<{
943
+ strategy: Schema.Literals<readonly ["one_for_one", "one_for_all", "rest_for_one"]>;
944
+ intensity: Schema.Int;
945
+ periodMillis: Schema.Int;
946
+ autoShutdown: Schema.Literals<readonly ["never", "any_significant", "all_significant"]>;
947
+ coolDown: Schema.Union<readonly [Schema.TaggedStruct<"NoCoolDown", {}>, Schema.TaggedStruct<"CoolDownAfter", {
948
+ readonly millis: Schema.Int;
949
+ }>]>;
950
+ backoff: Schema.Struct<{
951
+ readonly baseMillis: Schema.Int;
952
+ readonly multiplier: Schema.Int;
953
+ readonly capMillis: Schema.Int;
954
+ }>;
955
+ dynamic: Schema.Union<readonly [Schema.TaggedStruct<"NoDynamicChildren", {}>, Schema.TaggedStruct<"DynamicChildren", {
956
+ readonly ceiling: Schema.Int;
957
+ readonly restartType: Schema.Literals<readonly ["permanent", "transient", "temporary"]>;
958
+ readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
959
+ readonly millis: Schema.Int;
960
+ }>, Schema.TaggedStruct<"Infinity", {}>]>;
961
+ readonly startTimeoutMillis: Schema.Int;
962
+ readonly probeFailureThreshold: Schema.Int;
963
+ }>]>;
964
+ livenessTickMillis: Schema.Int;
965
+ childDeclarations: Schema.$Array<Schema.Struct<{
966
+ readonly childId: Schema.String;
967
+ readonly restartType: Schema.Literals<readonly ["permanent", "transient", "temporary"]>;
968
+ readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
969
+ readonly millis: Schema.Int;
970
+ }>, Schema.TaggedStruct<"Infinity", {}>]>;
971
+ readonly significant: Schema.Boolean;
972
+ readonly startTimeoutMillis: Schema.Int;
973
+ readonly probeFailureThreshold: Schema.Int;
974
+ }>>;
975
+ }>;
778
976
  readonly children: Schema.$Array<Schema.Struct<{
779
977
  readonly childId: Schema.String;
780
978
  readonly generation: Schema.Int;
@@ -795,7 +993,40 @@ declare class Restarting extends Restarting_base {
795
993
  }
796
994
  declare const CoolingDown_base: Schema.Class<CoolingDown, Schema.TaggedStruct<"CoolingDown", {
797
995
  readonly core: Schema.Struct<{
798
- readonly policy: typeof SupervisionPolicy;
996
+ readonly policy: Schema.Struct<{
997
+ strategy: Schema.Literals<readonly ["one_for_one", "one_for_all", "rest_for_one"]>;
998
+ intensity: Schema.Int;
999
+ periodMillis: Schema.Int;
1000
+ autoShutdown: Schema.Literals<readonly ["never", "any_significant", "all_significant"]>;
1001
+ coolDown: Schema.Union<readonly [Schema.TaggedStruct<"NoCoolDown", {}>, Schema.TaggedStruct<"CoolDownAfter", {
1002
+ readonly millis: Schema.Int;
1003
+ }>]>;
1004
+ backoff: Schema.Struct<{
1005
+ readonly baseMillis: Schema.Int;
1006
+ readonly multiplier: Schema.Int;
1007
+ readonly capMillis: Schema.Int;
1008
+ }>;
1009
+ dynamic: Schema.Union<readonly [Schema.TaggedStruct<"NoDynamicChildren", {}>, Schema.TaggedStruct<"DynamicChildren", {
1010
+ readonly ceiling: Schema.Int;
1011
+ readonly restartType: Schema.Literals<readonly ["permanent", "transient", "temporary"]>;
1012
+ readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
1013
+ readonly millis: Schema.Int;
1014
+ }>, Schema.TaggedStruct<"Infinity", {}>]>;
1015
+ readonly startTimeoutMillis: Schema.Int;
1016
+ readonly probeFailureThreshold: Schema.Int;
1017
+ }>]>;
1018
+ livenessTickMillis: Schema.Int;
1019
+ childDeclarations: Schema.$Array<Schema.Struct<{
1020
+ readonly childId: Schema.String;
1021
+ readonly restartType: Schema.Literals<readonly ["permanent", "transient", "temporary"]>;
1022
+ readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
1023
+ readonly millis: Schema.Int;
1024
+ }>, Schema.TaggedStruct<"Infinity", {}>]>;
1025
+ readonly significant: Schema.Boolean;
1026
+ readonly startTimeoutMillis: Schema.Int;
1027
+ readonly probeFailureThreshold: Schema.Int;
1028
+ }>>;
1029
+ }>;
799
1030
  readonly children: Schema.$Array<Schema.Struct<{
800
1031
  readonly childId: Schema.String;
801
1032
  readonly generation: Schema.Int;
@@ -813,7 +1044,40 @@ declare class CoolingDown extends CoolingDown_base {
813
1044
  }
814
1045
  declare const ShuttingDown_base: Schema.Class<ShuttingDown, Schema.TaggedStruct<"ShuttingDown", {
815
1046
  readonly core: Schema.Struct<{
816
- readonly policy: typeof SupervisionPolicy;
1047
+ readonly policy: Schema.Struct<{
1048
+ strategy: Schema.Literals<readonly ["one_for_one", "one_for_all", "rest_for_one"]>;
1049
+ intensity: Schema.Int;
1050
+ periodMillis: Schema.Int;
1051
+ autoShutdown: Schema.Literals<readonly ["never", "any_significant", "all_significant"]>;
1052
+ coolDown: Schema.Union<readonly [Schema.TaggedStruct<"NoCoolDown", {}>, Schema.TaggedStruct<"CoolDownAfter", {
1053
+ readonly millis: Schema.Int;
1054
+ }>]>;
1055
+ backoff: Schema.Struct<{
1056
+ readonly baseMillis: Schema.Int;
1057
+ readonly multiplier: Schema.Int;
1058
+ readonly capMillis: Schema.Int;
1059
+ }>;
1060
+ dynamic: Schema.Union<readonly [Schema.TaggedStruct<"NoDynamicChildren", {}>, Schema.TaggedStruct<"DynamicChildren", {
1061
+ readonly ceiling: Schema.Int;
1062
+ readonly restartType: Schema.Literals<readonly ["permanent", "transient", "temporary"]>;
1063
+ readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
1064
+ readonly millis: Schema.Int;
1065
+ }>, Schema.TaggedStruct<"Infinity", {}>]>;
1066
+ readonly startTimeoutMillis: Schema.Int;
1067
+ readonly probeFailureThreshold: Schema.Int;
1068
+ }>]>;
1069
+ livenessTickMillis: Schema.Int;
1070
+ childDeclarations: Schema.$Array<Schema.Struct<{
1071
+ readonly childId: Schema.String;
1072
+ readonly restartType: Schema.Literals<readonly ["permanent", "transient", "temporary"]>;
1073
+ readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
1074
+ readonly millis: Schema.Int;
1075
+ }>, Schema.TaggedStruct<"Infinity", {}>]>;
1076
+ readonly significant: Schema.Boolean;
1077
+ readonly startTimeoutMillis: Schema.Int;
1078
+ readonly probeFailureThreshold: Schema.Int;
1079
+ }>>;
1080
+ }>;
817
1081
  readonly children: Schema.$Array<Schema.Struct<{
818
1082
  readonly childId: Schema.String;
819
1083
  readonly generation: Schema.Int;
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
- import { Array, Cause, Clock, Context, Deferred, Duration, Effect, Exit, Fiber, HashMap, Layer, Match, Number as Number$1, Option, Predicate, PubSub, Queue, Ref, Result, Schema, SchemaGetter, Scope } from "effect";
2
+ import { Array, Cause, Clock, Context, Deferred, Duration, Effect, Exit, Fiber, HashMap, Layer, Match, Number as Number$1, Option, Predicate, PubSub, Queue, Ref, Result, Schema, Scope } from "effect";
3
3
  import { Handle, Sandwich, Workflow } from "@systemfsoftware/effect-cell-types";
4
4
  import { dual } from "effect/Function";
5
5
  import * as Stream from "effect/Stream";
@@ -9,7 +9,7 @@ import { Prototype } from "effect/Pipeable";
9
9
  * Generation-only bound: the production domains below span the whole
10
10
  * non-negative safe-integer range, but unbounded generation would draw
11
11
  * astronomically large counters and times in property tests
12
- * (compound-packs/boundary-testing/arbitrary-filter-floors.md). An
12
+ * (compound-packs/schema-laws/arbitrary-filter-floors.md). An
13
13
  * annotation-only check never rejects a value; it only steers the derived
14
14
  * fast-check integer generator into a small range.
15
15
  */
@@ -137,7 +137,7 @@ const ChildSeed = Schema.Struct({
137
137
  startTimeoutMillis: PositiveMillis,
138
138
  probeFailureThreshold: ProbeThreshold
139
139
  });
140
- const PolicyGenerated = Schema.Struct({
140
+ Schema.Struct({
141
141
  strategy: RestartStrategy,
142
142
  intensity: Intensity,
143
143
  periodMillis: PositiveMillis,
@@ -148,52 +148,7 @@ const PolicyGenerated = Schema.Struct({
148
148
  livenessTickMillis: PositiveMillis,
149
149
  childSeeds: Schema.Array(ChildSeed)
150
150
  });
151
- const decodable = (holds) => holds.every((single) => single);
152
- const declarationOf$2 = (seed, index, autoShutdown) => ({
153
- childId: `c${index}`,
154
- restartType: seed.restartType,
155
- shutdown: seed.shutdown,
156
- significant: decodable([
157
- seed.significantBit,
158
- seed.restartType !== "permanent",
159
- autoShutdown !== "never"
160
- ]),
161
- startTimeoutMillis: seed.startTimeoutMillis,
162
- probeFailureThreshold: seed.probeFailureThreshold
163
- });
164
- const seedOf = (declaration) => ({
165
- restartType: declaration.restartType,
166
- significantBit: declaration.significant,
167
- shutdown: declaration.shutdown,
168
- startTimeoutMillis: declaration.startTimeoutMillis,
169
- probeFailureThreshold: declaration.probeFailureThreshold
170
- });
171
- const policyOf = (generated) => new SupervisionPolicy({
172
- strategy: generated.strategy,
173
- intensity: generated.intensity,
174
- periodMillis: generated.periodMillis,
175
- autoShutdown: generated.autoShutdown,
176
- coolDown: generated.coolDown,
177
- backoff: generated.backoff,
178
- dynamic: generated.dynamic,
179
- livenessTickMillis: generated.livenessTickMillis,
180
- childDeclarations: Array.map(generated.childSeeds, (seed, index) => declarationOf$2(seed, index, generated.autoShutdown))
181
- });
182
- const generatedFromPolicy = (policy) => ({
183
- strategy: policy.strategy,
184
- intensity: policy.intensity,
185
- periodMillis: policy.periodMillis,
186
- autoShutdown: policy.autoShutdown,
187
- coolDown: policy.coolDown,
188
- backoff: policy.backoff,
189
- dynamic: policy.dynamic,
190
- livenessTickMillis: policy.livenessTickMillis,
191
- childSeeds: Array.map(policy.childDeclarations, seedOf)
192
- });
193
- var SupervisionPolicy = class extends Schema.Class("SupervisionPolicy")(Schema.Struct(policyFields).check(Schema.makeFilter(policyIsDecodable, { message: POLICY_REFUSAL_MESSAGE })), { toCodecArbitrary: () => Schema.link()(PolicyGenerated, {
194
- decode: SchemaGetter.transform((generated) => policyOf(generated)),
195
- encode: SchemaGetter.transform(generatedFromPolicy)
196
- }) }) {};
151
+ const SupervisionPolicy = Schema.Struct(policyFields).check(Schema.makeFilter(policyIsDecodable, { message: POLICY_REFUSAL_MESSAGE }));
197
152
  //#endregion
198
153
  //#region src/kernel/TerminationReport.schema.ts
199
154
  /**
@@ -1329,11 +1284,16 @@ const evolveSupervisor = Workflow.make({
1329
1284
  });
1330
1285
  //#endregion
1331
1286
  //#region src/Supervisor/SupervisorTerminated.schema.ts
1287
+ const firstLine = (text) => text.split("\n")[0] ?? "";
1332
1288
  var SupervisorTerminated = class extends Schema.TaggedError()("SupervisorTerminated", {
1333
1289
  name: Schema.String,
1334
1290
  reason: TerminationReason,
1335
1291
  cause: Schema.Cause(Schema.Unknown, Schema.Unknown)
1336
- }) {};
1292
+ }) {
1293
+ get message() {
1294
+ return `Supervisor "${this.name}" terminated (${this.reason._tag}): ${firstLine(Cause.pretty(this.cause))}`;
1295
+ }
1296
+ };
1337
1297
  //#endregion
1338
1298
  //#region src/Supervisor/supervisor-commands.ts
1339
1299
  const stampedNow = (handle, event) => Effect.flatMap(Clock.currentTimeMillis, (now) => offerEvent(handle, {
@@ -1525,7 +1485,7 @@ const WORKER_SHUTDOWN = {
1525
1485
  };
1526
1486
  const SUPERVISOR_SHUTDOWN = { _tag: "Infinity" };
1527
1487
  const LIVENESS_TICK_MILLIS = 1e3;
1528
- const policyOfParts = (parts) => new SupervisionPolicy({
1488
+ const policyOfParts = (parts) => ({
1529
1489
  strategy: parts.strategy,
1530
1490
  intensity: parts.intensity,
1531
1491
  periodMillis: parts.periodMillis,
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@systemfsoftware/effect-daemon-spec",
3
3
  "license": "Apache-2.0",
4
- "version": "4.2.0",
4
+ "version": "5.0.1",
5
5
  "author": "Ryan Lee <drdgvhbh@gmail.com>",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/systemfsoftware/systemfsoftware.git",
9
- "directory": "packages/effect-daemon-spec"
9
+ "directory": "packages/daemon/effect-daemon-spec"
10
10
  },
11
- "homepage": "https://github.com/systemfsoftware/systemfsoftware/tree/main/packages/effect-daemon-spec#readme",
11
+ "homepage": "https://github.com/systemfsoftware/systemfsoftware/tree/main/packages/daemon/effect-daemon-spec#readme",
12
12
  "bugs": "https://github.com/systemfsoftware/systemfsoftware/issues",
13
13
  "description": "Supervision-tree daemons for Effect-TS — leader election, distributed locks, restart-intensity backoff, dynamic children, and health latches as a pure typed core.",
14
14
  "keywords": [
@@ -37,26 +37,27 @@
37
37
  "dist"
38
38
  ],
39
39
  "dependencies": {
40
- "@systemfsoftware/effect-cell-types": "^10.2.0"
40
+ "@systemfsoftware/effect-cell-types": "^11.0.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@microsoft/api-extractor": "^7.59.1",
44
44
  "@systemfsoftware/arethetypeswrong-cli": "^4.2.0",
45
- "@systemfsoftware/conformance-spec": "^0.1.0",
46
- "@systemfsoftware/effect-gherkin-spec": "^5.0.0",
47
- "@systemfsoftware/effect-schema-law": "^3.0.0",
48
- "@systemfsoftware/effect-schema-vite": "^2.2.5",
49
- "@systemfsoftware/oxlint-config-recommended": "^3.1.0",
45
+ "@systemfsoftware/conformance-spec": "^0.2.0",
46
+ "@systemfsoftware/effect-gherkin-spec": "^6.0.0",
47
+ "@systemfsoftware/effect-schema-law": "^4.0.0",
48
+ "@systemfsoftware/effect-schema-vite": "^2.2.6",
49
+ "@systemfsoftware/effect-spec-runtime": "^0.3.1",
50
+ "@systemfsoftware/oxlint-config-recommended": "^3.2.0",
50
51
  "@systemfsoftware/stryker-config": "^0.1.0",
51
- "@systemfsoftware/stryker-ignorer-effect-schema-declarations": "^0.1.1",
52
- "@systemfsoftware/stryker-ignorer-in-source-vitest-block": "^0.1.1",
53
- "@systemfsoftware/stryker-js": "^10.1.1",
54
- "@systemfsoftware/stryker-js-typescript-checker": "^7.0.5",
55
- "@systemfsoftware/stryker-js-vitest-runner": "^7.1.1",
56
- "@systemfsoftware/stryker-test-contribution": "^3.0.3",
52
+ "@systemfsoftware/stryker-ignorer-effect-schema-declarations": "latest",
53
+ "@systemfsoftware/stryker-ignorer-in-source-vitest-block": "latest",
54
+ "@systemfsoftware/stryker-js": "latest",
55
+ "@systemfsoftware/stryker-js-typescript-checker": "latest",
56
+ "@systemfsoftware/stryker-js-vitest-runner": "latest",
57
+ "@systemfsoftware/stryker-test-contribution": "latest",
57
58
  "@systemfsoftware/tsconfig": "^2.0.1",
58
59
  "@systemfsoftware/tsdown-config": "^0.1.0",
59
- "@systemfsoftware/vitest": "^0.1.0",
60
+ "@systemfsoftware/vitest": "^0.2.0",
60
61
  "@systemfsoftware/vitest-config": "^0.1.0",
61
62
  "@types/node": "^26",
62
63
  "@vitest/coverage-v8": "^5",
@@ -70,7 +71,7 @@
70
71
  "vitest": "^5"
71
72
  },
72
73
  "peerDependencies": {
73
- "@systemfsoftware/conformance-spec": "^0.1.0",
74
+ "@systemfsoftware/conformance-spec": "^0.2.0",
74
75
  "effect": "4.0.0-rc.117"
75
76
  },
76
77
  "peerDependenciesMeta": {
@@ -79,6 +80,7 @@
79
80
  }
80
81
  },
81
82
  "publishConfig": {
83
+ "access": "public",
82
84
  "provenance": true
83
85
  },
84
86
  "scripts": {