@systemfsoftware/effect-daemon-spec 6.0.0 → 6.0.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/README.md +2 -4
- package/dist/index.d.ts +56 -48
- package/dist/index.mjs +45 -65
- package/dist/rolldown-runtime-D3KUYPsf.mjs +12 -0
- package/package.json +27 -29
- package/CHANGELOG.md +0 -396
- package/dist/rolldown-runtime-D7D4PA-g.mjs +0 -13
package/README.md
CHANGED
|
@@ -6,9 +6,7 @@ Every supervision decision is made by a pure fold over supervision events, and e
|
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
pnpm add @systemfsoftware/effect-daemon-spec effect
|
|
11
|
-
```
|
|
9
|
+
This package is not on npm: take `@systemfsoftware/effect-daemon-spec` from nix.systemfsoftware.com, the package registry for `@systemfsoftware` packages, through a flake input (see the repository README). Install `effect` beside it.
|
|
12
10
|
|
|
13
11
|
> [!NOTE]
|
|
14
12
|
> `effect` is a peer dependency: you bring your own.
|
|
@@ -153,4 +151,4 @@ The wait succeeds when the supervisor ended because it was asked to shut down or
|
|
|
153
151
|
|
|
154
152
|
## License
|
|
155
153
|
|
|
156
|
-
[Apache-2.0](https://github.com/systemfsoftware/
|
|
154
|
+
[Apache-2.0](https://github.com/systemfsoftware/effect-daemon/blob/main/packages/effect-daemon-spec/LICENSE)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Handle, Workflow } from "@systemfsoftware/effect-cell-types";
|
|
2
|
-
import { Cause, Context, Deferred, Effect,
|
|
2
|
+
import { Cause, Context, Deferred, Effect, HashMap, Layer, Option, PubSub, Queue, Ref, Schema, Scope } from "effect";
|
|
3
3
|
import * as Stream from "effect/Stream";
|
|
4
4
|
import { Pipeable } from "effect/Pipeable";
|
|
5
|
-
//#region src/kernel/TerminationReport.schema.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* What a medium can say about why a child died (R16): a fiber supplies a cause, a process
|
|
8
7
|
* supplies an exit status and signal, and a remote runner's death is inferred. No event
|
|
@@ -67,10 +66,8 @@ declare const TerminationReason: Schema.Union<readonly [Schema.TaggedStruct<"Nor
|
|
|
67
66
|
}>]>;
|
|
68
67
|
}>]>;
|
|
69
68
|
type TerminationReason = typeof TerminationReason.Type;
|
|
70
|
-
//#endregion
|
|
71
|
-
//#region src/Supervisor/SupervisorTerminated.schema.d.ts
|
|
72
69
|
declare const SupervisorTerminated_base: Schema.Class<SupervisorTerminated, Schema.TaggedStruct<"SupervisorTerminated", {
|
|
73
|
-
readonly
|
|
70
|
+
readonly supervisor: Schema.String;
|
|
74
71
|
readonly reason: Schema.Union<readonly [Schema.TaggedStruct<"Normal", {}>, Schema.TaggedStruct<"Shutdown", {}>, Schema.TaggedStruct<"Abnormal", {
|
|
75
72
|
readonly report: Schema.Union<readonly [Schema.TaggedStruct<"CauseReport", {
|
|
76
73
|
readonly cause: Schema.String;
|
|
@@ -84,48 +81,50 @@ declare const SupervisorTerminated_base: Schema.Class<SupervisorTerminated, Sche
|
|
|
84
81
|
}>]>;
|
|
85
82
|
}>]>;
|
|
86
83
|
readonly cause: Schema.Cause<Schema.Unknown, Schema.Unknown>;
|
|
87
|
-
}>, Cause.YieldableError
|
|
84
|
+
}>, Cause.YieldableError & {
|
|
85
|
+
readonly brand: unique symbol;
|
|
86
|
+
}>;
|
|
88
87
|
declare class SupervisorTerminated extends SupervisorTerminated_base {
|
|
89
88
|
get message(): string;
|
|
90
89
|
}
|
|
91
|
-
//#endregion
|
|
92
|
-
//#region src/Supervisor/ChildExitDecision.schema.d.ts
|
|
93
90
|
declare const ChildExitTypeId: unique symbol;
|
|
94
91
|
type ChildExitTypeId = typeof ChildExitTypeId;
|
|
95
|
-
declare const NormalExit_base: Schema.Class<NormalExit, Schema.TaggedStruct<"Normal", {}>, {
|
|
92
|
+
declare const NormalExit_base: Schema.Class<NormalExit, Schema.TaggedStruct<"Normal", {}>, {
|
|
93
|
+
readonly brand: unique symbol;
|
|
94
|
+
}>;
|
|
96
95
|
/** The child ended on its own success. */
|
|
97
96
|
declare class NormalExit extends NormalExit_base {
|
|
98
97
|
readonly [ChildExitTypeId]: symbol;
|
|
99
98
|
}
|
|
100
|
-
declare const ShutdownExit_base: Schema.Class<ShutdownExit, Schema.TaggedStruct<"Shutdown", {}>, {
|
|
99
|
+
declare const ShutdownExit_base: Schema.Class<ShutdownExit, Schema.TaggedStruct<"Shutdown", {}>, {
|
|
100
|
+
readonly brand: unique symbol;
|
|
101
|
+
}>;
|
|
101
102
|
/** The child was interrupted — an owned shutdown, or one it raised itself. */
|
|
102
103
|
declare class ShutdownExit extends ShutdownExit_base {
|
|
103
104
|
readonly [ChildExitTypeId]: symbol;
|
|
104
105
|
}
|
|
105
|
-
declare const AbnormalExit_base: Schema.Class<AbnormalExit, Schema.TaggedStruct<"Abnormal", {}>, {
|
|
106
|
+
declare const AbnormalExit_base: Schema.Class<AbnormalExit, Schema.TaggedStruct<"Abnormal", {}>, {
|
|
107
|
+
readonly brand: unique symbol;
|
|
108
|
+
}>;
|
|
106
109
|
/** The child failed with something other than an interruption. */
|
|
107
110
|
declare class AbnormalExit extends AbnormalExit_base {
|
|
108
111
|
readonly [ChildExitTypeId]: symbol;
|
|
109
112
|
}
|
|
110
|
-
//#endregion
|
|
111
|
-
//#region src/Supervisor/classify-child-exit.workflow.d.ts
|
|
112
113
|
declare const ClassifyChildExit_base: Schema.Class<ClassifyChildExit, Schema.TaggedStruct<"ClassifyChildExit", {
|
|
113
114
|
readonly stopping: Schema.Boolean;
|
|
114
115
|
readonly exit: Schema.Exit<Schema.Void, Schema.Unknown, Schema.Unknown>;
|
|
115
|
-
}>, {
|
|
116
|
+
}>, {
|
|
117
|
+
readonly brand: unique symbol;
|
|
118
|
+
}>;
|
|
116
119
|
declare class ClassifyChildExit extends ClassifyChildExit_base {
|
|
117
120
|
static readonly [Workflow.InstrumentationBrand]: {};
|
|
118
121
|
}
|
|
119
122
|
declare const classifyChildExit: Workflow.MadeWorkflow<typeof ClassifyChildExit, Schema.Union<readonly [typeof NormalExit, typeof ShutdownExit, typeof AbnormalExit]>, Schema.Never>;
|
|
120
|
-
//#endregion
|
|
121
|
-
//#region src/kernel/SupervisionLimits.schema.d.ts
|
|
122
123
|
/** How many times a child incarnation has been replaced: any non-negative safe integer. Generation stays small so generation+1 stays in range. */
|
|
123
124
|
declare const Generation: Schema.Int;
|
|
124
125
|
type Generation = typeof Generation.Type;
|
|
125
126
|
declare const ChildId: Schema.String;
|
|
126
127
|
type ChildId = typeof ChildId.Type;
|
|
127
|
-
//#endregion
|
|
128
|
-
//#region src/kernel/SupervisorPolicy.schema.d.ts
|
|
129
128
|
declare const RestartStrategy: Schema.Literals<readonly ["one_for_one", "one_for_all", "rest_for_one"]>;
|
|
130
129
|
type RestartStrategy = typeof RestartStrategy.Type;
|
|
131
130
|
declare const AutoShutdown: Schema.Literals<readonly ["never", "any_significant", "all_significant"]>;
|
|
@@ -169,8 +168,6 @@ declare const DynamicKind: Schema.Union<readonly [Schema.TaggedStruct<"NoDynamic
|
|
|
169
168
|
readonly probeFailureThreshold: Schema.Int;
|
|
170
169
|
}>]>;
|
|
171
170
|
type DynamicKind = typeof DynamicKind.Type;
|
|
172
|
-
//#endregion
|
|
173
|
-
//#region src/Supervisor/MediumDeclaration.schema.d.ts
|
|
174
171
|
/**
|
|
175
172
|
* What a medium can say about why a child died (R16, KTD8): the in-process fiber
|
|
176
173
|
* medium reports a full `Cause`, a process, socket or microVM medium reports the
|
|
@@ -273,8 +270,6 @@ declare const fiberPort: import("effect/Context").Service<MediumPortShape<FiberP
|
|
|
273
270
|
declare const failureCauseOf: (evidence: Started) => Option.Option<Effect.Effect<Option.Option<Cause.Cause<SupervisorTerminated>>>>;
|
|
274
271
|
declare const mediumFor: <R = never>() => Medium<(ready: Effect.Effect<void>) => Effect.Effect<void, SupervisorTerminated, Scope.Scope | R>, never, Scope.Scope | R>;
|
|
275
272
|
declare const medium: Medium<FiberProgram, never, Scope.Scope>;
|
|
276
|
-
//#endregion
|
|
277
|
-
//#region src/kernel/SupervisorState.schema.d.ts
|
|
278
273
|
declare const StateTypeId: unique symbol;
|
|
279
274
|
declare const Running_base: Schema.Class<Running, Schema.TaggedStruct<"Running", {
|
|
280
275
|
readonly core: Schema.Struct<{
|
|
@@ -322,7 +317,9 @@ declare const Running_base: Schema.Class<Running, Schema.TaggedStruct<"Running",
|
|
|
322
317
|
readonly restartStamps: Schema.$Array<Schema.Int>;
|
|
323
318
|
readonly nextOrdinal: Schema.Int;
|
|
324
319
|
}>;
|
|
325
|
-
}>, {
|
|
320
|
+
}>, {
|
|
321
|
+
readonly brand: unique symbol;
|
|
322
|
+
}>;
|
|
326
323
|
declare class Running extends Running_base {
|
|
327
324
|
readonly [StateTypeId]: symbol;
|
|
328
325
|
}
|
|
@@ -376,7 +373,9 @@ declare const Restarting_base: Schema.Class<Restarting, Schema.TaggedStruct<"Res
|
|
|
376
373
|
readonly childId: Schema.String;
|
|
377
374
|
readonly generation: Schema.Int;
|
|
378
375
|
}>>;
|
|
379
|
-
}>, {
|
|
376
|
+
}>, {
|
|
377
|
+
readonly brand: unique symbol;
|
|
378
|
+
}>;
|
|
380
379
|
declare class Restarting extends Restarting_base {
|
|
381
380
|
readonly [StateTypeId]: symbol;
|
|
382
381
|
}
|
|
@@ -427,7 +426,9 @@ declare const CoolingDown_base: Schema.Class<CoolingDown, Schema.TaggedStruct<"C
|
|
|
427
426
|
readonly nextOrdinal: Schema.Int;
|
|
428
427
|
}>;
|
|
429
428
|
readonly millis: Schema.Int;
|
|
430
|
-
}>, {
|
|
429
|
+
}>, {
|
|
430
|
+
readonly brand: unique symbol;
|
|
431
|
+
}>;
|
|
431
432
|
declare class CoolingDown extends CoolingDown_base {
|
|
432
433
|
readonly [StateTypeId]: symbol;
|
|
433
434
|
}
|
|
@@ -493,7 +494,9 @@ declare const ShuttingDown_base: Schema.Class<ShuttingDown, Schema.TaggedStruct<
|
|
|
493
494
|
readonly childId: Schema.String;
|
|
494
495
|
readonly generation: Schema.Int;
|
|
495
496
|
}>]>;
|
|
496
|
-
}>, {
|
|
497
|
+
}>, {
|
|
498
|
+
readonly brand: unique symbol;
|
|
499
|
+
}>;
|
|
497
500
|
declare class ShuttingDown extends ShuttingDown_base {
|
|
498
501
|
readonly [StateTypeId]: symbol;
|
|
499
502
|
}
|
|
@@ -510,16 +513,18 @@ declare const Terminated_base: Schema.Class<Terminated, Schema.TaggedStruct<"Ter
|
|
|
510
513
|
readonly waitedMillis: Schema.Int;
|
|
511
514
|
}>]>;
|
|
512
515
|
}>]>;
|
|
513
|
-
}>, {
|
|
516
|
+
}>, {
|
|
517
|
+
readonly brand: unique symbol;
|
|
518
|
+
}>;
|
|
514
519
|
declare class Terminated extends Terminated_base {
|
|
515
520
|
readonly [StateTypeId]: symbol;
|
|
516
521
|
}
|
|
517
522
|
declare const SupervisorState: Schema.Union<readonly [typeof Running, typeof Restarting, typeof CoolingDown, typeof ShuttingDown, typeof Terminated]>;
|
|
518
523
|
type SupervisorState = typeof SupervisorState.Type;
|
|
519
|
-
//#endregion
|
|
520
|
-
//#region src/kernel/interpret-supervision-event.workflow.d.ts
|
|
521
524
|
declare const DecisionTypeId: unique symbol;
|
|
522
|
-
declare const Stale_base: Schema.Class<Stale, Schema.TaggedStruct<"Stale", {}>, {
|
|
525
|
+
declare const Stale_base: Schema.Class<Stale, Schema.TaggedStruct<"Stale", {}>, {
|
|
526
|
+
readonly brand: unique symbol;
|
|
527
|
+
}>;
|
|
523
528
|
declare class Stale extends Stale_base {
|
|
524
529
|
readonly [DecisionTypeId]: symbol;
|
|
525
530
|
}
|
|
@@ -618,7 +623,9 @@ declare const Continue_base: Schema.Class<Continue, Schema.TaggedStruct<"Continu
|
|
|
618
623
|
}>]>;
|
|
619
624
|
}>>;
|
|
620
625
|
}>;
|
|
621
|
-
}>, {
|
|
626
|
+
}>, {
|
|
627
|
+
readonly brand: unique symbol;
|
|
628
|
+
}>;
|
|
622
629
|
declare class Continue extends Continue_base {
|
|
623
630
|
readonly [DecisionTypeId]: symbol;
|
|
624
631
|
}
|
|
@@ -721,7 +728,9 @@ declare const RestartChildren_base: Schema.Class<RestartChildren, Schema.TaggedS
|
|
|
721
728
|
}>]>;
|
|
722
729
|
}>>;
|
|
723
730
|
}>;
|
|
724
|
-
}>, {
|
|
731
|
+
}>, {
|
|
732
|
+
readonly brand: unique symbol;
|
|
733
|
+
}>;
|
|
725
734
|
declare class RestartChildren extends RestartChildren_base {
|
|
726
735
|
readonly [DecisionTypeId]: symbol;
|
|
727
736
|
}
|
|
@@ -820,7 +829,9 @@ declare const StartChildren_base: Schema.Class<StartChildren, Schema.TaggedStruc
|
|
|
820
829
|
}>]>;
|
|
821
830
|
}>>;
|
|
822
831
|
}>;
|
|
823
|
-
}>, {
|
|
832
|
+
}>, {
|
|
833
|
+
readonly brand: unique symbol;
|
|
834
|
+
}>;
|
|
824
835
|
declare class StartChildren extends StartChildren_base {
|
|
825
836
|
readonly [DecisionTypeId]: symbol;
|
|
826
837
|
}
|
|
@@ -920,7 +931,9 @@ declare const CoolDown_base: Schema.Class<CoolDown, Schema.TaggedStruct<"CoolDow
|
|
|
920
931
|
}>]>;
|
|
921
932
|
}>>;
|
|
922
933
|
}>;
|
|
923
|
-
}>, {
|
|
934
|
+
}>, {
|
|
935
|
+
readonly brand: unique symbol;
|
|
936
|
+
}>;
|
|
924
937
|
declare class CoolDown extends CoolDown_base {
|
|
925
938
|
readonly [DecisionTypeId]: symbol;
|
|
926
939
|
}
|
|
@@ -1035,7 +1048,9 @@ declare const StopChildren_base: Schema.Class<StopChildren, Schema.TaggedStruct<
|
|
|
1035
1048
|
}>]>;
|
|
1036
1049
|
}>>;
|
|
1037
1050
|
}>;
|
|
1038
|
-
}>, {
|
|
1051
|
+
}>, {
|
|
1052
|
+
readonly brand: unique symbol;
|
|
1053
|
+
}>;
|
|
1039
1054
|
declare class StopChildren extends StopChildren_base {
|
|
1040
1055
|
readonly [DecisionTypeId]: symbol;
|
|
1041
1056
|
}
|
|
@@ -1101,7 +1116,9 @@ declare const Terminate_base: Schema.Class<Terminate, Schema.TaggedStruct<"Termi
|
|
|
1101
1116
|
}>]>;
|
|
1102
1117
|
}>>;
|
|
1103
1118
|
}>;
|
|
1104
|
-
}>, {
|
|
1119
|
+
}>, {
|
|
1120
|
+
readonly brand: unique symbol;
|
|
1121
|
+
}>;
|
|
1105
1122
|
declare class Terminate extends Terminate_base {
|
|
1106
1123
|
readonly [DecisionTypeId]: symbol;
|
|
1107
1124
|
}
|
|
@@ -1155,14 +1172,14 @@ declare const RefuseDynamicStart_base: Schema.Class<RefuseDynamicStart, Schema.T
|
|
|
1155
1172
|
}>]>;
|
|
1156
1173
|
}>>;
|
|
1157
1174
|
}>;
|
|
1158
|
-
}>, {
|
|
1175
|
+
}>, {
|
|
1176
|
+
readonly brand: unique symbol;
|
|
1177
|
+
}>;
|
|
1159
1178
|
declare class RefuseDynamicStart extends RefuseDynamicStart_base {
|
|
1160
1179
|
readonly [DecisionTypeId]: symbol;
|
|
1161
1180
|
}
|
|
1162
1181
|
declare const SupervisionDecision: Schema.Union<readonly [typeof Stale, typeof Continue, typeof RestartChildren, typeof StartChildren, typeof CoolDown, typeof StopChildren, typeof Terminate, typeof RefuseDynamicStart]>;
|
|
1163
1182
|
type SupervisionDecision = typeof SupervisionDecision.Type;
|
|
1164
|
-
//#endregion
|
|
1165
|
-
//#region src/kernel/SupervisionEvent.schema.d.ts
|
|
1166
1183
|
declare const SupervisionEvent: Schema.Union<readonly [Schema.TaggedStruct<"SupervisorStarted", {
|
|
1167
1184
|
readonly at: Schema.Int;
|
|
1168
1185
|
}>, Schema.TaggedStruct<"ChildStarted", {
|
|
@@ -1229,8 +1246,6 @@ declare const SupervisionEvent: Schema.Union<readonly [Schema.TaggedStruct<"Supe
|
|
|
1229
1246
|
}>]>;
|
|
1230
1247
|
}>]>;
|
|
1231
1248
|
type SupervisionEvent = typeof SupervisionEvent.Type;
|
|
1232
|
-
//#endregion
|
|
1233
|
-
//#region src/Supervisor/bound-child.d.ts
|
|
1234
1249
|
interface Incarnation {
|
|
1235
1250
|
readonly evidence: Started;
|
|
1236
1251
|
readonly scope: Scope.Closeable;
|
|
@@ -1241,8 +1256,6 @@ interface BoundChild {
|
|
|
1241
1256
|
readonly probe: (incarnation: Incarnation) => Effect.Effect<boolean, never, never>;
|
|
1242
1257
|
readonly stop: (incarnation: Incarnation, mode: ShutdownMode) => Effect.Effect<Stopped, never, never>;
|
|
1243
1258
|
}
|
|
1244
|
-
//#endregion
|
|
1245
|
-
//#region src/Supervisor/DynamicOutcome.schema.d.ts
|
|
1246
1259
|
declare const DynamicStartAccepted: Schema.Struct<{
|
|
1247
1260
|
readonly outcome: Schema.Literal<"accepted">;
|
|
1248
1261
|
readonly childId: Schema.String;
|
|
@@ -1287,8 +1300,6 @@ declare const DynamicOutcome: Schema.Union<readonly [Schema.Union<readonly [Sche
|
|
|
1287
1300
|
readonly outcome: Schema.Literal<"missed">;
|
|
1288
1301
|
}>]>]>;
|
|
1289
1302
|
type DynamicOutcome = typeof DynamicOutcome.Type;
|
|
1290
|
-
//#endregion
|
|
1291
|
-
//#region src/Supervisor/running-supervisor.handle.d.ts
|
|
1292
1303
|
/** Brands a running supervisor handle. */
|
|
1293
1304
|
declare const TypeId: unique symbol;
|
|
1294
1305
|
/** The running supervisor brand. */
|
|
@@ -1354,8 +1365,6 @@ declare const stopChild: {
|
|
|
1354
1365
|
(childId: ChildId, generation: Generation): (self: RunningSupervisor) => Effect.Effect<DynamicOutcome, SupervisorTerminated>;
|
|
1355
1366
|
(self: RunningSupervisor, childId: ChildId, generation: Generation): Effect.Effect<DynamicOutcome, SupervisorTerminated>;
|
|
1356
1367
|
};
|
|
1357
|
-
//#endregion
|
|
1358
|
-
//#region src/Supervisor/Supervisor.d.ts
|
|
1359
1368
|
declare const SpecTypeId: unique symbol;
|
|
1360
1369
|
type SpecTypeId = typeof SpecTypeId;
|
|
1361
1370
|
/** A fiber-hosted child: a bare effect, a function of `ready`, or a nested spec. */
|
|
@@ -1460,5 +1469,4 @@ declare const child: {
|
|
|
1460
1469
|
declare namespace mod_d_exports {
|
|
1461
1470
|
export { BareFiberProgram, ChildOptions, ChildProgram, ChildSpec, ChildSpecs, ClassifyChildExit, DynamicOptions, DynamicOutcome, DynamicStartAccepted, DynamicStartOutcome, DynamicStartRefused, DynamicStopDone, DynamicStopMissed, DynamicStopOutcome, FiberChild, FiberMedium_d_exports as FiberMedium, FiberProgram, Medium_d_exports as Medium, RunningSupervisor, SpecTypeId, SupervisorSpec, SupervisorTerminated, TraceEntry, TypeId, autoShutdown, awaitTerminated, backoff, child, children, classifyChildExit, coolDown, dynamic, intensity, isRunningSupervisor, isSupervisorSpec, livenessTick, make, readyOnStart, shutdown, startChild, statusOf, stopChild, strategy, traceOf };
|
|
1462
1471
|
}
|
|
1463
|
-
//#endregion
|
|
1464
1472
|
export { mod_d_exports as Supervisor };
|
package/dist/index.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D3KUYPsf.mjs";
|
|
2
2
|
import { Handle, Sandwich, Workflow } from "@systemfsoftware/effect-cell-types";
|
|
3
3
|
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";
|
|
4
4
|
import * as Result$1 from "effect/Result";
|
|
5
5
|
import { absurd, dual } from "effect/Function";
|
|
6
6
|
import * as Stream from "effect/Stream";
|
|
7
7
|
import { Prototype } from "effect/Pipeable";
|
|
8
|
-
|
|
8
|
+
// src/kernel/SupervisionLimits.schema.ts
|
|
9
9
|
/**
|
|
10
10
|
* Generation-only bound: the production domains below span the whole
|
|
11
11
|
* non-negative safe-integer range, but unbounded generation would draw
|
|
12
12
|
* astronomically large counters and times in property tests
|
|
13
|
-
* (compound-packs/schema-
|
|
13
|
+
* (compound-packs/schema-modelling/generation-constraints-the-derivation-reads.md). An
|
|
14
14
|
* annotation-only check never rejects a value; it only steers the derived
|
|
15
15
|
* fast-check integer generator into a small range.
|
|
16
16
|
*/
|
|
@@ -54,8 +54,7 @@ const Ordinal = NonNegativeSafeInt.pipe(Schema.check(generatedBetween(0, 1024)))
|
|
|
54
54
|
const ChildId = Schema.String;
|
|
55
55
|
const RequestId = Schema.String;
|
|
56
56
|
Schema.decodeResult(Ceiling);
|
|
57
|
-
|
|
58
|
-
//#region src/kernel/TerminationReport.schema.ts
|
|
57
|
+
// src/kernel/TerminationReport.schema.ts
|
|
59
58
|
/**
|
|
60
59
|
* What a medium can say about why a child died (R16): a fiber supplies a cause, a process
|
|
61
60
|
* supplies an exit status and signal, and a remote runner's death is inferred. No event
|
|
@@ -103,8 +102,7 @@ const abnormalReasonOfCause = (cause) => ({
|
|
|
103
102
|
}
|
|
104
103
|
});
|
|
105
104
|
const terminationReasonOfCause = (cause) => Option.getOrElse(Cause.findErrorOption(cause), () => abnormalReasonOfCause(cause));
|
|
106
|
-
|
|
107
|
-
//#region src/Supervisor/ChildExitDecision.schema.ts
|
|
105
|
+
// src/Supervisor/ChildExitDecision.schema.ts
|
|
108
106
|
const ChildExitTypeId = Symbol.for("@systemfsoftware/effect-daemon-spec/ChildExitDecision");
|
|
109
107
|
/** The child ended on its own success. */
|
|
110
108
|
var NormalExit = class extends Schema.TaggedClass()("Normal", {}) {
|
|
@@ -127,8 +125,7 @@ const NORMAL = { _tag: "Normal" };
|
|
|
127
125
|
const SHUTDOWN = { _tag: "Shutdown" };
|
|
128
126
|
const causeOf = (exit) => exit.pipe(Exit.getCause, Option.getOrElse(() => Cause.empty));
|
|
129
127
|
const terminationReasonOf = (bearing) => Match.value(bearing.decision).pipe(Match.tag("Normal", () => NORMAL), Match.tag("Shutdown", () => SHUTDOWN), Match.tag("Abnormal", () => bearing.exit.pipe(causeOf, abnormalReasonOfCause)), Match.exhaustive);
|
|
130
|
-
|
|
131
|
-
//#region src/Supervisor/classify-child-exit.workflow.ts
|
|
128
|
+
// src/Supervisor/classify-child-exit.workflow.ts
|
|
132
129
|
var ClassifyChildExit = class extends Schema.TaggedClass()("ClassifyChildExit", {
|
|
133
130
|
stopping: Schema.Boolean,
|
|
134
131
|
exit: Schema.Exit(Schema.Void, Schema.Unknown, Schema.Unknown)
|
|
@@ -147,8 +144,7 @@ const classifyChildExit = Workflow.make({
|
|
|
147
144
|
error: Schema.Never,
|
|
148
145
|
decide: (command) => Result$1.succeed(decisionOf$1(command))
|
|
149
146
|
});
|
|
150
|
-
|
|
151
|
-
//#region src/kernel/SupervisorPolicy.schema.ts
|
|
147
|
+
// src/kernel/SupervisorPolicy.schema.ts
|
|
152
148
|
const RestartStrategy = Schema.Literals([
|
|
153
149
|
"one_for_one",
|
|
154
150
|
"one_for_all",
|
|
@@ -263,8 +259,7 @@ const workerShutdown = {
|
|
|
263
259
|
};
|
|
264
260
|
const supervisorShutdown = { _tag: "Infinity" };
|
|
265
261
|
const childShutdownOf = (nested) => Match.value(nested).pipe(Match.when(true, () => supervisorShutdown), Match.when(false, () => workerShutdown), Match.exhaustive);
|
|
266
|
-
|
|
267
|
-
//#region src/Supervisor/MediumDeclaration.schema.ts
|
|
262
|
+
// src/Supervisor/MediumDeclaration.schema.ts
|
|
268
263
|
/**
|
|
269
264
|
* What a medium can say about why a child died (R16, KTD8): the in-process fiber
|
|
270
265
|
* medium reports a full `Cause`, a process, socket or microVM medium reports the
|
|
@@ -292,8 +287,7 @@ const MediumDeclaration = Schema.Struct({
|
|
|
292
287
|
reporting: MediumReporting,
|
|
293
288
|
groupStop: GroupStopGuarantee
|
|
294
289
|
});
|
|
295
|
-
|
|
296
|
-
//#region src/Supervisor/Medium.ts
|
|
290
|
+
// src/Supervisor/Medium.ts
|
|
297
291
|
var Medium_exports = /* @__PURE__ */ __exportAll({
|
|
298
292
|
AbnormalTermination: () => AbnormalTermination,
|
|
299
293
|
BrutalShutdown: () => BrutalShutdown,
|
|
@@ -338,8 +332,7 @@ const make$1 = (options) => ({
|
|
|
338
332
|
});
|
|
339
333
|
/** Declare a medium port keyed to the program type it interprets (KTD9). */
|
|
340
334
|
const MediumPort = (key) => Context.Service(key);
|
|
341
|
-
|
|
342
|
-
//#region src/Supervisor/FiberMedium.ts
|
|
335
|
+
// src/Supervisor/FiberMedium.ts
|
|
343
336
|
var FiberMedium_exports = /* @__PURE__ */ __exportAll({
|
|
344
337
|
failureCauseOf: () => failureCauseOf,
|
|
345
338
|
fiberPort: () => fiberPort,
|
|
@@ -399,8 +392,7 @@ const mediumFor = () => make$1({
|
|
|
399
392
|
})
|
|
400
393
|
});
|
|
401
394
|
const medium = mediumFor();
|
|
402
|
-
|
|
403
|
-
//#region src/Supervisor/bound-child.ts
|
|
395
|
+
// src/Supervisor/bound-child.ts
|
|
404
396
|
const rendered = (failure) => abnormalReasonOfCause(Cause.fail(failure));
|
|
405
397
|
const startOf = (program, medium, context) => Effect.gen(function* () {
|
|
406
398
|
const parent = yield* Effect.scope;
|
|
@@ -422,8 +414,7 @@ const bind = (program, medium, context) => ({
|
|
|
422
414
|
stop: (incarnation, mode) => Effect.ensuring(Effect.setContext(medium.stop(incarnation.evidence, mode), context), Scope.close(incarnation.scope, Exit.void))
|
|
423
415
|
});
|
|
424
416
|
const Binder = { bind };
|
|
425
|
-
|
|
426
|
-
//#region src/Supervisor/DynamicOutcome.schema.ts
|
|
417
|
+
// src/Supervisor/DynamicOutcome.schema.ts
|
|
427
418
|
const DynamicStartAccepted = Schema.Struct({
|
|
428
419
|
outcome: Schema.Literal("accepted"),
|
|
429
420
|
childId: ChildId,
|
|
@@ -441,8 +432,7 @@ const outcomeOf = (reply) => Match.value(reply).pipe(Match.tag("ReplyStartAccept
|
|
|
441
432
|
generation: accepted.generation
|
|
442
433
|
})), Match.tag("ReplyStartRefused", () => ({ outcome: "refused" })), Match.tag("ReplyStopped", () => ({ outcome: "stopped" })), Match.exhaustive);
|
|
443
434
|
const staleOf = (event) => Match.value(event).pipe(Match.when({ _tag: "DynamicStartRequested" }, () => ({ outcome: "refused" })), Match.orElse(() => ({ outcome: "missed" })));
|
|
444
|
-
|
|
445
|
-
//#region src/Supervisor/running-supervisor.handle.ts
|
|
435
|
+
// src/Supervisor/running-supervisor.handle.ts
|
|
446
436
|
/** Brands a running supervisor handle. */
|
|
447
437
|
const TypeId = Symbol.for("@systemfsoftware/effect-daemon-spec/RunningSupervisor");
|
|
448
438
|
const RunningSupervisorDef = Handle.make()(TypeId);
|
|
@@ -532,8 +522,7 @@ const Ops = {
|
|
|
532
522
|
resolveWaiting,
|
|
533
523
|
staleOf
|
|
534
524
|
};
|
|
535
|
-
|
|
536
|
-
//#region src/kernel/SupervisorState.schema.ts
|
|
525
|
+
// src/kernel/SupervisorState.schema.ts
|
|
537
526
|
const StateTypeId = Symbol.for("@systemfsoftware/effect-daemon/SupervisorState");
|
|
538
527
|
const ChildStatus = Schema.Literals([
|
|
539
528
|
"starting",
|
|
@@ -623,8 +612,7 @@ const evolved = dual(2, (state, decision) => Match.value(decision).pipe(Match.ta
|
|
|
623
612
|
reason: stopping.reason,
|
|
624
613
|
exit: stopping.exit
|
|
625
614
|
})), Match.tag("Terminate", (terminated) => new Terminated({ reason: terminated.reason })), Match.exhaustive));
|
|
626
|
-
|
|
627
|
-
//#region src/kernel/SupervisionEvent.schema.ts
|
|
615
|
+
// src/kernel/SupervisionEvent.schema.ts
|
|
628
616
|
const TimerKind = Schema.Literals([
|
|
629
617
|
"start_deadline",
|
|
630
618
|
"backoff",
|
|
@@ -701,8 +689,7 @@ const SupervisionEvent = Schema.Union([
|
|
|
701
689
|
DynamicStopRequested,
|
|
702
690
|
ShutdownRequested
|
|
703
691
|
]);
|
|
704
|
-
|
|
705
|
-
//#region src/kernel/SupervisorCommand.schema.ts
|
|
692
|
+
// src/kernel/SupervisorCommand.schema.ts
|
|
706
693
|
const StartChild = Schema.TaggedStruct("StartChild", {
|
|
707
694
|
childId: ChildId,
|
|
708
695
|
generation: Generation
|
|
@@ -756,20 +743,18 @@ const SupervisorCommands = Schema.Struct({
|
|
|
756
743
|
replies: Schema.Array(SupervisorReply),
|
|
757
744
|
terminates: Schema.Array(TerminateSupervisor)
|
|
758
745
|
});
|
|
759
|
-
|
|
760
|
-
//#region src/Supervisor/SupervisorTerminated.schema.ts
|
|
746
|
+
// src/Supervisor/SupervisorTerminated.schema.ts
|
|
761
747
|
const firstLine = (text) => text.split("\n")[0] ?? "";
|
|
762
748
|
var SupervisorTerminated = class extends Schema.TaggedError()("SupervisorTerminated", {
|
|
763
|
-
|
|
749
|
+
supervisor: Schema.String,
|
|
764
750
|
reason: TerminationReason,
|
|
765
751
|
cause: Schema.Cause(Schema.Unknown, Schema.Unknown)
|
|
766
752
|
}) {
|
|
767
753
|
get message() {
|
|
768
|
-
return `Supervisor "${this.
|
|
754
|
+
return `Supervisor "${this.supervisor}" terminated (${this.reason._tag}): ${firstLine(Cause.pretty(this.cause))}`;
|
|
769
755
|
}
|
|
770
756
|
};
|
|
771
|
-
|
|
772
|
-
//#region src/Supervisor/supervisor-commands.ts
|
|
757
|
+
// src/Supervisor/supervisor-commands.ts
|
|
773
758
|
const Steps = { runtimeOf: (acquired) => ({ acquired }) };
|
|
774
759
|
const stampedNow = (handle, event) => Effect.flatMap(Clock.currentTimeMillis, (now) => offerEvent(handle, {
|
|
775
760
|
...event,
|
|
@@ -868,7 +853,7 @@ const giveUpCauseOf = (handle, exit, reason) => Effect.flatMap(Ref.get(evidenceO
|
|
|
868
853
|
}));
|
|
869
854
|
const clearEvidence = (handle) => Ref.update(evidenceOf(handle), () => HashMap.empty());
|
|
870
855
|
const executeTerminate = (acquired, command) => Match.value(command.exit).pipe(Match.tag("RequestedExit", () => Effect.andThen(clearEvidence(acquired.handle), Effect.asVoid(Deferred.succeed(terminatedLatchOf(acquired.handle), void 0)))), Match.tag("IntensityExceededExit", (exit) => Effect.flatMap(giveUpCauseOf(acquired.handle, exit, command.reason), (cause) => Effect.andThen(clearEvidence(acquired.handle), Effect.asVoid(Deferred.fail(terminatedLatchOf(acquired.handle), new SupervisorTerminated({
|
|
871
|
-
|
|
856
|
+
supervisor: acquired.handle.name,
|
|
872
857
|
reason: command.reason,
|
|
873
858
|
cause
|
|
874
859
|
})))))), Match.exhaustive);
|
|
@@ -903,8 +888,7 @@ const answerStale = (acquired, event) => {
|
|
|
903
888
|
const requestId = requestIdOf(event);
|
|
904
889
|
return requestId === void 0 ? Effect.void : Ops.resolveWaiting(repliesOf(acquired.handle), requestId, Ops.staleOf(event));
|
|
905
890
|
};
|
|
906
|
-
|
|
907
|
-
//#region src/kernel/interpret-supervision-event.workflow.ts
|
|
891
|
+
// src/kernel/interpret-supervision-event.workflow.ts
|
|
908
892
|
const DecisionTypeId = Symbol.for("@systemfsoftware/effect-daemon/SupervisionDecision");
|
|
909
893
|
var Stale = class extends Schema.TaggedClass()("Stale", {}) {
|
|
910
894
|
[DecisionTypeId] = DecisionTypeId;
|
|
@@ -1046,7 +1030,7 @@ const withStamps = (core, restartStamps) => ({
|
|
|
1046
1030
|
restartStamps
|
|
1047
1031
|
});
|
|
1048
1032
|
const prunedStamps = (core, at) => Array.filter(core.restartStamps, (stamp) => at - stamp <= core.policy.periodMillis);
|
|
1049
|
-
const backoffDelay = (schedule, consecutiveRestarts) => Match.value(schedule.baseMillis).pipe(Match.when(
|
|
1033
|
+
const backoffDelay = (schedule, consecutiveRestarts) => Match.value(schedule.baseMillis === 0).pipe(Match.when(true, () => 0), Match.when(false, () => Number$1.min(schedule.capMillis, schedule.baseMillis * schedule.multiplier ** consecutiveRestarts)), Match.exhaustive);
|
|
1050
1034
|
const startCommandOf = (start) => ({
|
|
1051
1035
|
_tag: "StartChild",
|
|
1052
1036
|
childId: start.childId,
|
|
@@ -1110,10 +1094,13 @@ const holdOf = (core) => new Continue({
|
|
|
1110
1094
|
});
|
|
1111
1095
|
const terminatedReason = { _tag: "Shutdown" };
|
|
1112
1096
|
const requestedExit = { _tag: "RequestedExit" };
|
|
1113
|
-
const failureReportOf = (reason) => Match.value(reason).pipe(Match.tag("Abnormal", (abnormal) => abnormal.report), Match.
|
|
1097
|
+
const failureReportOf = (reason) => Match.value(reason).pipe(Match.tag("Abnormal", (abnormal) => abnormal.report), Match.tag("Normal", () => ({
|
|
1114
1098
|
_tag: "CauseReport",
|
|
1115
1099
|
cause: Cause.pretty(Cause.fail(reason))
|
|
1116
|
-
})))
|
|
1100
|
+
})), Match.tag("Shutdown", () => ({
|
|
1101
|
+
_tag: "CauseReport",
|
|
1102
|
+
cause: Cause.pretty(Cause.fail(reason))
|
|
1103
|
+
})), Match.exhaustive);
|
|
1117
1104
|
const giveUpReasonOf = (termination) => ({
|
|
1118
1105
|
_tag: "Abnormal",
|
|
1119
1106
|
report: failureReportOf(termination.reason)
|
|
@@ -1153,8 +1140,8 @@ const restartScopeOf = (core, failedIndex, termination) => {
|
|
|
1153
1140
|
stops: Array.map(Array.reverse(group), (child) => stopCommandOf(core.policy, child))
|
|
1154
1141
|
};
|
|
1155
1142
|
};
|
|
1156
|
-
const restartedChildrenOf = (core, scope) => Array.flatMap(core.children, (child) => Match.value(Array.contains(scope.comingIds, child.childId)).pipe(Match.when(true, () => [restartingOf(child, child.generation + 1)]), Match.
|
|
1157
|
-
const removalRemnant = (removedIds, child) => Match.value(Array.contains(removedIds, child.childId)).pipe(Match.when(true, () => []), Match.
|
|
1143
|
+
const restartedChildrenOf = (core, scope) => Array.flatMap(core.children, (child) => Match.value(Array.contains(scope.comingIds, child.childId)).pipe(Match.when(true, () => [restartingOf(child, child.generation + 1)]), Match.when(false, () => removalRemnant(scope.removedIds, child)), Match.exhaustive));
|
|
1144
|
+
const removalRemnant = (removedIds, child) => Match.value(Array.contains(removedIds, child.childId)).pipe(Match.when(true, () => []), Match.when(false, () => [child]), Match.exhaustive);
|
|
1158
1145
|
const phasedCommands = (core, at, coming) => {
|
|
1159
1146
|
const steps = Array.map(coming, (child) => {
|
|
1160
1147
|
return {
|
|
@@ -1244,7 +1231,8 @@ const restartSplitOf = (core, failedIndex, termination) => Match.value(failedCom
|
|
|
1244
1231
|
outcome: restartOutcomeOf(core, restartScopeOf(core, failedIndex, termination), termination.at)
|
|
1245
1232
|
})), Match.when(false, () => quietSplitOf(core, failedIndex)), Match.exhaustive);
|
|
1246
1233
|
const terminatedIndexed = (core, failedIndex, termination) => Match.value(restartSplitOf(core, failedIndex, termination)).pipe(Match.tag("Restarted", (restarted) => restartedDecisionOf(core, restarted.outcome, termination)), Match.tag("Quiet", (quiet) => shutdownOrContinue(core, Array.filter(core.children, (child) => Array.contains(quiet.removedIds, child.childId)), quiet.remaining)), Match.exhaustive);
|
|
1247
|
-
const
|
|
1234
|
+
const terminatedIfIndexed = (core, child, termination) => Match.value(indexOfChild(core, child.childId)).pipe(Match.tag("Some", (index) => terminatedIndexed(core, index.value, termination)), Match.tag("None", () => new Stale({})), Match.exhaustive);
|
|
1235
|
+
const terminatedCurrent = (core, child, termination) => Match.value(child.status).pipe(Match.when("starting", () => terminatedIfIndexed(core, child, termination)), Match.when("ready", () => terminatedIfIndexed(core, child, termination)), Match.when("stopping", () => removalContinue(core, termination)), Match.exhaustive);
|
|
1248
1236
|
const removalOf = (core, childId, generation) => withChildren(core, Array.filter(core.children, (child) => incarnationMatches(childId, generation)(child) === false));
|
|
1249
1237
|
const removalContinue = (core, termination) => new Continue({
|
|
1250
1238
|
core: removalOf(core, termination.childId, termination.generation),
|
|
@@ -1259,7 +1247,7 @@ const becomingReady = (core, child, at) => Match.value(child.status).pipe(Match.
|
|
|
1259
1247
|
core: withChildren(core, Array.map(core.children, replacing(next))),
|
|
1260
1248
|
commands: commandsIn({ arms: [tickCommandOf(next, at + core.policy.livenessTickMillis)] })
|
|
1261
1249
|
});
|
|
1262
|
-
}), Match.
|
|
1250
|
+
}), Match.when("ready", () => holdOf(core)), Match.when("stopping", () => holdOf(core)), Match.exhaustive);
|
|
1263
1251
|
const stoppedInShuttingDown = (core, reason, exit, childId, generation) => {
|
|
1264
1252
|
const next = removalOf(core, childId, generation);
|
|
1265
1253
|
return Match.value(Array.every(next.children, (child) => child.status !== "stopping")).pipe(Match.when(true, () => terminateDecisionOf(reason, exit)), Match.when(false, () => new Continue({
|
|
@@ -1268,7 +1256,7 @@ const stoppedInShuttingDown = (core, reason, exit, childId, generation) => {
|
|
|
1268
1256
|
})), Match.exhaustive);
|
|
1269
1257
|
};
|
|
1270
1258
|
const probedInRunning = (core, childId, generation, alive, at) => Match.value(currentIncarnation(core, childId, generation)).pipe(Match.tag("None", () => new Stale({})), Match.tag("Some", (found) => probedOutcomeOf(core, found.value, alive, at)), Match.exhaustive);
|
|
1271
|
-
const probedOutcomeOf = (core, child, alive, at) => Match.value(child.status).pipe(Match.when("ready", () => probedReadyOutcomeOf(core, child, alive, at)), Match.
|
|
1259
|
+
const probedOutcomeOf = (core, child, alive, at) => Match.value(child.status).pipe(Match.when("ready", () => probedReadyOutcomeOf(core, child, alive, at)), Match.when("starting", () => holdOf(core)), Match.when("stopping", () => holdOf(core)), Match.exhaustive);
|
|
1272
1260
|
const probedReadyOutcomeOf = (core, child, alive, at) => Match.value(alive).pipe(Match.when(true, () => new Continue({
|
|
1273
1261
|
core: withChildren(core, Array.map(core.children, replacing(probedAs(child, true)))),
|
|
1274
1262
|
commands: noCommands
|
|
@@ -1295,11 +1283,11 @@ const deadlineInRunning = (core, child, at) => Match.value(child.status).pipe(Ma
|
|
|
1295
1283
|
}
|
|
1296
1284
|
},
|
|
1297
1285
|
at
|
|
1298
|
-
})), Match.
|
|
1286
|
+
})), Match.when("ready", () => new Stale({})), Match.when("stopping", () => new Stale({})), Match.exhaustive);
|
|
1299
1287
|
const tickInRunning = (core, child, at) => Match.value(child.status).pipe(Match.when("ready", () => new Continue({
|
|
1300
1288
|
core,
|
|
1301
1289
|
commands: commandsIn({ arms: [tickCommandOf(child, at + core.policy.livenessTickMillis)] })
|
|
1302
|
-
})), Match.
|
|
1290
|
+
})), Match.when("starting", () => new Stale({})), Match.when("stopping", () => new Stale({})), Match.exhaustive);
|
|
1303
1291
|
const timerInRunning = (core, childId, generation, kind, at) => Match.value(currentIncarnation(core, childId, generation)).pipe(Match.tag("None", () => new Stale({})), Match.tag("Some", (found) => namedTimerInRunning(core, found.value, kind, at)), Match.exhaustive);
|
|
1304
1292
|
const fireBackoffOf = (core, pending, childId, generation, at) => {
|
|
1305
1293
|
const start = {
|
|
@@ -1320,7 +1308,7 @@ const fireBackoffOf = (core, pending, childId, generation, at) => {
|
|
|
1320
1308
|
commands
|
|
1321
1309
|
})), Match.exhaustive);
|
|
1322
1310
|
};
|
|
1323
|
-
const backoffInRestarting = (core, pending, childId, generation, kind, at) => Match.value(kind).pipe(Match.when("backoff", () => Match.value(Array.findFirst(pending, planMatches(childId, generation))).pipe(Match.tag("None", () => new Stale({})), Match.tag("Some", () => fireBackoffOf(core, pending, childId, generation, at)), Match.exhaustive)), Match.
|
|
1311
|
+
const backoffInRestarting = (core, pending, childId, generation, kind, at) => Match.value(kind).pipe(Match.when("backoff", () => Match.value(Array.findFirst(pending, planMatches(childId, generation))).pipe(Match.tag("None", () => new Stale({})), Match.tag("Some", () => fireBackoffOf(core, pending, childId, generation, at)), Match.exhaustive)), Match.when("start_deadline", () => new Stale({})), Match.when("liveness_tick", () => new Stale({})), Match.when("cool_down", () => new Stale({})), Match.exhaustive);
|
|
1324
1312
|
const cooledStartsOf = (core, at) => {
|
|
1325
1313
|
const fresh = Array.map(core.children, (child) => ({
|
|
1326
1314
|
...child,
|
|
@@ -1412,15 +1400,12 @@ const onChildTerminated = (state, termination) => Match.value(state).pipe(Match.
|
|
|
1412
1400
|
generation: termination.generation,
|
|
1413
1401
|
reason: termination.reason,
|
|
1414
1402
|
at: termination.at
|
|
1415
|
-
})), Match.tag("Restarting", () => new Stale({})), Match.tag("CoolingDown", ({ core }) => holdOf(core)), Match.tag("ShuttingDown", ({ core }) =>
|
|
1416
|
-
const ShuttingDownReasonOf = (state) => Match.value(state).pipe(Match.tag("ShuttingDown", ({ reason }) => reason), Match.orElse(() => terminatedReason));
|
|
1417
|
-
const ShuttingDownExitOf = (state) => Match.value(state).pipe(Match.tag("ShuttingDown", ({ exit }) => exit), Match.orElse(() => requestedExit));
|
|
1418
|
-
const terminatedShuttingDown = (core, reason, exit, termination) => stoppedInShuttingDown(core, reason, exit, termination.childId, termination.generation);
|
|
1403
|
+
})), Match.tag("Restarting", () => new Stale({})), Match.tag("CoolingDown", ({ core }) => holdOf(core)), Match.tag("ShuttingDown", ({ core, reason, exit }) => stoppedInShuttingDown(core, reason, exit, termination.childId, termination.generation)), Match.tag("Terminated", () => new Stale({})), Match.exhaustive);
|
|
1419
1404
|
const stoppedInRunning = (core, childId, generation) => Match.value(currentIncarnation(core, childId, generation)).pipe(Match.tag("Some", () => removalContinue(core, terminationOf(childId, generation, terminatedReason, 0))), Match.tag("None", () => new Stale({})), Match.exhaustive);
|
|
1420
1405
|
const onChildStopped = (state, childId, generation) => Match.value(state).pipe(Match.tag("Running", ({ core }) => stoppedInRunning(core, childId, generation)), Match.tag("Restarting", () => new Stale({})), Match.tag("CoolingDown", ({ core }) => holdOf(core)), Match.tag("ShuttingDown", ({ core, reason, exit }) => stoppedInShuttingDown(core, reason, exit, childId, generation)), Match.tag("Terminated", () => new Stale({})), Match.exhaustive);
|
|
1421
1406
|
const onProbeResult = (state, childId, generation, alive, at) => Match.value(state).pipe(Match.tag("Running", ({ core }) => probedInRunning(core, childId, generation, alive, at)), Match.tag("Restarting", () => new Stale({})), Match.tag("CoolingDown", ({ core }) => holdOf(core)), Match.tag("ShuttingDown", ({ core }) => holdOf(core)), Match.tag("Terminated", () => new Stale({})), Match.exhaustive);
|
|
1422
|
-
const onTimerElapsed = (state, kind,
|
|
1423
|
-
const coolDownElapsedOf = (core, kind, at) => Match.value(kind).pipe(Match.when("cool_down", () => cooledRestartOf(core, at)), Match.
|
|
1407
|
+
const onTimerElapsed = (state, kind, target, at) => Match.value(state).pipe(Match.tag("Running", ({ core }) => Match.value(target).pipe(Match.tag("ChildTimer", (child) => timerInRunning(core, child.childId, child.generation, kind, at)), Match.tag("SupervisorTimer", () => new Stale({})), Match.exhaustive)), Match.tag("Restarting", ({ core, pending }) => Match.value(target).pipe(Match.tag("ChildTimer", (child) => backoffInRestarting(core, pending, child.childId, child.generation, kind, at)), Match.tag("SupervisorTimer", () => new Stale({})), Match.exhaustive)), Match.tag("CoolingDown", ({ core }) => coolDownElapsedOf(core, kind, at)), Match.tag("ShuttingDown", ({ core }) => holdOf(core)), Match.tag("Terminated", () => new Stale({})), Match.exhaustive);
|
|
1408
|
+
const coolDownElapsedOf = (core, kind, at) => Match.value(kind).pipe(Match.when("cool_down", () => cooledRestartOf(core, at)), Match.when("start_deadline", () => new Stale({})), Match.when("backoff", () => new Stale({})), Match.when("liveness_tick", () => new Stale({})), Match.exhaustive);
|
|
1424
1409
|
const onDynamicStartRequested = (state, requestId, at) => Match.value(state).pipe(Match.tag("Running", ({ core }) => dynamicStartOf(core, requestId, at)), Match.tag("Restarting", () => refusedStartOf(requestId)), Match.tag("CoolingDown", () => refusedStartOf(requestId)), Match.tag("ShuttingDown", () => refusedStartOf(requestId)), Match.tag("Terminated", () => new Stale({})), Match.exhaustive);
|
|
1425
1410
|
const onDynamicStopRequested = (state, requestId, childId, generation) => Match.value(state).pipe(Match.tag("Running", ({ core }) => dynamicStopOf(core, requestId, childId, generation)), Match.tag("Restarting", () => new Stale({})), Match.tag("CoolingDown", () => new Stale({})), Match.tag("ShuttingDown", () => new Stale({})), Match.tag("Terminated", () => new Stale({})), Match.exhaustive);
|
|
1426
1411
|
const onShutdownRequested = (state, reason) => Match.value(state).pipe(Match.tag("Running", ({ core }) => stopEverything(core, reason, requestedExit)), Match.tag("Restarting", ({ core }) => stopEverything(core, reason, requestedExit)), Match.tag("CoolingDown", ({ core }) => stopEverything(core, reason, requestedExit)), Match.tag("ShuttingDown", ({ core }) => holdOf(core)), Match.tag("Terminated", () => new Stale({})), Match.exhaustive);
|
|
@@ -1439,15 +1424,14 @@ const bootedChildrenOf = (core, at) => {
|
|
|
1439
1424
|
});
|
|
1440
1425
|
};
|
|
1441
1426
|
const onSupervisorStarted = (state, at) => Match.value(state).pipe(Match.tag("Running", ({ core }) => bootedChildrenOf(core, at)), Match.tag("Restarting", () => new Stale({})), Match.tag("CoolingDown", () => new Stale({})), Match.tag("ShuttingDown", () => new Stale({})), Match.tag("Terminated", () => new Stale({})), Match.exhaustive);
|
|
1442
|
-
const decided = (state, event) => Match.value(event).pipe(Match.tag("SupervisorStarted", (started) => onSupervisorStarted(state, started.at)), Match.tag("ChildStarted", (started) => onChildStarted(state, started.childId, started.generation)), Match.tag("ChildReady", (ready) => onChildReady(state, ready.childId, ready.generation, ready.at)), Match.tag("ChildTerminated", (terminated) => onChildTerminated(state, terminationOf(terminated.childId, terminated.generation, terminated.reason, terminated.at))), Match.tag("ChildStopped", (stopped) => onChildStopped(state, stopped.childId, stopped.generation)), Match.tag("ProbeResult", (probe) => onProbeResult(state, probe.childId, probe.generation, probe.alive, probe.at)), Match.tag("TimerElapsed", (elapsed) =>
|
|
1427
|
+
const decided = (state, event) => Match.value(event).pipe(Match.tag("SupervisorStarted", (started) => onSupervisorStarted(state, started.at)), Match.tag("ChildStarted", (started) => onChildStarted(state, started.childId, started.generation)), Match.tag("ChildReady", (ready) => onChildReady(state, ready.childId, ready.generation, ready.at)), Match.tag("ChildTerminated", (terminated) => onChildTerminated(state, terminationOf(terminated.childId, terminated.generation, terminated.reason, terminated.at))), Match.tag("ChildStopped", (stopped) => onChildStopped(state, stopped.childId, stopped.generation)), Match.tag("ProbeResult", (probe) => onProbeResult(state, probe.childId, probe.generation, probe.alive, probe.at)), Match.tag("TimerElapsed", (elapsed) => onTimerElapsed(state, elapsed.kind, elapsed.target, elapsed.at)), Match.tag("DynamicStartRequested", (requested) => onDynamicStartRequested(state, requested.requestId, requested.at)), Match.tag("DynamicStopRequested", (requested) => onDynamicStopRequested(state, requested.requestId, requested.childId, requested.generation)), Match.tag("ShutdownRequested", (requested) => onShutdownRequested(state, requested.reason)), Match.exhaustive);
|
|
1443
1428
|
const interpretSupervisionEvent = Workflow.make({
|
|
1444
1429
|
command: SupervisionStep,
|
|
1445
1430
|
decision: SupervisionDecision,
|
|
1446
1431
|
error: Schema.Never,
|
|
1447
1432
|
decide: (step) => Result.succeed(decided(step.state, step.event))
|
|
1448
1433
|
});
|
|
1449
|
-
|
|
1450
|
-
//#region src/kernel/evolve-supervisor.workflow.ts
|
|
1434
|
+
// src/kernel/evolve-supervisor.workflow.ts
|
|
1451
1435
|
var SupervisionEvolution = class extends Schema.TaggedClass()("SupervisionEvolution", {
|
|
1452
1436
|
state: SupervisorState,
|
|
1453
1437
|
decision: SupervisionDecision
|
|
@@ -1460,8 +1444,7 @@ const evolveSupervisor = Workflow.make({
|
|
|
1460
1444
|
error: Schema.Never,
|
|
1461
1445
|
decide: (step) => Result.succeed(evolved(step.state, step.decision))
|
|
1462
1446
|
});
|
|
1463
|
-
|
|
1464
|
-
//#region src/Supervisor/supervisor-step.cell.ts
|
|
1447
|
+
// src/Supervisor/supervisor-step.cell.ts
|
|
1465
1448
|
const readStep = (runtime, event) => Effect.map(Effect.zip(Clock.currentTimeMillis, Ref.get(stateOf(runtime.acquired.handle))), ([now, state]) => new SupervisionStep({
|
|
1466
1449
|
state,
|
|
1467
1450
|
event: {
|
|
@@ -1493,8 +1476,7 @@ const supervisorStepFor = (runtime) => Sandwich.named("supervisor.step")((event)
|
|
|
1493
1476
|
RefuseDynamicStart: (decision, command) => Effect.andThen(persistStep(runtime, command.event, command.state, decision), runBucketsOf(runtime, decision.commands)),
|
|
1494
1477
|
CommandRejected: (_rejected, command) => Effect.andThen(persistCommandRejection(runtime, command.event), Commands.answerStale(runtime.acquired, command.event))
|
|
1495
1478
|
});
|
|
1496
|
-
|
|
1497
|
-
//#region src/Supervisor/Supervisor.ts
|
|
1479
|
+
// src/Supervisor/Supervisor.ts
|
|
1498
1480
|
const SpecTypeId = Symbol.for("@systemfsoftware/effect-daemon-spec/SupervisorSpec");
|
|
1499
1481
|
const hasSpecTag = Predicate.hasProperty(SpecTypeId);
|
|
1500
1482
|
const isSupervisorSpec = (value) => hasSpecTag(value) && value[SpecTypeId] === SpecTypeId;
|
|
@@ -1657,8 +1639,7 @@ const children = dual(2, (self, specs) => specOf({
|
|
|
1657
1639
|
}))]
|
|
1658
1640
|
}));
|
|
1659
1641
|
const child = dual((args) => isSupervisorSpec(args[0]), (self, childId, program, options) => children(self, [childSpecMake(childId, program, options)]));
|
|
1660
|
-
|
|
1661
|
-
//#region src/Supervisor/mod.ts
|
|
1642
|
+
// src/Supervisor/mod.ts
|
|
1662
1643
|
var Supervisor_exports = /* @__PURE__ */ __exportAll({
|
|
1663
1644
|
ChildSpecs: () => ChildSpecs,
|
|
1664
1645
|
ClassifyChildExit: () => ClassifyChildExit,
|
|
@@ -1688,5 +1669,4 @@ var Supervisor_exports = /* @__PURE__ */ __exportAll({
|
|
|
1688
1669
|
strategy: () => strategy,
|
|
1689
1670
|
traceOf: () => traceOf
|
|
1690
1671
|
});
|
|
1691
|
-
//#endregion
|
|
1692
1672
|
export { Supervisor_exports as Supervisor };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// \0rolldown/runtime.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __exportAll = (all, flags) => {
|
|
4
|
+
let target = Object.setPrototypeOf({}, null);
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
if (!(flags & 1)) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
|
+
return flags & 2 ? target : Object.preventExtensions(target);
|
|
11
|
+
};
|
|
12
|
+
export { __exportAll as t };
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@systemfsoftware/effect-daemon-spec",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "6.0.
|
|
4
|
+
"version": "6.0.3",
|
|
5
5
|
"author": "Ryan Lee <drdgvhbh@gmail.com>",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/systemfsoftware/
|
|
9
|
-
"directory": "packages/
|
|
8
|
+
"url": "git+https://github.com/systemfsoftware/effect-daemon.git",
|
|
9
|
+
"directory": "packages/effect-daemon-spec"
|
|
10
10
|
},
|
|
11
|
-
"homepage": "https://github.com/systemfsoftware/
|
|
12
|
-
"bugs": "https://github.com/systemfsoftware/
|
|
11
|
+
"homepage": "https://github.com/systemfsoftware/effect-daemon/tree/main/packages/effect-daemon-spec#readme",
|
|
12
|
+
"bugs": "https://github.com/systemfsoftware/effect-daemon/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": [
|
|
15
15
|
"effect",
|
|
@@ -37,42 +37,41 @@
|
|
|
37
37
|
"dist"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@systemfsoftware/effect-cell-types": "^12.0.
|
|
40
|
+
"@systemfsoftware/effect-cell-types": "^12.0.2"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@microsoft/api-extractor": "^7.59.
|
|
43
|
+
"@microsoft/api-extractor": "^7.59.4",
|
|
44
44
|
"@systemfsoftware/arethetypeswrong-cli": "^4.2.0",
|
|
45
|
-
"@systemfsoftware/conformance-spec": "^1.0.
|
|
46
|
-
"@systemfsoftware/effect-gherkin-spec": "^
|
|
47
|
-
"@systemfsoftware/effect-schema-law": "^
|
|
48
|
-
"@systemfsoftware/effect-schema-vite": "^3.
|
|
49
|
-
"@systemfsoftware/effect-spec-runtime": "^1.
|
|
50
|
-
"@systemfsoftware/oxlint-config-recommended": "^
|
|
51
|
-
"@systemfsoftware/stryker-config": "^0.
|
|
45
|
+
"@systemfsoftware/conformance-spec": "^1.0.1",
|
|
46
|
+
"@systemfsoftware/effect-gherkin-spec": "^8.0.0",
|
|
47
|
+
"@systemfsoftware/effect-schema-law": "^6.1.0",
|
|
48
|
+
"@systemfsoftware/effect-schema-vite": "^3.1.1",
|
|
49
|
+
"@systemfsoftware/effect-spec-runtime": "^1.1.0",
|
|
50
|
+
"@systemfsoftware/oxlint-config-recommended": "^5.0.0",
|
|
51
|
+
"@systemfsoftware/stryker-config": "^0.2.0",
|
|
52
52
|
"@systemfsoftware/stryker-ignorer-effect-schema-declarations": "latest",
|
|
53
53
|
"@systemfsoftware/stryker-ignorer-in-source-vitest-block": "latest",
|
|
54
54
|
"@systemfsoftware/stryker-js": "latest",
|
|
55
55
|
"@systemfsoftware/stryker-js-typescript-checker": "latest",
|
|
56
56
|
"@systemfsoftware/stryker-js-vitest-runner": "latest",
|
|
57
|
-
"@systemfsoftware/
|
|
58
|
-
"@systemfsoftware/
|
|
59
|
-
"@systemfsoftware/
|
|
60
|
-
"@systemfsoftware/vitest": "^1.
|
|
61
|
-
"@
|
|
62
|
-
"@
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"oxlint": "~1.82.0",
|
|
57
|
+
"@systemfsoftware/tsconfig": "^2.0.2",
|
|
58
|
+
"@systemfsoftware/tsdown-config": "^0.1.1",
|
|
59
|
+
"@systemfsoftware/vitest": "^3.0.0",
|
|
60
|
+
"@systemfsoftware/vitest-config": "^0.1.1",
|
|
61
|
+
"@types/node": "^26.6.5",
|
|
62
|
+
"@vitest/coverage-v8": "^5.0.5",
|
|
63
|
+
"effect": "4.1.2",
|
|
64
|
+
"fast-check": "^4.10.2",
|
|
65
|
+
"oxlint": "~1.90.0",
|
|
67
66
|
"rimraf": "^6.1.3",
|
|
68
67
|
"tsdown": "^0.23.0",
|
|
69
68
|
"tstyche": "^7.2.5",
|
|
70
|
-
"typescript": "^7",
|
|
71
|
-
"vitest": "^5"
|
|
69
|
+
"typescript": "^7.0.2",
|
|
70
|
+
"vitest": "^5.0.5"
|
|
72
71
|
},
|
|
73
72
|
"peerDependencies": {
|
|
74
|
-
"@systemfsoftware/conformance-spec": "^1.0.
|
|
75
|
-
"effect": "^4"
|
|
73
|
+
"@systemfsoftware/conformance-spec": "^1.0.1",
|
|
74
|
+
"effect": "^4.1.2"
|
|
76
75
|
},
|
|
77
76
|
"peerDependenciesMeta": {
|
|
78
77
|
"@systemfsoftware/conformance-spec": {
|
|
@@ -90,7 +89,6 @@
|
|
|
90
89
|
"test": "vitest run",
|
|
91
90
|
"test:types": "TSTYCHE_TYPESCRIPT_MODULE=tstyche-typescript tstyche",
|
|
92
91
|
"mutation": "stryker run",
|
|
93
|
-
"mutation:full": "stryker run --force",
|
|
94
92
|
"lint": "f=${OXLINT_FORMAT:-${AGENT:+agent}}; oxlint . --format=${f:-default}",
|
|
95
93
|
"api:check": "api-extractor-quiet run",
|
|
96
94
|
"api:update": "api-extractor run --local",
|
package/CHANGELOG.md
DELETED
|
@@ -1,396 +0,0 @@
|
|
|
1
|
-
# @systemfsoftware/effect-daemon-spec
|
|
2
|
-
|
|
3
|
-
## 6.0.0
|
|
4
|
-
|
|
5
|
-
### Major Changes
|
|
6
|
-
|
|
7
|
-
- The supervisor now closes each child incarnation's scope after the medium's `stop` returns, including when `stop` fails. A medium's `stop` no longer closes the scope its `start` ran in; effect 4.0.0's `Scope.close` accepts only `Scope.Closeable`, which the ambient `Scope` is not.
|
|
8
|
-
|
|
9
|
-
- Require `effect` `^4` (stable 4.0.0). Release candidates are no longer supported: imports follow 4.0.0's module layout (`effect/http`, `effect/rpc`, `effect/http-api`, `effect/cluster`, `effect/process`, `effect/socket`, `effect/persistence`, `effect/reactivity`, `effect/encoding`, `effect/Arbitrary`), which does not exist in any 4.0.0 RC.
|
|
10
|
-
|
|
11
|
-
### Patch Changes
|
|
12
|
-
|
|
13
|
-
- Updated dependencies:
|
|
14
|
-
- @systemfsoftware/conformance-spec@1.0.0
|
|
15
|
-
- @systemfsoftware/effect-cell-types@12.0.0
|
|
16
|
-
|
|
17
|
-
## 5.1.0
|
|
18
|
-
|
|
19
|
-
### Minor Changes
|
|
20
|
-
|
|
21
|
-
- `Supervisor.classifyChildExit` is now exported. It takes a `Supervisor.ClassifyChildExit` command (a `stopping` flag and the child's `Exit`) and returns `Normal`, `Shutdown` or `Abnormal`. A stop requested by the supervisor, or an exit caused only by interruption, classifies as `Shutdown`. The fiber, cluster and socket media all use this rule to classify their children's exits.
|
|
22
|
-
|
|
23
|
-
## 5.0.1
|
|
24
|
-
|
|
25
|
-
### Patch Changes
|
|
26
|
-
|
|
27
|
-
- Updated dependencies:
|
|
28
|
-
- @systemfsoftware/effect-cell-types@11.0.0
|
|
29
|
-
|
|
30
|
-
## 5.0.0
|
|
31
|
-
|
|
32
|
-
### Major Changes
|
|
33
|
-
|
|
34
|
-
- 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.
|
|
35
|
-
|
|
36
|
-
- 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`.
|
|
37
|
-
|
|
38
|
-
### Minor Changes
|
|
39
|
-
|
|
40
|
-
- 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.
|
|
41
|
-
|
|
42
|
-
- 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.
|
|
43
|
-
|
|
44
|
-
### Patch Changes
|
|
45
|
-
|
|
46
|
-
- 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.
|
|
47
|
-
|
|
48
|
-
- Update peer and runtime dependency on `effect` and companion packages to `4.0.0-rc.117`.
|
|
49
|
-
|
|
50
|
-
- Updated dependencies:
|
|
51
|
-
- @systemfsoftware/conformance-spec@0.2.0
|
|
52
|
-
|
|
53
|
-
## 4.2.0
|
|
54
|
-
|
|
55
|
-
### Major Changes
|
|
56
|
-
|
|
57
|
-
- 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.
|
|
58
|
-
|
|
59
|
-
- 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`.
|
|
60
|
-
|
|
61
|
-
### Minor Changes
|
|
62
|
-
|
|
63
|
-
- 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.
|
|
64
|
-
|
|
65
|
-
## 4.1.1
|
|
66
|
-
|
|
67
|
-
### Patch Changes
|
|
68
|
-
|
|
69
|
-
- Update peer and runtime dependency on `effect` and companion packages to `4.0.0-rc.117`.
|
|
70
|
-
|
|
71
|
-
## 4.1.0
|
|
72
|
-
|
|
73
|
-
### Minor Changes
|
|
74
|
-
|
|
75
|
-
- `cappedBackoff`, `worker`, `leader`, `task`, `withLeaderLock` and the other exported functions that took their subject first can now also be called data-last inside `pipe`. Existing calls keep working.
|
|
76
|
-
|
|
77
|
-
## 4.0.0
|
|
78
|
-
|
|
79
|
-
### Patch Changes
|
|
80
|
-
|
|
81
|
-
- A supervisor whose restart decision cannot read its own restart command now logs the error and cools down, the same as when its restart budget runs out. It used to die and take its children down with it.
|
|
82
|
-
|
|
83
|
-
## 3.0.14
|
|
84
|
-
|
|
85
|
-
### Patch Changes
|
|
86
|
-
|
|
87
|
-
- Unconstrained type holes are defaulted type parameters (`<A = unknown>`) instead of a type argument `unknown`. Calls that omit those arguments are unchanged.
|
|
88
|
-
|
|
89
|
-
- Updated dependencies:
|
|
90
|
-
- @systemfsoftware/effect-cell-types@9.0.0
|
|
91
|
-
|
|
92
|
-
## 3.0.13
|
|
93
|
-
|
|
94
|
-
### Patch Changes
|
|
95
|
-
|
|
96
|
-
- Bump the stryker catalog to pull in the latest patch releases of the stryker-js ecosystem.
|
|
97
|
-
|
|
98
|
-
## 3.0.12
|
|
99
|
-
|
|
100
|
-
### Patch Changes
|
|
101
|
-
|
|
102
|
-
- The `schema-filter-constructive-generation` rule distinguishes scalar and struct receiver chains: `arbitrary: { candidate }` no longer satisfies the rule on any receiver, struct filters are permitted without annotations because Effect v4 provides no compiler hook for constructive cross-field filter generation, and node `toCodecArbitrary` overrides only silence the rule on `Schema.declare` receivers where the compiler honors them.
|
|
103
|
-
|
|
104
|
-
## 3.0.11
|
|
105
|
-
|
|
106
|
-
### Patch Changes
|
|
107
|
-
|
|
108
|
-
- Dependencies resolve to Effect 4.0.0-rc.116 and Vitest 5.
|
|
109
|
-
|
|
110
|
-
## 3.0.10
|
|
111
|
-
|
|
112
|
-
### Patch Changes
|
|
113
|
-
|
|
114
|
-
- Updated dependencies:
|
|
115
|
-
- @systemfsoftware/effect-cell-types@8.0.0
|
|
116
|
-
|
|
117
|
-
## 3.0.9
|
|
118
|
-
|
|
119
|
-
### Patch Changes
|
|
120
|
-
|
|
121
|
-
- Releases the workspace so its published versions track the shared dependency graph this change moves.
|
|
122
|
-
|
|
123
|
-
- The `@systemfsoftware/source` export condition is gone. It resolved to a package's TypeScript sources for editors and in-repo typechecks; each package now exports only its built entry. If your tsconfig sets `customConditions: ["@systemfsoftware/source"]`, or a bundler config names that condition, remove it — resolution falls back to the built entry, which is what every consumer already got.
|
|
124
|
-
|
|
125
|
-
## 3.0.8
|
|
126
|
-
|
|
127
|
-
### Patch Changes
|
|
128
|
-
|
|
129
|
-
- Updated dependencies:
|
|
130
|
-
- @systemfsoftware/effect-cell-types@7.0.0
|
|
131
|
-
|
|
132
|
-
## 3.0.7
|
|
133
|
-
|
|
134
|
-
### Patch Changes
|
|
135
|
-
|
|
136
|
-
- Re-released against @systemfsoftware/stryker-js without the removed --llms manifest. The Run stream no longer carries a manifest terminal event, and the RunEvent / RunTerminalEvent unions no longer include the manifest arm, so any exhaustive consumer of those types must drop that case.
|
|
137
|
-
|
|
138
|
-
- Rebuilds against updated workspace dependencies, including the new
|
|
139
|
-
`@systemfsoftware/stryker-js` reporter protocol major.
|
|
140
|
-
|
|
141
|
-
## 3.0.6
|
|
142
|
-
|
|
143
|
-
### Patch Changes
|
|
144
|
-
|
|
145
|
-
- Peer Effect requirement advances to 4.0.0-rc.112. No API changes.
|
|
146
|
-
|
|
147
|
-
- The arbitraries derived for several schema filters now construct their valid values directly instead of drawing many samples and discarding them. Filtered schemas such as the worker-call guard, the edit-entry guards, and the restart-cap check generate matching values on the first draws, so property suites that use them finish faster. Every value still satisfies the same filter as before.
|
|
148
|
-
|
|
149
|
-
## 3.0.5
|
|
150
|
-
|
|
151
|
-
### Patch Changes
|
|
152
|
-
|
|
153
|
-
- Re-released to propagate the effect-cell-types and stryker-js workflow-channel migration into their published dependency graphs; no package-local API change
|
|
154
|
-
|
|
155
|
-
- The arbitraries derived for several schema filters now construct their valid values directly instead of drawing many samples and discarding them. Filtered schemas such as the worker-call guard, the edit-entry guards, and the restart-cap check generate matching values on the first draws, so property suites that use them finish faster. Every value still satisfies the same filter as before.
|
|
156
|
-
|
|
157
|
-
- Updated dependencies:
|
|
158
|
-
- @systemfsoftware/effect-cell-types@6.0.0
|
|
159
|
-
|
|
160
|
-
## 3.0.4
|
|
161
|
-
|
|
162
|
-
### Patch Changes
|
|
163
|
-
|
|
164
|
-
- Refreshed builds on the platform-services dependency graph; the packages no longer reach for host builtins directly. No CLI flags or option names change.
|
|
165
|
-
|
|
166
|
-
## 3.0.3
|
|
167
|
-
|
|
168
|
-
### Patch Changes
|
|
169
|
-
|
|
170
|
-
- Re-published against the oxc-based instrumenter: workspace dependency ranges move to the new instrumenter major; no package's own behavior changes in this release.
|
|
171
|
-
|
|
172
|
-
## 3.0.2
|
|
173
|
-
|
|
174
|
-
### Patch Changes
|
|
175
|
-
|
|
176
|
-
- Peer Effect requirement advances to 4.0.0-rc.112. No API changes.
|
|
177
|
-
|
|
178
|
-
## 3.0.1
|
|
179
|
-
|
|
180
|
-
### Patch Changes
|
|
181
|
-
|
|
182
|
-
- Updated dependencies:
|
|
183
|
-
- @systemfsoftware/effect-cell-types@5.0.0
|
|
184
|
-
|
|
185
|
-
## 3.0.0
|
|
186
|
-
|
|
187
|
-
### Major Changes
|
|
188
|
-
|
|
189
|
-
- Published types no longer include names tagged `@internal`. If you imported one of those names from the package, switch to a public export or stop using it.
|
|
190
|
-
|
|
191
|
-
### Minor Changes
|
|
192
|
-
|
|
193
|
-
- The loop kinds now ship their tags as values.
|
|
194
|
-
|
|
195
|
-
`PollLoopTag`, `StreamLoopTag` and `SubscriptionLoopTag` are new exports: each is a shared `{ _tag }`
|
|
196
|
-
value together with a type of the same name, and `PollLoop`, `StreamLoop` and
|
|
197
|
-
`SubscriptionLoop` inherit their discriminant from it. Members, tag strings and every existing
|
|
198
|
-
narrowing are unchanged, and constructing a loop can now spread the carrier instead of repeating
|
|
199
|
-
the literal.
|
|
200
|
-
|
|
201
|
-
### Patch Changes
|
|
202
|
-
|
|
203
|
-
- The peer requirements for `effect` and for the Effect test-runner integration now accept any compatible `4.0.0-rc` release, instead of demanding one exact release candidate.
|
|
204
|
-
|
|
205
|
-
Installing alongside a newer release candidate no longer reports an unmet peer dependency or resolves a second copy of `effect` into the dependency tree.
|
|
206
|
-
|
|
207
|
-
- Updated dependencies:
|
|
208
|
-
- @systemfsoftware/effect-cell-types@4.0.0
|
|
209
|
-
|
|
210
|
-
## 2.0.0
|
|
211
|
-
|
|
212
|
-
### Major Changes
|
|
213
|
-
|
|
214
|
-
- Pass capabilities as arguments instead of requiring them through a projection tag, in these two packages
|
|
215
|
-
|
|
216
|
-
Wlaschin's second approach — dependency parameterization — is preferred over the
|
|
217
|
-
Reader, and it removes the requirement from the signature entirely rather than
|
|
218
|
-
relocating it. Each operation in `effect-daemon-spec` and `stryker-js-cli` that
|
|
219
|
-
previously reached into the context for a projection now receives what it uses,
|
|
220
|
-
and the composition root is the single place that acquires the port.
|
|
221
|
-
|
|
222
|
-
The remaining `*ExecutorDeps` projections live in `omp/**/src/internal/`, fenced
|
|
223
|
-
behind each package's own `exports` map, so they are unreachable from any consumer;
|
|
224
|
-
the exported-wiring gate scans `src/` outside `src/internal/`, so internal composition
|
|
225
|
-
stays internal and is not a migration target here.
|
|
226
|
-
|
|
227
|
-
- `effect-daemon-spec` — `withLeaderLock` takes `lock: LeaderLock['Type']`, and the
|
|
228
|
-
supervisor body takes `reporter: DaemonReporter['Type']`. Every `yield* LeaderLock`
|
|
229
|
-
and `yield* DaemonReporter` now lands in `mod.ts`; the exported `worker` and
|
|
230
|
-
`supervisor` shapes are unchanged, and `withLeaderLock` loses `LeaderLock` from `R`.
|
|
231
|
-
- `stryker-js-cli` — `StrykerCliExecutorDeps` and its service interface are gone.
|
|
232
|
-
`runStrykerCli` and the handler take `detectMode` and `createRunEventStream`, typed
|
|
233
|
-
as indexed accesses off the two port services, and both lose the requirement from
|
|
234
|
-
`R`. `main.ts` acquires both ports and passes the members down.
|
|
235
|
-
|
|
236
|
-
For these two packages, a caller that provided the projection layer now provides
|
|
237
|
-
nothing, because the operation no longer requires anything.
|
|
238
|
-
|
|
239
|
-
- Carry the lock decision as a `LockBinding` so a required lock can never silently vanish.
|
|
240
|
-
|
|
241
|
-
The three lock-taking operations — the internal `worker`, `supervisor`, and the
|
|
242
|
-
`withLockByMode` operation behind them — now take a single discriminated
|
|
243
|
-
argument, `LockBinding`, in place of a `(LockConfig, LeaderLock['Type'] | null)`
|
|
244
|
-
pair. `unlocked` is the one case for a body that takes no lock; `locked` carries
|
|
245
|
-
the keyed spec and the adapter that honours it.
|
|
246
|
-
|
|
247
|
-
A spec declaring `mode: 'required'` paired with a null or missing adapter
|
|
248
|
-
previously fell through to the body unwrapped — a silent downgrade from "must
|
|
249
|
-
hold the leader lock" to "no lock at all". That combination is no longer
|
|
250
|
-
representable: `unlocked` only exists for a `{ mode: 'none' }` spec, and `locked`
|
|
251
|
-
demands both a keyed spec (via `KeyedLockConfig`) and an adapter (via
|
|
252
|
-
`LeaderLock['Type']`). The composition root — `worker` and `supervisor` in
|
|
253
|
-
`mod.ts` — is now the one place that builds the binding, and its public shapes
|
|
254
|
-
are unchanged.
|
|
255
|
-
|
|
256
|
-
### Minor Changes
|
|
257
|
-
|
|
258
|
-
- cut over to effect v4 (4.0.0-rc.108): public surface derives from effect types; peers flip effect ^3→^4
|
|
259
|
-
|
|
260
|
-
- Produce every workflow through `Workflow.make`.
|
|
261
|
-
|
|
262
|
-
`decideRestart`, `interpretHookResult`, and `admitSurvivorsRun` are now built by the constructor rather
|
|
263
|
-
than annotated with `Workflow<Command, Decision, Error>`. Each decision is behaviourally identical —
|
|
264
|
-
`make` is the identity at runtime — but the channels are now inferred from the decider instead of
|
|
265
|
-
asserted by hand, so a total decision resolves to `UninhabitedError` and becomes uncallable rather than
|
|
266
|
-
compiling as a workflow that cannot fail.
|
|
267
|
-
|
|
268
|
-
`effect-daemon-spec` takes a minor bump because the change is consumer-visible beyond its own source:
|
|
269
|
-
`@systemfsoftware/effect-cell-types` moves from `devDependencies` to `dependencies`, so installing this
|
|
270
|
-
package now installs it. That reclassification is required, not incidental — `make` is a runtime call,
|
|
271
|
-
and `scripts/guards/check-runtime-deps.mjs` fails a runtime import declared only as a dev dependency.
|
|
272
|
-
`omp-claude-compat` gains the same dependency; `stryker-js-cli` already declared it.
|
|
273
|
-
|
|
274
|
-
`RestartDecisionWorkflow` survives as a type-only export: one in-repo consumer, its own property test,
|
|
275
|
-
references it through `ReturnType<…>`.
|
|
276
|
-
|
|
277
|
-
### Patch Changes
|
|
278
|
-
|
|
279
|
-
- Array types are spelled one way. `Array<T>` and `ReadonlyArray<T>` in emitted
|
|
280
|
-
declarations become `T[]` and `readonly T[]`, which the type checker cannot tell
|
|
281
|
-
apart: no exported type changes, only how it is written.
|
|
282
|
-
|
|
283
|
-
- New version is published through npm trusted publishing, so it carries a provenance attestation you can verify.
|
|
284
|
-
|
|
285
|
-
- Express each executor's sandwich as a `Cell` description.
|
|
286
|
-
|
|
287
|
-
Every call site that previously sequenced the phases by hand now builds one description and hands it to the interpreter, so the order these executors run in is carried by the phase types instead of by the order the statements happen to appear in. Behaviour is preserved and no public surface moves: the change is confined to `src/internal/*.executor.ts`, and each package's golden API report is unchanged.
|
|
288
|
-
|
|
289
|
-
One site needed a real fix rather than a translation. `supervisor-body.executor.ts` wrote before it could classify — it recorded a restart, then read the resulting rate — which is a read that depends on an earlier decision. Its read now gathers the restart record and the resulting rate as one product, which keeps that site a single layer, with the intensity tracker passed as the read's command rather than captured from the surrounding scope.
|
|
290
|
-
|
|
291
|
-
- The base mutation preset selects at the make boundary.
|
|
292
|
-
|
|
293
|
-
The preset carries both ignorers (`effect-schema-declarations`, `workflow-make-boundary`) and
|
|
294
|
-
`disableBail: true`, so killer recording is structural for every inheriting config. The sandwich
|
|
295
|
-
packages (daemon-spec, stryker-js-cli, omp-claude-compat) widen `mutate` to all non-test source
|
|
296
|
-
at explicit 100/100/100 thresholds — the ignorer is the selector, so membership is forced by the
|
|
297
|
-
brand rather than chosen by a path list. Library packages' mutate arrays are byte-identical.
|
|
298
|
-
|
|
299
|
-
- `restart-decision.workflow.ts` has its pure decision in a new internal `restart-decision.kernel.ts` with a colocated property test. Both files are internal, so the package's public surface is unchanged and the restart behaviour is identical.
|
|
300
|
-
|
|
301
|
-
- Updated dependencies:
|
|
302
|
-
- @systemfsoftware/effect-cell-types@3.0.0
|
|
303
|
-
|
|
304
|
-
## 1.0.0
|
|
305
|
-
|
|
306
|
-
### Major Changes
|
|
307
|
-
|
|
308
|
-
- Pass capabilities as arguments instead of requiring them through a projection tag, in these two packages
|
|
309
|
-
|
|
310
|
-
Wlaschin's second approach — dependency parameterization — is preferred over the
|
|
311
|
-
Reader, and it removes the requirement from the signature entirely rather than
|
|
312
|
-
relocating it. Each operation in `effect-daemon-spec` and `stryker-js-cli` that
|
|
313
|
-
previously reached into the context for a projection now receives what it uses,
|
|
314
|
-
and the composition root is the single place that acquires the port.
|
|
315
|
-
|
|
316
|
-
The remaining `*ExecutorDeps` projections live in `omp/**/src/internal/`, fenced
|
|
317
|
-
behind each package's own `exports` map, so they are unreachable from any consumer;
|
|
318
|
-
the exported-wiring gate scans `src/` outside `src/internal/`, so internal composition
|
|
319
|
-
stays internal and is not a migration target here.
|
|
320
|
-
|
|
321
|
-
- `effect-daemon-spec` — `withLeaderLock` takes `lock: LeaderLock['Type']`, and the
|
|
322
|
-
supervisor body takes `reporter: DaemonReporter['Type']`. Every `yield* LeaderLock`
|
|
323
|
-
and `yield* DaemonReporter` now lands in `mod.ts`; the exported `worker` and
|
|
324
|
-
`supervisor` shapes are unchanged, and `withLeaderLock` loses `LeaderLock` from `R`.
|
|
325
|
-
- `stryker-js-cli` — `StrykerCliExecutorDeps` and its service interface are gone.
|
|
326
|
-
`runStrykerCli` and the handler take `detectMode` and `createRunEventStream`, typed
|
|
327
|
-
as indexed accesses off the two port services, and both lose the requirement from
|
|
328
|
-
`R`. `main.ts` acquires both ports and passes the members down.
|
|
329
|
-
|
|
330
|
-
For these two packages, a caller that provided the projection layer now provides
|
|
331
|
-
nothing, because the operation no longer requires anything.
|
|
332
|
-
|
|
333
|
-
- Carry the lock decision as a `LockBinding` so a required lock can never silently vanish.
|
|
334
|
-
|
|
335
|
-
The three lock-taking operations — the internal `worker`, `supervisor`, and the
|
|
336
|
-
`withLockByMode` operation behind them — now take a single discriminated
|
|
337
|
-
argument, `LockBinding`, in place of a `(LockConfig, LeaderLock['Type'] | null)`
|
|
338
|
-
pair. `unlocked` is the one case for a body that takes no lock; `locked` carries
|
|
339
|
-
the keyed spec and the adapter that honours it.
|
|
340
|
-
|
|
341
|
-
A spec declaring `mode: 'required'` paired with a null or missing adapter
|
|
342
|
-
previously fell through to the body unwrapped — a silent downgrade from "must
|
|
343
|
-
hold the leader lock" to "no lock at all". That combination is no longer
|
|
344
|
-
representable: `unlocked` only exists for a `{ mode: 'none' }` spec, and `locked`
|
|
345
|
-
demands both a keyed spec (via `KeyedLockConfig`) and an adapter (via
|
|
346
|
-
`LeaderLock['Type']`). The composition root — `worker` and `supervisor` in
|
|
347
|
-
`mod.ts` — is now the one place that builds the binding, and its public shapes
|
|
348
|
-
are unchanged.
|
|
349
|
-
|
|
350
|
-
### Minor Changes
|
|
351
|
-
|
|
352
|
-
- cut over to effect v4 (4.0.0-rc.108): public surface derives from effect types; peers flip effect ^3→^4
|
|
353
|
-
|
|
354
|
-
- Produce every workflow through `Workflow.make`.
|
|
355
|
-
|
|
356
|
-
`decideRestart`, `interpretHookResult`, and `admitSurvivorsRun` are now built by the constructor rather
|
|
357
|
-
than annotated with `Workflow<Command, Decision, Error>`. Each decision is behaviourally identical —
|
|
358
|
-
`make` is the identity at runtime — but the channels are now inferred from the decider instead of
|
|
359
|
-
asserted by hand, so a total decision resolves to `UninhabitedError` and becomes uncallable rather than
|
|
360
|
-
compiling as a workflow that cannot fail.
|
|
361
|
-
|
|
362
|
-
`effect-daemon-spec` takes a minor bump because the change is consumer-visible beyond its own source:
|
|
363
|
-
`@systemfsoftware/effect-cell-types` moves from `devDependencies` to `dependencies`, so installing this
|
|
364
|
-
package now installs it. That reclassification is required, not incidental — `make` is a runtime call,
|
|
365
|
-
and `scripts/guards/check-runtime-deps.mjs` fails a runtime import declared only as a dev dependency.
|
|
366
|
-
`omp-claude-compat` gains the same dependency; `stryker-js-cli` already declared it.
|
|
367
|
-
|
|
368
|
-
`RestartDecisionWorkflow` survives as a type-only export: one in-repo consumer, its own property test,
|
|
369
|
-
references it through `ReturnType<…>`.
|
|
370
|
-
|
|
371
|
-
### Patch Changes
|
|
372
|
-
|
|
373
|
-
- Array types are spelled one way. `Array<T>` and `ReadonlyArray<T>` in emitted
|
|
374
|
-
declarations become `T[]` and `readonly T[]`, which the type checker cannot tell
|
|
375
|
-
apart: no exported type changes, only how it is written.
|
|
376
|
-
|
|
377
|
-
- New version is published through npm trusted publishing, so it carries a provenance attestation you can verify.
|
|
378
|
-
|
|
379
|
-
- Express each executor's sandwich as a `Cell` description.
|
|
380
|
-
|
|
381
|
-
Every call site that previously sequenced the phases by hand now builds one description and hands it to the interpreter, so the order these executors run in is carried by the phase types instead of by the order the statements happen to appear in. Behaviour is preserved and no public surface moves: the change is confined to `src/internal/*.executor.ts`, and each package's golden API report is unchanged.
|
|
382
|
-
|
|
383
|
-
One site needed a real fix rather than a translation. `supervisor-body.executor.ts` wrote before it could classify — it recorded a restart, then read the resulting rate — which is a read that depends on an earlier decision. Its read now gathers the restart record and the resulting rate as one product, which keeps that site a single layer, with the intensity tracker passed as the read's command rather than captured from the surrounding scope.
|
|
384
|
-
|
|
385
|
-
- The base mutation preset selects at the make boundary.
|
|
386
|
-
|
|
387
|
-
The preset carries both ignorers (`effect-schema-declarations`, `workflow-make-boundary`) and
|
|
388
|
-
`disableBail: true`, so killer recording is structural for every inheriting config. The sandwich
|
|
389
|
-
packages (daemon-spec, stryker-js-cli, omp-claude-compat) widen `mutate` to all non-test source
|
|
390
|
-
at explicit 100/100/100 thresholds — the ignorer is the selector, so membership is forced by the
|
|
391
|
-
brand rather than chosen by a path list. Library packages' mutate arrays are byte-identical.
|
|
392
|
-
|
|
393
|
-
- `restart-decision.workflow.ts` has its pure decision in a new internal `restart-decision.kernel.ts` with a colocated property test. Both files are internal, so the package's public surface is unchanged and the restart behaviour is identical.
|
|
394
|
-
|
|
395
|
-
- Updated dependencies:
|
|
396
|
-
- @systemfsoftware/effect-cell-types@2.0.0
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
//#region \0rolldown/runtime.js
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __exportAll = (all, no_symbols) => {
|
|
4
|
-
let target = {};
|
|
5
|
-
for (var name in all) __defProp(target, name, {
|
|
6
|
-
get: all[name],
|
|
7
|
-
enumerable: true
|
|
8
|
-
});
|
|
9
|
-
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
|
-
return target;
|
|
11
|
-
};
|
|
12
|
-
//#endregion
|
|
13
|
-
export { __exportAll as t };
|