@systemfsoftware/effect-daemon-spec 4.1.1 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,340 +1,1158 @@
1
- import { Cause, Context, Duration, Effect, Latch, Layer, Metric, Option, Schedule, Schema, Scope, Stream } from "effect";
2
- //#region src/DaemonHealth.schema.d.ts
3
- declare const DynamicLimitExceeded_base: Schema.Class<DynamicLimitExceeded, Schema.TaggedStruct<"DynamicLimitExceeded", {
4
- readonly limit: Schema.Int;
5
- }>, import("effect/Cause").YieldableError>;
6
- export declare class DynamicLimitExceeded extends DynamicLimitExceeded_base {}
7
- export interface DaemonHealth {
8
- readonly name: string;
9
- readonly ready: Latch.Latch;
10
- readonly healthy: Latch.Latch;
11
- readonly paused: Latch.Latch;
12
- }
13
- export interface SupervisorHealth {
14
- readonly name: string;
15
- readonly ready: Latch.Latch;
16
- readonly healthy: Latch.Latch;
17
- readonly paused: Latch.Latch;
18
- readonly children: readonly (DaemonHealth | SupervisorHealth)[];
19
- }
20
- export interface DynamicHandle<Args, R = never> {
21
- readonly health: SupervisorHealth;
22
- readonly startChild: (args: Args) => Effect.Effect<ChildRef, DynamicLimitExceeded, R>;
23
- readonly stopChild: (ref: Pick<ChildRef, 'id'>) => Effect.Effect<void>;
24
- readonly count: Effect.Effect<number>;
25
- }
26
- export type ChildRef = {
27
- readonly id: number;
28
- readonly removed: Effect.Effect<void>;
29
- };
30
- //#endregion
31
- //#region src/LeaderLock.schema.d.ts
32
- declare const LeaderLockNotAcquired_base: Schema.Class<LeaderLockNotAcquired, Schema.TaggedStruct<"LeaderLockNotAcquired", {
33
- readonly key: Schema.String;
34
- }>, import("effect/Cause").YieldableError>;
35
- export declare class LeaderLockNotAcquired extends LeaderLockNotAcquired_base {}
36
- declare const LeaderLockInfraError_base: Schema.Class<LeaderLockInfraError, Schema.TaggedStruct<"LeaderLockInfraError", {
37
- readonly key: Schema.String;
38
- readonly cause: Schema.Unknown;
39
- }>, import("effect/Cause").YieldableError>;
40
- export declare class LeaderLockInfraError extends LeaderLockInfraError_base {}
41
- export type LeaderLockAcquireError = LeaderLockNotAcquired | LeaderLockInfraError;
1
+ import { Cause, Context, Deferred, Effect, HashMap, Layer, Option, PubSub, Queue, Ref, Schema, Scope } from "effect";
2
+ import { Handle, Workflow } from "@systemfsoftware/effect-cell-types";
3
+ import * as Stream from "effect/Stream";
4
+ import { Pipeable } from "effect/Pipeable";
5
+ //#region src/kernel/SupervisorPolicy.schema.d.ts
6
+ declare const RestartStrategy: Schema.Literals<readonly ["one_for_one", "one_for_all", "rest_for_one"]>;
7
+ type RestartStrategy = typeof RestartStrategy.Type;
8
+ declare const AutoShutdown: Schema.Literals<readonly ["never", "any_significant", "all_significant"]>;
9
+ type AutoShutdown = typeof AutoShutdown.Type;
10
+ declare const BrutalShutdown: Schema.TaggedStruct<"Brutal", {}>;
11
+ type BrutalShutdown = typeof BrutalShutdown.Type;
12
+ declare const GracefulShutdown: Schema.TaggedStruct<"Graceful", {
13
+ readonly millis: Schema.Int;
14
+ }>;
15
+ type GracefulShutdown = typeof GracefulShutdown.Type;
16
+ declare const InfinityShutdown: Schema.TaggedStruct<"Infinity", {}>;
17
+ type InfinityShutdown = typeof InfinityShutdown.Type;
18
+ declare const ShutdownMode: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
19
+ readonly millis: Schema.Int;
20
+ }>, Schema.TaggedStruct<"Infinity", {}>]>;
21
+ type ShutdownMode = typeof ShutdownMode.Type;
22
+ declare const BackoffSchedule: Schema.Struct<{
23
+ readonly baseMillis: Schema.Int;
24
+ readonly multiplier: Schema.Int;
25
+ readonly capMillis: Schema.Int;
26
+ }>;
27
+ type BackoffSchedule = typeof BackoffSchedule.Type;
28
+ declare const ChildDeclaration: Schema.Struct<{
29
+ readonly childId: Schema.String;
30
+ readonly restartType: Schema.Literals<readonly ["permanent", "transient", "temporary"]>;
31
+ readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
32
+ readonly millis: Schema.Int;
33
+ }>, Schema.TaggedStruct<"Infinity", {}>]>;
34
+ readonly significant: Schema.Boolean;
35
+ readonly startTimeoutMillis: Schema.Int;
36
+ readonly probeFailureThreshold: Schema.Int;
37
+ }>;
38
+ type ChildDeclaration = typeof ChildDeclaration.Type;
39
+ declare const DynamicKind: Schema.Union<readonly [Schema.TaggedStruct<"NoDynamicChildren", {}>, Schema.TaggedStruct<"DynamicChildren", {
40
+ readonly ceiling: Schema.Int;
41
+ readonly restartType: Schema.Literals<readonly ["permanent", "transient", "temporary"]>;
42
+ readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
43
+ readonly millis: Schema.Int;
44
+ }>, Schema.TaggedStruct<"Infinity", {}>]>;
45
+ readonly startTimeoutMillis: Schema.Int;
46
+ readonly probeFailureThreshold: Schema.Int;
47
+ }>]>;
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 {}
42
84
  //#endregion
43
- //#region src/LockPrimitive.schema.d.ts
44
- declare const LockPrimitiveError_base: Schema.Class<LockPrimitiveError, Schema.TaggedStruct<"LockPrimitiveError", {
45
- readonly key: Schema.String;
46
- readonly cause: Schema.Unknown;
47
- }>, import("effect/Cause").YieldableError>;
48
- export declare class LockPrimitiveError extends LockPrimitiveError_base {}
85
+ //#region src/kernel/TerminationReport.schema.d.ts
86
+ /**
87
+ * What a medium can say about why a child died (R16): a fiber supplies a cause, a process
88
+ * supplies an exit status and signal, and a remote runner's death is inferred. No event
89
+ * claims a level its medium cannot supply — the medium declares which one it reports, and
90
+ * the kernel assumes nothing beyond that declaration.
91
+ */
92
+ declare const CauseReport: Schema.TaggedStruct<"CauseReport", {
93
+ readonly cause: Schema.String;
94
+ }>;
95
+ type CauseReport = typeof CauseReport.Type;
96
+ declare const ExitReport: Schema.TaggedStruct<"ExitReport", {
97
+ readonly code: Schema.Int;
98
+ readonly signal: Schema.String;
99
+ }>;
100
+ type ExitReport = typeof ExitReport.Type;
101
+ declare const InferredReport: Schema.TaggedStruct<"InferredReport", {
102
+ readonly failedProbes: Schema.Int;
103
+ }>;
104
+ type InferredReport = typeof InferredReport.Type;
105
+ declare const DeadlineMissedReport: Schema.TaggedStruct<"DeadlineMissed", {
106
+ readonly waitedMillis: Schema.Int;
107
+ }>;
108
+ type DeadlineMissedReport = typeof DeadlineMissedReport.Type;
109
+ declare const FailureReport: Schema.Union<readonly [Schema.TaggedStruct<"CauseReport", {
110
+ readonly cause: Schema.String;
111
+ }>, Schema.TaggedStruct<"ExitReport", {
112
+ readonly code: Schema.Int;
113
+ readonly signal: Schema.String;
114
+ }>, Schema.TaggedStruct<"InferredReport", {
115
+ readonly failedProbes: Schema.Int;
116
+ }>, Schema.TaggedStruct<"DeadlineMissed", {
117
+ readonly waitedMillis: Schema.Int;
118
+ }>]>;
119
+ type FailureReport = typeof FailureReport.Type;
120
+ declare const NormalTermination: Schema.TaggedStruct<"Normal", {}>;
121
+ type NormalTermination = typeof NormalTermination.Type;
122
+ declare const ShutdownTermination: Schema.TaggedStruct<"Shutdown", {}>;
123
+ type ShutdownTermination = typeof ShutdownTermination.Type;
124
+ declare const AbnormalTermination: Schema.TaggedStruct<"Abnormal", {
125
+ readonly report: Schema.Union<readonly [Schema.TaggedStruct<"CauseReport", {
126
+ readonly cause: Schema.String;
127
+ }>, Schema.TaggedStruct<"ExitReport", {
128
+ readonly code: Schema.Int;
129
+ readonly signal: Schema.String;
130
+ }>, Schema.TaggedStruct<"InferredReport", {
131
+ readonly failedProbes: Schema.Int;
132
+ }>, Schema.TaggedStruct<"DeadlineMissed", {
133
+ readonly waitedMillis: Schema.Int;
134
+ }>]>;
135
+ }>;
136
+ type AbnormalTermination = typeof AbnormalTermination.Type;
137
+ declare const TerminationReason: Schema.Union<readonly [Schema.TaggedStruct<"Normal", {}>, Schema.TaggedStruct<"Shutdown", {}>, Schema.TaggedStruct<"Abnormal", {
138
+ readonly report: Schema.Union<readonly [Schema.TaggedStruct<"CauseReport", {
139
+ readonly cause: Schema.String;
140
+ }>, Schema.TaggedStruct<"ExitReport", {
141
+ readonly code: Schema.Int;
142
+ readonly signal: Schema.String;
143
+ }>, Schema.TaggedStruct<"InferredReport", {
144
+ readonly failedProbes: Schema.Int;
145
+ }>, Schema.TaggedStruct<"DeadlineMissed", {
146
+ readonly waitedMillis: Schema.Int;
147
+ }>]>;
148
+ }>]>;
149
+ type TerminationReason = typeof TerminationReason.Type;
49
150
  //#endregion
50
- //#region src/LeaderLockAdapter.d.ts
51
- export interface LeaderLockService {
52
- readonly withLock: <A, E, R>(key: string, self: Effect.Effect<A, E, R>) => Effect.Effect<Option.Option<A>, E | LeaderLockInfraError, R>;
151
+ //#region src/Supervisor/MediumDeclaration.schema.d.ts
152
+ /**
153
+ * What a medium can say about why a child died (R16, KTD8): the in-process fiber
154
+ * medium reports a full `Cause`, a process, socket or microVM medium reports the
155
+ * exit status and signal it observed, and the cluster medium's death is only
156
+ * inferred from failed liveness probes (KTD7). The kernel assumes nothing beyond
157
+ * the declared level; the conformance kit projects traces down to it.
158
+ */
159
+ declare const MediumReporting: Schema.Literals<readonly ["full", "exit", "inferred"]>;
160
+ type MediumReporting = typeof MediumReporting.Type;
161
+ /**
162
+ * The `one_for_all` guarantee a medium can honour (R16, KTD8): `atomic` means no
163
+ * child is left running once the group stop returns, `eventual` means teardown
164
+ * continues on the medium's own clock after the call returns.
165
+ */
166
+ declare const GroupStopGuarantee: Schema.Literals<readonly ["atomic", "eventual"]>;
167
+ type GroupStopGuarantee = typeof GroupStopGuarantee.Type;
168
+ /**
169
+ * A medium's declaration to the kernel (R16). Both fields are required: a
170
+ * declaration without a reporting level or a group-stop guarantee is refused at
171
+ * decode, so the kernel never guesses what a medium can say or honour.
172
+ */
173
+ declare const MediumDeclaration: Schema.Struct<{
174
+ readonly reporting: Schema.Literals<readonly ["full", "exit", "inferred"]>;
175
+ readonly groupStop: Schema.Literals<readonly ["atomic", "eventual"]>;
176
+ }>;
177
+ type MediumDeclaration = typeof MediumDeclaration.Type;
178
+ declare namespace Medium_d_exports {
179
+ export { AbnormalTermination, BrutalShutdown, CauseReport, DeadlineMissedReport, ExitReport, FailureReport, GracefulShutdown, GroupStopGuarantee, InferredReport, InfinityShutdown, Medium, MediumDeclaration, MediumOptions, MediumPort, MediumPortShape, MediumReporting, NormalTermination, ShutdownMode, ShutdownTermination, Started, StartedTypeId, Stopped, StoppedTypeId, TerminationReason, make$1 as make, started, stopped };
53
180
  }
54
- declare const LeaderLock_base: Context.ServiceClass<LeaderLock, "@systemfsoftware/effect-daemon-spec/LeaderLockAdapter/LeaderLock", LeaderLockService>;
55
- export declare class LeaderLock extends LeaderLock_base {
56
- static readonly Noop: Layer.Layer<LeaderLock>;
181
+ declare const StartedTypeId: unique symbol;
182
+ type StartedTypeId = typeof StartedTypeId;
183
+ declare const StoppedTypeId: unique symbol;
184
+ type StoppedTypeId = typeof StoppedTypeId;
185
+ /**
186
+ * Evidence that a medium started a child (KTD8): unforgeable, because only a
187
+ * medium's `start` port can mint it. It carries the readiness signal the kernel
188
+ * races against its start-deadline timer (R10); the termination report and the
189
+ * single-shot liveness probe are the medium's `report` and `probe` ports run
190
+ * over this evidence, so neither can observe a child that never started.
191
+ */
192
+ interface Started {
193
+ readonly [StartedTypeId]: StartedTypeId;
194
+ readonly ready: Effect.Effect<void>;
57
195
  }
58
- export interface LockPrimitiveService {
59
- readonly tryAcquire: (key: string) => Effect.Effect<boolean, LockPrimitiveError, Scope.Scope>;
196
+ /**
197
+ * Evidence that a medium stopped a child (KTD8): returned only by `stop`, which
198
+ * the builder wraps so owned shutdown cannot be interrupted part-way (R15).
199
+ */
200
+ interface Stopped {
201
+ readonly [StoppedTypeId]: StoppedTypeId;
60
202
  }
61
- declare const LockPrimitive_base: Context.ServiceClass<LockPrimitive, "@systemfsoftware/effect-daemon-spec/LeaderLockAdapter/LockPrimitive", LockPrimitiveService>;
62
- export declare class LockPrimitive extends LockPrimitive_base {}
63
- export declare const LeaderLockFromPrimitive: Layer.Layer<LeaderLock, never, LockPrimitive>;
64
- //#endregion
65
- //#region src/Backoff.d.ts
66
- export declare const cappedBackoff: {
67
- (cap: Duration.Input): (base: Duration.Input) => Schedule.Schedule<Duration.Duration>;
68
- (base: Duration.Input, cap: Duration.Input): Schedule.Schedule<Duration.Duration>;
69
- };
203
+ /** Mint `Started` evidence for a child whose readiness completes `ready`. */
204
+ declare const started: (ready: Effect.Effect<void>) => Started;
205
+ /** The single `Stopped` evidence value every medium returns from `stop`. */
206
+ declare const stopped: Stopped;
207
+ /**
208
+ * The child-protocol obligations a medium supplies in one options record
209
+ * (R15, KTD8). `start` mints `Started` evidence, `report` resolves with the
210
+ * child's `TerminationReason` when it terminates, `probe` answers one liveness
211
+ * check (the kernel runs it once per tick, KTD7), and `stop` owns shutdown in
212
+ * the declared R4 mode and must not be callable with anything but `Started`
213
+ * evidence.
214
+ */
215
+ interface MediumOptions<Program, StartError = never, R = never> {
216
+ readonly declaration: MediumDeclaration;
217
+ readonly start: (program: Program) => Effect.Effect<Started, StartError, R>;
218
+ readonly report: (evidence: Started) => Effect.Effect<TerminationReason, never, R>;
219
+ readonly probe: (evidence: Started) => Effect.Effect<boolean, never, R>;
220
+ readonly stop: (evidence: Started, mode: ShutdownMode) => Effect.Effect<Stopped, never, R>;
221
+ }
222
+ /**
223
+ * A medium: the child protocol over one program type (R15–R17). Child order and
224
+ * identity come from the supervisor, never from the medium.
225
+ */
226
+ type Medium<Program, StartError = never, R = never> = MediumOptions<Program, StartError, R>;
227
+ /**
228
+ * KTD8: a medium exists only through `make`, whose options record requires every
229
+ * obligation. `stop` is wrapped in an uninterruptible region, so owned shutdown
230
+ * honouring R4's modes cannot be interrupted part-way (R15).
231
+ */
232
+ declare const make$1: <Program, StartError = never, R = never>(options: MediumOptions<Program, StartError, R>) => Medium<Program, StartError, R>;
233
+ /**
234
+ * The capability a driver provides for one program type (KTD9): the medium that
235
+ * interprets the child's program. The driver binds it as `layer(options)` at the
236
+ * composition root, so one tree can mix media while strategy, order and policy
237
+ * never name a medium implementation (R17, R18).
238
+ */
239
+ interface MediumPortShape<Program, StartError = never, R = never> {
240
+ readonly medium: Medium<Program, StartError, R>;
241
+ }
242
+ /** Declare a medium port keyed to the program type it interprets (KTD9). */
243
+ declare const MediumPort: <Program, StartError = never, R = never>(key: string) => Context.Service<MediumPortShape<Program, StartError, R>, MediumPortShape<Program, StartError, R>>;
70
244
  //#endregion
71
- //#region src/Brands.d.ts
72
- export declare const WorkerTypeId: unique symbol;
73
- export type WorkerTypeId = typeof WorkerTypeId;
74
- export declare const SupervisorTypeId: unique symbol;
75
- export type SupervisorTypeId = typeof SupervisorTypeId;
76
- export declare const DynamicSpecTypeId: unique symbol;
77
- export type DynamicSpecTypeId = typeof DynamicSpecTypeId;
245
+ //#region src/Supervisor/SupervisorTerminated.schema.d.ts
246
+ declare const SupervisorTerminated_base: Schema.Class<SupervisorTerminated, Schema.TaggedStruct<"SupervisorTerminated", {
247
+ readonly name: Schema.String;
248
+ readonly reason: Schema.Union<readonly [Schema.TaggedStruct<"Normal", {}>, Schema.TaggedStruct<"Shutdown", {}>, Schema.TaggedStruct<"Abnormal", {
249
+ readonly report: Schema.Union<readonly [Schema.TaggedStruct<"CauseReport", {
250
+ readonly cause: Schema.String;
251
+ }>, Schema.TaggedStruct<"ExitReport", {
252
+ readonly code: Schema.Int;
253
+ readonly signal: Schema.String;
254
+ }>, Schema.TaggedStruct<"InferredReport", {
255
+ readonly failedProbes: Schema.Int;
256
+ }>, Schema.TaggedStruct<"DeadlineMissed", {
257
+ readonly waitedMillis: Schema.Int;
258
+ }>]>;
259
+ }>]>;
260
+ readonly cause: Schema.Cause<Schema.Unknown, Schema.Unknown>;
261
+ }>, import("effect/Cause").YieldableError>;
262
+ declare class SupervisorTerminated extends SupervisorTerminated_base {}
263
+ declare namespace FiberMedium_d_exports {
264
+ export { BareFiberProgram, FiberProgram, failureCauseOf, fiberPort, medium, mediumFor, readyOnStart };
265
+ }
266
+ type BareFiberProgram = Effect.Effect<void, SupervisorTerminated, Scope.Scope>;
267
+ type FiberProgram = (ready: Effect.Effect<void>) => BareFiberProgram;
268
+ declare const readyOnStart: (program: BareFiberProgram) => FiberProgram;
269
+ declare const fiberPort: import("effect/Context").Service<MediumPortShape<FiberProgram, never, Scope.Scope>, MediumPortShape<FiberProgram, never, Scope.Scope>>;
270
+ declare const failureCauseOf: (evidence: Started) => Option.Option<Effect.Effect<Option.Option<Cause.Cause<SupervisorTerminated>>>>;
271
+ declare const mediumFor: <R = never>() => Medium<(ready: Effect.Effect<void>) => Effect.Effect<void, SupervisorTerminated, Scope.Scope | R>, never, Scope.Scope | R>;
272
+ declare const medium: Medium<FiberProgram, never, Scope.Scope>;
78
273
  //#endregion
79
- //#region src/DaemonMetrics.d.ts
80
- export declare const supervisorRestartsCounter: Metric.Counter<number>;
81
- export declare const supervisorExhaustionsCounter: Metric.Counter<number>;
82
- export declare const supervisorChildrenGauge: Metric.Gauge<number>;
83
- export declare const healthStateGauge: Metric.Gauge<number>;
274
+ //#region src/kernel/SupervisionTypeIds.d.ts
275
+ declare const DecisionTypeId: unique symbol;
276
+ type DecisionTypeId = typeof DecisionTypeId;
277
+ declare const StateTypeId: unique symbol;
278
+ type StateTypeId = typeof StateTypeId;
84
279
  //#endregion
85
- //#region src/DaemonPolicy.schema.d.ts
86
- export declare const IntensityConfig: Schema.Struct<{
87
- readonly restarts: Schema.Int;
88
- readonly window: Schema.Duration;
89
- }>;
90
- export type IntensityConfig = typeof IntensityConfig.Type;
91
- declare const IntensityTypeId: unique symbol;
92
- type IntensityTypeId = typeof IntensityTypeId;
93
- declare const BoundedIntensity_base: Schema.Class<BoundedIntensity, Schema.TaggedStruct<"Bounded", {
94
- readonly restarts: Schema.Int;
95
- readonly window: Schema.Duration;
280
+ //#region src/kernel/interpret-supervision-event.workflow.d.ts
281
+ declare const Stale_base: Schema.Class<Stale, Schema.TaggedStruct<"Stale", {}>, {}>;
282
+ declare class Stale extends Stale_base {
283
+ readonly [DecisionTypeId]: symbol;
284
+ }
285
+ declare const Continue_base: Schema.Class<Continue, Schema.TaggedStruct<"Continue", {
286
+ readonly core: Schema.Struct<{
287
+ readonly policy: typeof SupervisionPolicy;
288
+ readonly children: Schema.$Array<Schema.Struct<{
289
+ readonly childId: Schema.String;
290
+ readonly generation: Schema.Int;
291
+ readonly status: Schema.Literals<readonly ["starting", "ready", "stopping"]>;
292
+ readonly consecutiveRestarts: Schema.Int;
293
+ readonly probeFailures: Schema.Int;
294
+ }>>;
295
+ readonly restartStamps: Schema.$Array<Schema.Int>;
296
+ readonly nextOrdinal: Schema.Int;
297
+ }>;
298
+ readonly commands: Schema.Struct<{
299
+ readonly stops: Schema.$Array<Schema.TaggedStruct<"StopChild", {
300
+ readonly childId: Schema.String;
301
+ readonly generation: Schema.Int;
302
+ readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
303
+ readonly millis: Schema.Int;
304
+ }>, Schema.TaggedStruct<"Infinity", {}>]>;
305
+ }>>;
306
+ readonly starts: Schema.$Array<Schema.TaggedStruct<"StartChild", {
307
+ readonly childId: Schema.String;
308
+ readonly generation: Schema.Int;
309
+ }>>;
310
+ readonly arms: Schema.$Array<Schema.Union<readonly [Schema.TaggedStruct<"ArmChildTimer", {
311
+ readonly kind: Schema.Literals<readonly ["start_deadline", "backoff", "liveness_tick", "cool_down"]>;
312
+ readonly childId: Schema.String;
313
+ readonly generation: Schema.Int;
314
+ readonly deadline: Schema.Int;
315
+ }>, Schema.TaggedStruct<"ArmSupervisorTimer", {
316
+ readonly kind: Schema.Literals<readonly ["start_deadline", "backoff", "liveness_tick", "cool_down"]>;
317
+ readonly deadline: Schema.Int;
318
+ }>]>>;
319
+ readonly replies: Schema.$Array<Schema.Union<readonly [Schema.TaggedStruct<"ReplyStartAccepted", {
320
+ readonly requestId: Schema.String;
321
+ readonly childId: Schema.String;
322
+ readonly generation: Schema.Int;
323
+ }>, Schema.TaggedStruct<"ReplyStartRefused", {
324
+ readonly requestId: Schema.String;
325
+ }>, Schema.TaggedStruct<"ReplyStopped", {
326
+ readonly requestId: Schema.String;
327
+ }>]>>;
328
+ readonly terminates: Schema.$Array<Schema.TaggedStruct<"TerminateSupervisor", {
329
+ readonly reason: Schema.Union<readonly [Schema.TaggedStruct<"Normal", {}>, Schema.TaggedStruct<"Shutdown", {}>, Schema.TaggedStruct<"Abnormal", {
330
+ readonly report: Schema.Union<readonly [Schema.TaggedStruct<"CauseReport", {
331
+ readonly cause: Schema.String;
332
+ }>, Schema.TaggedStruct<"ExitReport", {
333
+ readonly code: Schema.Int;
334
+ readonly signal: Schema.String;
335
+ }>, Schema.TaggedStruct<"InferredReport", {
336
+ readonly failedProbes: Schema.Int;
337
+ }>, Schema.TaggedStruct<"DeadlineMissed", {
338
+ readonly waitedMillis: Schema.Int;
339
+ }>]>;
340
+ }>]>;
341
+ readonly exit: Schema.Union<readonly [Schema.TaggedStruct<"RequestedExit", {}>, Schema.TaggedStruct<"IntensityExceededExit", {
342
+ readonly childId: Schema.String;
343
+ readonly generation: Schema.Int;
344
+ }>]>;
345
+ }>>;
346
+ }>;
96
347
  }>, {}>;
97
- export declare class BoundedIntensity extends BoundedIntensity_base {
98
- readonly [IntensityTypeId]: symbol;
99
- }
100
- declare const UnboundedIntensity_base: Schema.Class<UnboundedIntensity, Schema.TaggedStruct<"Unbounded", {}>, {}>;
101
- export declare class UnboundedIntensity extends UnboundedIntensity_base {
102
- readonly [IntensityTypeId]: symbol;
103
- }
104
- export declare const Intensity: Schema.Union<readonly [typeof BoundedIntensity, typeof UnboundedIntensity]>;
105
- export type Intensity = typeof Intensity.Type;
106
- declare const ChildPolicyConfig_base: Schema.Class<ChildPolicyConfig, Schema.Struct<{
107
- readonly restart: Schema.optional<Schema.Literals<readonly ["permanent", "transient", "temporary"]>>;
108
- readonly intensity: Schema.optional<Schema.Struct<{
109
- readonly restarts: Schema.Int;
110
- readonly window: Schema.Duration;
348
+ declare class Continue extends Continue_base {
349
+ readonly [DecisionTypeId]: symbol;
350
+ }
351
+ declare const RestartChildren_base: Schema.Class<RestartChildren, Schema.TaggedStruct<"RestartChildren", {
352
+ readonly core: Schema.Struct<{
353
+ readonly policy: typeof SupervisionPolicy;
354
+ readonly children: Schema.$Array<Schema.Struct<{
355
+ readonly childId: Schema.String;
356
+ readonly generation: Schema.Int;
357
+ readonly status: Schema.Literals<readonly ["starting", "ready", "stopping"]>;
358
+ readonly consecutiveRestarts: Schema.Int;
359
+ readonly probeFailures: Schema.Int;
360
+ }>>;
361
+ readonly restartStamps: Schema.$Array<Schema.Int>;
362
+ readonly nextOrdinal: Schema.Int;
363
+ }>;
364
+ readonly pending: Schema.$Array<Schema.Struct<{
365
+ readonly childId: Schema.String;
366
+ readonly generation: Schema.Int;
111
367
  }>>;
368
+ readonly commands: Schema.Struct<{
369
+ readonly stops: Schema.$Array<Schema.TaggedStruct<"StopChild", {
370
+ readonly childId: Schema.String;
371
+ readonly generation: Schema.Int;
372
+ readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
373
+ readonly millis: Schema.Int;
374
+ }>, Schema.TaggedStruct<"Infinity", {}>]>;
375
+ }>>;
376
+ readonly starts: Schema.$Array<Schema.TaggedStruct<"StartChild", {
377
+ readonly childId: Schema.String;
378
+ readonly generation: Schema.Int;
379
+ }>>;
380
+ readonly arms: Schema.$Array<Schema.Union<readonly [Schema.TaggedStruct<"ArmChildTimer", {
381
+ readonly kind: Schema.Literals<readonly ["start_deadline", "backoff", "liveness_tick", "cool_down"]>;
382
+ readonly childId: Schema.String;
383
+ readonly generation: Schema.Int;
384
+ readonly deadline: Schema.Int;
385
+ }>, Schema.TaggedStruct<"ArmSupervisorTimer", {
386
+ readonly kind: Schema.Literals<readonly ["start_deadline", "backoff", "liveness_tick", "cool_down"]>;
387
+ readonly deadline: Schema.Int;
388
+ }>]>>;
389
+ readonly replies: Schema.$Array<Schema.Union<readonly [Schema.TaggedStruct<"ReplyStartAccepted", {
390
+ readonly requestId: Schema.String;
391
+ readonly childId: Schema.String;
392
+ readonly generation: Schema.Int;
393
+ }>, Schema.TaggedStruct<"ReplyStartRefused", {
394
+ readonly requestId: Schema.String;
395
+ }>, Schema.TaggedStruct<"ReplyStopped", {
396
+ readonly requestId: Schema.String;
397
+ }>]>>;
398
+ readonly terminates: Schema.$Array<Schema.TaggedStruct<"TerminateSupervisor", {
399
+ readonly reason: Schema.Union<readonly [Schema.TaggedStruct<"Normal", {}>, Schema.TaggedStruct<"Shutdown", {}>, Schema.TaggedStruct<"Abnormal", {
400
+ readonly report: Schema.Union<readonly [Schema.TaggedStruct<"CauseReport", {
401
+ readonly cause: Schema.String;
402
+ }>, Schema.TaggedStruct<"ExitReport", {
403
+ readonly code: Schema.Int;
404
+ readonly signal: Schema.String;
405
+ }>, Schema.TaggedStruct<"InferredReport", {
406
+ readonly failedProbes: Schema.Int;
407
+ }>, Schema.TaggedStruct<"DeadlineMissed", {
408
+ readonly waitedMillis: Schema.Int;
409
+ }>]>;
410
+ }>]>;
411
+ readonly exit: Schema.Union<readonly [Schema.TaggedStruct<"RequestedExit", {}>, Schema.TaggedStruct<"IntensityExceededExit", {
412
+ readonly childId: Schema.String;
413
+ readonly generation: Schema.Int;
414
+ }>]>;
415
+ }>>;
416
+ }>;
417
+ }>, {}>;
418
+ declare class RestartChildren extends RestartChildren_base {
419
+ readonly [DecisionTypeId]: symbol;
420
+ }
421
+ declare const StartChildren_base: Schema.Class<StartChildren, Schema.TaggedStruct<"StartChildren", {
422
+ readonly core: Schema.Struct<{
423
+ readonly policy: typeof SupervisionPolicy;
424
+ readonly children: Schema.$Array<Schema.Struct<{
425
+ readonly childId: Schema.String;
426
+ readonly generation: Schema.Int;
427
+ readonly status: Schema.Literals<readonly ["starting", "ready", "stopping"]>;
428
+ readonly consecutiveRestarts: Schema.Int;
429
+ readonly probeFailures: Schema.Int;
430
+ }>>;
431
+ readonly restartStamps: Schema.$Array<Schema.Int>;
432
+ readonly nextOrdinal: Schema.Int;
433
+ }>;
434
+ readonly commands: Schema.Struct<{
435
+ readonly stops: Schema.$Array<Schema.TaggedStruct<"StopChild", {
436
+ readonly childId: Schema.String;
437
+ readonly generation: Schema.Int;
438
+ readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
439
+ readonly millis: Schema.Int;
440
+ }>, Schema.TaggedStruct<"Infinity", {}>]>;
441
+ }>>;
442
+ readonly starts: Schema.$Array<Schema.TaggedStruct<"StartChild", {
443
+ readonly childId: Schema.String;
444
+ readonly generation: Schema.Int;
445
+ }>>;
446
+ readonly arms: Schema.$Array<Schema.Union<readonly [Schema.TaggedStruct<"ArmChildTimer", {
447
+ readonly kind: Schema.Literals<readonly ["start_deadline", "backoff", "liveness_tick", "cool_down"]>;
448
+ readonly childId: Schema.String;
449
+ readonly generation: Schema.Int;
450
+ readonly deadline: Schema.Int;
451
+ }>, Schema.TaggedStruct<"ArmSupervisorTimer", {
452
+ readonly kind: Schema.Literals<readonly ["start_deadline", "backoff", "liveness_tick", "cool_down"]>;
453
+ readonly deadline: Schema.Int;
454
+ }>]>>;
455
+ readonly replies: Schema.$Array<Schema.Union<readonly [Schema.TaggedStruct<"ReplyStartAccepted", {
456
+ readonly requestId: Schema.String;
457
+ readonly childId: Schema.String;
458
+ readonly generation: Schema.Int;
459
+ }>, Schema.TaggedStruct<"ReplyStartRefused", {
460
+ readonly requestId: Schema.String;
461
+ }>, Schema.TaggedStruct<"ReplyStopped", {
462
+ readonly requestId: Schema.String;
463
+ }>]>>;
464
+ readonly terminates: Schema.$Array<Schema.TaggedStruct<"TerminateSupervisor", {
465
+ readonly reason: Schema.Union<readonly [Schema.TaggedStruct<"Normal", {}>, Schema.TaggedStruct<"Shutdown", {}>, Schema.TaggedStruct<"Abnormal", {
466
+ readonly report: Schema.Union<readonly [Schema.TaggedStruct<"CauseReport", {
467
+ readonly cause: Schema.String;
468
+ }>, Schema.TaggedStruct<"ExitReport", {
469
+ readonly code: Schema.Int;
470
+ readonly signal: Schema.String;
471
+ }>, Schema.TaggedStruct<"InferredReport", {
472
+ readonly failedProbes: Schema.Int;
473
+ }>, Schema.TaggedStruct<"DeadlineMissed", {
474
+ readonly waitedMillis: Schema.Int;
475
+ }>]>;
476
+ }>]>;
477
+ readonly exit: Schema.Union<readonly [Schema.TaggedStruct<"RequestedExit", {}>, Schema.TaggedStruct<"IntensityExceededExit", {
478
+ readonly childId: Schema.String;
479
+ readonly generation: Schema.Int;
480
+ }>]>;
481
+ }>>;
482
+ }>;
483
+ }>, {}>;
484
+ declare class StartChildren extends StartChildren_base {
485
+ readonly [DecisionTypeId]: symbol;
486
+ }
487
+ declare const CoolDown_base: Schema.Class<CoolDown, Schema.TaggedStruct<"CoolDown", {
488
+ readonly core: Schema.Struct<{
489
+ readonly policy: typeof SupervisionPolicy;
490
+ readonly children: Schema.$Array<Schema.Struct<{
491
+ readonly childId: Schema.String;
492
+ readonly generation: Schema.Int;
493
+ readonly status: Schema.Literals<readonly ["starting", "ready", "stopping"]>;
494
+ readonly consecutiveRestarts: Schema.Int;
495
+ readonly probeFailures: Schema.Int;
496
+ }>>;
497
+ readonly restartStamps: Schema.$Array<Schema.Int>;
498
+ readonly nextOrdinal: Schema.Int;
499
+ }>;
500
+ readonly millis: Schema.Int;
501
+ readonly commands: Schema.Struct<{
502
+ readonly stops: Schema.$Array<Schema.TaggedStruct<"StopChild", {
503
+ readonly childId: Schema.String;
504
+ readonly generation: Schema.Int;
505
+ readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
506
+ readonly millis: Schema.Int;
507
+ }>, Schema.TaggedStruct<"Infinity", {}>]>;
508
+ }>>;
509
+ readonly starts: Schema.$Array<Schema.TaggedStruct<"StartChild", {
510
+ readonly childId: Schema.String;
511
+ readonly generation: Schema.Int;
512
+ }>>;
513
+ readonly arms: Schema.$Array<Schema.Union<readonly [Schema.TaggedStruct<"ArmChildTimer", {
514
+ readonly kind: Schema.Literals<readonly ["start_deadline", "backoff", "liveness_tick", "cool_down"]>;
515
+ readonly childId: Schema.String;
516
+ readonly generation: Schema.Int;
517
+ readonly deadline: Schema.Int;
518
+ }>, Schema.TaggedStruct<"ArmSupervisorTimer", {
519
+ readonly kind: Schema.Literals<readonly ["start_deadline", "backoff", "liveness_tick", "cool_down"]>;
520
+ readonly deadline: Schema.Int;
521
+ }>]>>;
522
+ readonly replies: Schema.$Array<Schema.Union<readonly [Schema.TaggedStruct<"ReplyStartAccepted", {
523
+ readonly requestId: Schema.String;
524
+ readonly childId: Schema.String;
525
+ readonly generation: Schema.Int;
526
+ }>, Schema.TaggedStruct<"ReplyStartRefused", {
527
+ readonly requestId: Schema.String;
528
+ }>, Schema.TaggedStruct<"ReplyStopped", {
529
+ readonly requestId: Schema.String;
530
+ }>]>>;
531
+ readonly terminates: Schema.$Array<Schema.TaggedStruct<"TerminateSupervisor", {
532
+ readonly reason: Schema.Union<readonly [Schema.TaggedStruct<"Normal", {}>, Schema.TaggedStruct<"Shutdown", {}>, Schema.TaggedStruct<"Abnormal", {
533
+ readonly report: Schema.Union<readonly [Schema.TaggedStruct<"CauseReport", {
534
+ readonly cause: Schema.String;
535
+ }>, Schema.TaggedStruct<"ExitReport", {
536
+ readonly code: Schema.Int;
537
+ readonly signal: Schema.String;
538
+ }>, Schema.TaggedStruct<"InferredReport", {
539
+ readonly failedProbes: Schema.Int;
540
+ }>, Schema.TaggedStruct<"DeadlineMissed", {
541
+ readonly waitedMillis: Schema.Int;
542
+ }>]>;
543
+ }>]>;
544
+ readonly exit: Schema.Union<readonly [Schema.TaggedStruct<"RequestedExit", {}>, Schema.TaggedStruct<"IntensityExceededExit", {
545
+ readonly childId: Schema.String;
546
+ readonly generation: Schema.Int;
547
+ }>]>;
548
+ }>>;
549
+ }>;
550
+ }>, {}>;
551
+ declare class CoolDown extends CoolDown_base {
552
+ readonly [DecisionTypeId]: symbol;
553
+ }
554
+ declare const StopChildren_base: Schema.Class<StopChildren, Schema.TaggedStruct<"StopChildren", {
555
+ readonly core: Schema.Struct<{
556
+ readonly policy: typeof SupervisionPolicy;
557
+ readonly children: Schema.$Array<Schema.Struct<{
558
+ readonly childId: Schema.String;
559
+ readonly generation: Schema.Int;
560
+ readonly status: Schema.Literals<readonly ["starting", "ready", "stopping"]>;
561
+ readonly consecutiveRestarts: Schema.Int;
562
+ readonly probeFailures: Schema.Int;
563
+ }>>;
564
+ readonly restartStamps: Schema.$Array<Schema.Int>;
565
+ readonly nextOrdinal: Schema.Int;
566
+ }>;
567
+ readonly reason: Schema.Union<readonly [Schema.TaggedStruct<"Normal", {}>, Schema.TaggedStruct<"Shutdown", {}>, Schema.TaggedStruct<"Abnormal", {
568
+ readonly report: Schema.Union<readonly [Schema.TaggedStruct<"CauseReport", {
569
+ readonly cause: Schema.String;
570
+ }>, Schema.TaggedStruct<"ExitReport", {
571
+ readonly code: Schema.Int;
572
+ readonly signal: Schema.String;
573
+ }>, Schema.TaggedStruct<"InferredReport", {
574
+ readonly failedProbes: Schema.Int;
575
+ }>, Schema.TaggedStruct<"DeadlineMissed", {
576
+ readonly waitedMillis: Schema.Int;
577
+ }>]>;
578
+ }>]>;
579
+ readonly exit: Schema.Union<readonly [Schema.TaggedStruct<"RequestedExit", {}>, Schema.TaggedStruct<"IntensityExceededExit", {
580
+ readonly childId: Schema.String;
581
+ readonly generation: Schema.Int;
582
+ }>]>;
583
+ readonly commands: Schema.Struct<{
584
+ readonly stops: Schema.$Array<Schema.TaggedStruct<"StopChild", {
585
+ readonly childId: Schema.String;
586
+ readonly generation: Schema.Int;
587
+ readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
588
+ readonly millis: Schema.Int;
589
+ }>, Schema.TaggedStruct<"Infinity", {}>]>;
590
+ }>>;
591
+ readonly starts: Schema.$Array<Schema.TaggedStruct<"StartChild", {
592
+ readonly childId: Schema.String;
593
+ readonly generation: Schema.Int;
594
+ }>>;
595
+ readonly arms: Schema.$Array<Schema.Union<readonly [Schema.TaggedStruct<"ArmChildTimer", {
596
+ readonly kind: Schema.Literals<readonly ["start_deadline", "backoff", "liveness_tick", "cool_down"]>;
597
+ readonly childId: Schema.String;
598
+ readonly generation: Schema.Int;
599
+ readonly deadline: Schema.Int;
600
+ }>, Schema.TaggedStruct<"ArmSupervisorTimer", {
601
+ readonly kind: Schema.Literals<readonly ["start_deadline", "backoff", "liveness_tick", "cool_down"]>;
602
+ readonly deadline: Schema.Int;
603
+ }>]>>;
604
+ readonly replies: Schema.$Array<Schema.Union<readonly [Schema.TaggedStruct<"ReplyStartAccepted", {
605
+ readonly requestId: Schema.String;
606
+ readonly childId: Schema.String;
607
+ readonly generation: Schema.Int;
608
+ }>, Schema.TaggedStruct<"ReplyStartRefused", {
609
+ readonly requestId: Schema.String;
610
+ }>, Schema.TaggedStruct<"ReplyStopped", {
611
+ readonly requestId: Schema.String;
612
+ }>]>>;
613
+ readonly terminates: Schema.$Array<Schema.TaggedStruct<"TerminateSupervisor", {
614
+ readonly reason: Schema.Union<readonly [Schema.TaggedStruct<"Normal", {}>, Schema.TaggedStruct<"Shutdown", {}>, Schema.TaggedStruct<"Abnormal", {
615
+ readonly report: Schema.Union<readonly [Schema.TaggedStruct<"CauseReport", {
616
+ readonly cause: Schema.String;
617
+ }>, Schema.TaggedStruct<"ExitReport", {
618
+ readonly code: Schema.Int;
619
+ readonly signal: Schema.String;
620
+ }>, Schema.TaggedStruct<"InferredReport", {
621
+ readonly failedProbes: Schema.Int;
622
+ }>, Schema.TaggedStruct<"DeadlineMissed", {
623
+ readonly waitedMillis: Schema.Int;
624
+ }>]>;
625
+ }>]>;
626
+ readonly exit: Schema.Union<readonly [Schema.TaggedStruct<"RequestedExit", {}>, Schema.TaggedStruct<"IntensityExceededExit", {
627
+ readonly childId: Schema.String;
628
+ readonly generation: Schema.Int;
629
+ }>]>;
630
+ }>>;
631
+ }>;
112
632
  }>, {}>;
113
- export declare class ChildPolicyConfig extends ChildPolicyConfig_base {}
114
- declare const LockPolicyConfig_base: Schema.Class<LockPolicyConfig, Schema.Struct<{
115
- readonly mode: Schema.optional<Schema.Literals<readonly ["none", "required", "optional"]>>;
116
- readonly key: Schema.optional<Schema.String>;
633
+ declare class StopChildren extends StopChildren_base {
634
+ readonly [DecisionTypeId]: symbol;
635
+ }
636
+ declare const Terminate_base: Schema.Class<Terminate, Schema.TaggedStruct<"Terminate", {
637
+ readonly reason: Schema.Union<readonly [Schema.TaggedStruct<"Normal", {}>, Schema.TaggedStruct<"Shutdown", {}>, Schema.TaggedStruct<"Abnormal", {
638
+ readonly report: Schema.Union<readonly [Schema.TaggedStruct<"CauseReport", {
639
+ readonly cause: Schema.String;
640
+ }>, Schema.TaggedStruct<"ExitReport", {
641
+ readonly code: Schema.Int;
642
+ readonly signal: Schema.String;
643
+ }>, Schema.TaggedStruct<"InferredReport", {
644
+ readonly failedProbes: Schema.Int;
645
+ }>, Schema.TaggedStruct<"DeadlineMissed", {
646
+ readonly waitedMillis: Schema.Int;
647
+ }>]>;
648
+ }>]>;
649
+ readonly commands: Schema.Struct<{
650
+ readonly stops: Schema.$Array<Schema.TaggedStruct<"StopChild", {
651
+ readonly childId: Schema.String;
652
+ readonly generation: Schema.Int;
653
+ readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
654
+ readonly millis: Schema.Int;
655
+ }>, Schema.TaggedStruct<"Infinity", {}>]>;
656
+ }>>;
657
+ readonly starts: Schema.$Array<Schema.TaggedStruct<"StartChild", {
658
+ readonly childId: Schema.String;
659
+ readonly generation: Schema.Int;
660
+ }>>;
661
+ readonly arms: Schema.$Array<Schema.Union<readonly [Schema.TaggedStruct<"ArmChildTimer", {
662
+ readonly kind: Schema.Literals<readonly ["start_deadline", "backoff", "liveness_tick", "cool_down"]>;
663
+ readonly childId: Schema.String;
664
+ readonly generation: Schema.Int;
665
+ readonly deadline: Schema.Int;
666
+ }>, Schema.TaggedStruct<"ArmSupervisorTimer", {
667
+ readonly kind: Schema.Literals<readonly ["start_deadline", "backoff", "liveness_tick", "cool_down"]>;
668
+ readonly deadline: Schema.Int;
669
+ }>]>>;
670
+ readonly replies: Schema.$Array<Schema.Union<readonly [Schema.TaggedStruct<"ReplyStartAccepted", {
671
+ readonly requestId: Schema.String;
672
+ readonly childId: Schema.String;
673
+ readonly generation: Schema.Int;
674
+ }>, Schema.TaggedStruct<"ReplyStartRefused", {
675
+ readonly requestId: Schema.String;
676
+ }>, Schema.TaggedStruct<"ReplyStopped", {
677
+ readonly requestId: Schema.String;
678
+ }>]>>;
679
+ readonly terminates: Schema.$Array<Schema.TaggedStruct<"TerminateSupervisor", {
680
+ readonly reason: Schema.Union<readonly [Schema.TaggedStruct<"Normal", {}>, Schema.TaggedStruct<"Shutdown", {}>, Schema.TaggedStruct<"Abnormal", {
681
+ readonly report: Schema.Union<readonly [Schema.TaggedStruct<"CauseReport", {
682
+ readonly cause: Schema.String;
683
+ }>, Schema.TaggedStruct<"ExitReport", {
684
+ readonly code: Schema.Int;
685
+ readonly signal: Schema.String;
686
+ }>, Schema.TaggedStruct<"InferredReport", {
687
+ readonly failedProbes: Schema.Int;
688
+ }>, Schema.TaggedStruct<"DeadlineMissed", {
689
+ readonly waitedMillis: Schema.Int;
690
+ }>]>;
691
+ }>]>;
692
+ readonly exit: Schema.Union<readonly [Schema.TaggedStruct<"RequestedExit", {}>, Schema.TaggedStruct<"IntensityExceededExit", {
693
+ readonly childId: Schema.String;
694
+ readonly generation: Schema.Int;
695
+ }>]>;
696
+ }>>;
697
+ }>;
117
698
  }>, {}>;
118
- export declare class LockPolicyConfig extends LockPolicyConfig_base {}
119
- declare const TickPolicyConfig_base: Schema.Class<TickPolicyConfig, Schema.Struct<{
120
- readonly spanName: Schema.optional<Schema.String>;
121
- readonly tickTimeout: Schema.Duration;
122
- readonly startLogLevel: Schema.optional<Schema.Literals<readonly ["debug", "info"]>>;
699
+ declare class Terminate extends Terminate_base {
700
+ readonly [DecisionTypeId]: symbol;
701
+ }
702
+ declare const RefuseDynamicStart_base: Schema.Class<RefuseDynamicStart, Schema.TaggedStruct<"RefuseDynamicStart", {
703
+ readonly commands: Schema.Struct<{
704
+ readonly stops: Schema.$Array<Schema.TaggedStruct<"StopChild", {
705
+ readonly childId: Schema.String;
706
+ readonly generation: Schema.Int;
707
+ readonly shutdown: Schema.Union<readonly [Schema.TaggedStruct<"Brutal", {}>, Schema.TaggedStruct<"Graceful", {
708
+ readonly millis: Schema.Int;
709
+ }>, Schema.TaggedStruct<"Infinity", {}>]>;
710
+ }>>;
711
+ readonly starts: Schema.$Array<Schema.TaggedStruct<"StartChild", {
712
+ readonly childId: Schema.String;
713
+ readonly generation: Schema.Int;
714
+ }>>;
715
+ readonly arms: Schema.$Array<Schema.Union<readonly [Schema.TaggedStruct<"ArmChildTimer", {
716
+ readonly kind: Schema.Literals<readonly ["start_deadline", "backoff", "liveness_tick", "cool_down"]>;
717
+ readonly childId: Schema.String;
718
+ readonly generation: Schema.Int;
719
+ readonly deadline: Schema.Int;
720
+ }>, Schema.TaggedStruct<"ArmSupervisorTimer", {
721
+ readonly kind: Schema.Literals<readonly ["start_deadline", "backoff", "liveness_tick", "cool_down"]>;
722
+ readonly deadline: Schema.Int;
723
+ }>]>>;
724
+ readonly replies: Schema.$Array<Schema.Union<readonly [Schema.TaggedStruct<"ReplyStartAccepted", {
725
+ readonly requestId: Schema.String;
726
+ readonly childId: Schema.String;
727
+ readonly generation: Schema.Int;
728
+ }>, Schema.TaggedStruct<"ReplyStartRefused", {
729
+ readonly requestId: Schema.String;
730
+ }>, Schema.TaggedStruct<"ReplyStopped", {
731
+ readonly requestId: Schema.String;
732
+ }>]>>;
733
+ readonly terminates: Schema.$Array<Schema.TaggedStruct<"TerminateSupervisor", {
734
+ readonly reason: Schema.Union<readonly [Schema.TaggedStruct<"Normal", {}>, Schema.TaggedStruct<"Shutdown", {}>, Schema.TaggedStruct<"Abnormal", {
735
+ readonly report: Schema.Union<readonly [Schema.TaggedStruct<"CauseReport", {
736
+ readonly cause: Schema.String;
737
+ }>, Schema.TaggedStruct<"ExitReport", {
738
+ readonly code: Schema.Int;
739
+ readonly signal: Schema.String;
740
+ }>, Schema.TaggedStruct<"InferredReport", {
741
+ readonly failedProbes: Schema.Int;
742
+ }>, Schema.TaggedStruct<"DeadlineMissed", {
743
+ readonly waitedMillis: Schema.Int;
744
+ }>]>;
745
+ }>]>;
746
+ readonly exit: Schema.Union<readonly [Schema.TaggedStruct<"RequestedExit", {}>, Schema.TaggedStruct<"IntensityExceededExit", {
747
+ readonly childId: Schema.String;
748
+ readonly generation: Schema.Int;
749
+ }>]>;
750
+ }>>;
751
+ }>;
752
+ }>, {}>;
753
+ declare class RefuseDynamicStart extends RefuseDynamicStart_base {
754
+ readonly [DecisionTypeId]: symbol;
755
+ }
756
+ declare const SupervisionDecision: Schema.Union<readonly [typeof Stale, typeof Continue, typeof RestartChildren, typeof StartChildren, typeof CoolDown, typeof StopChildren, typeof Terminate, typeof RefuseDynamicStart]>;
757
+ type SupervisionDecision = typeof SupervisionDecision.Type;
758
+ declare const Running_base: Schema.Class<Running, Schema.TaggedStruct<"Running", {
759
+ readonly core: Schema.Struct<{
760
+ readonly policy: typeof SupervisionPolicy;
761
+ readonly children: Schema.$Array<Schema.Struct<{
762
+ readonly childId: Schema.String;
763
+ readonly generation: Schema.Int;
764
+ readonly status: Schema.Literals<readonly ["starting", "ready", "stopping"]>;
765
+ readonly consecutiveRestarts: Schema.Int;
766
+ readonly probeFailures: Schema.Int;
767
+ }>>;
768
+ readonly restartStamps: Schema.$Array<Schema.Int>;
769
+ readonly nextOrdinal: Schema.Int;
770
+ }>;
123
771
  }>, {}>;
124
- export declare class TickPolicyConfig extends TickPolicyConfig_base {}
125
- export declare const MaxChildren: Schema.brand<Schema.Int, "MaxChildren">;
126
- export type MaxChildren = typeof MaxChildren.Type;
772
+ declare class Running extends Running_base {
773
+ readonly [StateTypeId]: symbol;
774
+ }
775
+ declare const Restarting_base: Schema.Class<Restarting, Schema.TaggedStruct<"Restarting", {
776
+ readonly core: Schema.Struct<{
777
+ readonly policy: typeof SupervisionPolicy;
778
+ readonly children: Schema.$Array<Schema.Struct<{
779
+ readonly childId: Schema.String;
780
+ readonly generation: Schema.Int;
781
+ readonly status: Schema.Literals<readonly ["starting", "ready", "stopping"]>;
782
+ readonly consecutiveRestarts: Schema.Int;
783
+ readonly probeFailures: Schema.Int;
784
+ }>>;
785
+ readonly restartStamps: Schema.$Array<Schema.Int>;
786
+ readonly nextOrdinal: Schema.Int;
787
+ }>;
788
+ readonly pending: Schema.$Array<Schema.Struct<{
789
+ readonly childId: Schema.String;
790
+ readonly generation: Schema.Int;
791
+ }>>;
792
+ }>, {}>;
793
+ declare class Restarting extends Restarting_base {
794
+ readonly [StateTypeId]: symbol;
795
+ }
796
+ declare const CoolingDown_base: Schema.Class<CoolingDown, Schema.TaggedStruct<"CoolingDown", {
797
+ readonly core: Schema.Struct<{
798
+ readonly policy: typeof SupervisionPolicy;
799
+ readonly children: Schema.$Array<Schema.Struct<{
800
+ readonly childId: Schema.String;
801
+ readonly generation: Schema.Int;
802
+ readonly status: Schema.Literals<readonly ["starting", "ready", "stopping"]>;
803
+ readonly consecutiveRestarts: Schema.Int;
804
+ readonly probeFailures: Schema.Int;
805
+ }>>;
806
+ readonly restartStamps: Schema.$Array<Schema.Int>;
807
+ readonly nextOrdinal: Schema.Int;
808
+ }>;
809
+ readonly millis: Schema.Int;
810
+ }>, {}>;
811
+ declare class CoolingDown extends CoolingDown_base {
812
+ readonly [StateTypeId]: symbol;
813
+ }
814
+ declare const ShuttingDown_base: Schema.Class<ShuttingDown, Schema.TaggedStruct<"ShuttingDown", {
815
+ readonly core: Schema.Struct<{
816
+ readonly policy: typeof SupervisionPolicy;
817
+ readonly children: Schema.$Array<Schema.Struct<{
818
+ readonly childId: Schema.String;
819
+ readonly generation: Schema.Int;
820
+ readonly status: Schema.Literals<readonly ["starting", "ready", "stopping"]>;
821
+ readonly consecutiveRestarts: Schema.Int;
822
+ readonly probeFailures: Schema.Int;
823
+ }>>;
824
+ readonly restartStamps: Schema.$Array<Schema.Int>;
825
+ readonly nextOrdinal: Schema.Int;
826
+ }>;
827
+ readonly reason: Schema.Union<readonly [Schema.TaggedStruct<"Normal", {}>, Schema.TaggedStruct<"Shutdown", {}>, Schema.TaggedStruct<"Abnormal", {
828
+ readonly report: Schema.Union<readonly [Schema.TaggedStruct<"CauseReport", {
829
+ readonly cause: Schema.String;
830
+ }>, Schema.TaggedStruct<"ExitReport", {
831
+ readonly code: Schema.Int;
832
+ readonly signal: Schema.String;
833
+ }>, Schema.TaggedStruct<"InferredReport", {
834
+ readonly failedProbes: Schema.Int;
835
+ }>, Schema.TaggedStruct<"DeadlineMissed", {
836
+ readonly waitedMillis: Schema.Int;
837
+ }>]>;
838
+ }>]>;
839
+ readonly exit: Schema.Union<readonly [Schema.TaggedStruct<"RequestedExit", {}>, Schema.TaggedStruct<"IntensityExceededExit", {
840
+ readonly childId: Schema.String;
841
+ readonly generation: Schema.Int;
842
+ }>]>;
843
+ }>, {}>;
844
+ declare class ShuttingDown extends ShuttingDown_base {
845
+ readonly [StateTypeId]: symbol;
846
+ }
847
+ declare const Terminated_base: Schema.Class<Terminated, Schema.TaggedStruct<"Terminated", {
848
+ readonly reason: Schema.Union<readonly [Schema.TaggedStruct<"Normal", {}>, Schema.TaggedStruct<"Shutdown", {}>, Schema.TaggedStruct<"Abnormal", {
849
+ readonly report: Schema.Union<readonly [Schema.TaggedStruct<"CauseReport", {
850
+ readonly cause: Schema.String;
851
+ }>, Schema.TaggedStruct<"ExitReport", {
852
+ readonly code: Schema.Int;
853
+ readonly signal: Schema.String;
854
+ }>, Schema.TaggedStruct<"InferredReport", {
855
+ readonly failedProbes: Schema.Int;
856
+ }>, Schema.TaggedStruct<"DeadlineMissed", {
857
+ readonly waitedMillis: Schema.Int;
858
+ }>]>;
859
+ }>]>;
860
+ }>, {}>;
861
+ declare class Terminated extends Terminated_base {
862
+ readonly [StateTypeId]: symbol;
863
+ }
864
+ declare const SupervisorState: Schema.Union<readonly [typeof Running, typeof Restarting, typeof CoolingDown, typeof ShuttingDown, typeof Terminated]>;
865
+ type SupervisorState = typeof SupervisorState.Type;
127
866
  //#endregion
128
- //#region src/DaemonReporterAdapter.d.ts
129
- export interface DaemonReporterService {
130
- readonly onRestart: (name: string, cause: Cause.Cause<never>) => Effect.Effect<void>;
131
- readonly onExhausted: (name: string, cause: Cause.Cause<never>) => Effect.Effect<void>;
132
- }
133
- declare const DaemonReporter_base: Context.ServiceClass<DaemonReporter, "@systemfsoftware/effect-daemon-spec/DaemonReporterAdapter/DaemonReporter", DaemonReporterService>;
134
- export declare class DaemonReporter extends DaemonReporter_base {}
135
- export declare const Noop: Layer.Layer<DaemonReporter>;
867
+ //#region src/kernel/SupervisionEvent.schema.d.ts
868
+ declare const SupervisionEvent: Schema.Union<readonly [Schema.TaggedStruct<"SupervisorStarted", {
869
+ readonly at: Schema.Int;
870
+ }>, Schema.TaggedStruct<"ChildStarted", {
871
+ readonly at: Schema.Int;
872
+ readonly childId: Schema.String;
873
+ readonly generation: Schema.Int;
874
+ }>, Schema.TaggedStruct<"ChildReady", {
875
+ readonly at: Schema.Int;
876
+ readonly childId: Schema.String;
877
+ readonly generation: Schema.Int;
878
+ }>, Schema.TaggedStruct<"ChildTerminated", {
879
+ readonly at: Schema.Int;
880
+ readonly childId: Schema.String;
881
+ readonly generation: Schema.Int;
882
+ readonly reason: Schema.Union<readonly [Schema.TaggedStruct<"Normal", {}>, Schema.TaggedStruct<"Shutdown", {}>, Schema.TaggedStruct<"Abnormal", {
883
+ readonly report: Schema.Union<readonly [Schema.TaggedStruct<"CauseReport", {
884
+ readonly cause: Schema.String;
885
+ }>, Schema.TaggedStruct<"ExitReport", {
886
+ readonly code: Schema.Int;
887
+ readonly signal: Schema.String;
888
+ }>, Schema.TaggedStruct<"InferredReport", {
889
+ readonly failedProbes: Schema.Int;
890
+ }>, Schema.TaggedStruct<"DeadlineMissed", {
891
+ readonly waitedMillis: Schema.Int;
892
+ }>]>;
893
+ }>]>;
894
+ }>, Schema.TaggedStruct<"ChildStopped", {
895
+ readonly at: Schema.Int;
896
+ readonly childId: Schema.String;
897
+ readonly generation: Schema.Int;
898
+ }>, Schema.TaggedStruct<"ProbeResult", {
899
+ readonly at: Schema.Int;
900
+ readonly childId: Schema.String;
901
+ readonly generation: Schema.Int;
902
+ readonly alive: Schema.Boolean;
903
+ }>, Schema.TaggedStruct<"TimerElapsed", {
904
+ readonly at: Schema.Int;
905
+ readonly kind: Schema.Literals<readonly ["start_deadline", "backoff", "liveness_tick", "cool_down"]>;
906
+ readonly target: Schema.Union<readonly [Schema.TaggedStruct<"ChildTimer", {
907
+ readonly childId: Schema.String;
908
+ readonly generation: Schema.Int;
909
+ }>, Schema.TaggedStruct<"SupervisorTimer", {}>]>;
910
+ }>, Schema.TaggedStruct<"DynamicStartRequested", {
911
+ readonly at: Schema.Int;
912
+ readonly requestId: Schema.String;
913
+ }>, Schema.TaggedStruct<"DynamicStopRequested", {
914
+ readonly at: Schema.Int;
915
+ readonly requestId: Schema.String;
916
+ readonly childId: Schema.String;
917
+ readonly generation: Schema.Int;
918
+ }>, Schema.TaggedStruct<"ShutdownRequested", {
919
+ readonly at: Schema.Int;
920
+ readonly reason: Schema.Union<readonly [Schema.TaggedStruct<"Normal", {}>, Schema.TaggedStruct<"Shutdown", {}>, Schema.TaggedStruct<"Abnormal", {
921
+ readonly report: Schema.Union<readonly [Schema.TaggedStruct<"CauseReport", {
922
+ readonly cause: Schema.String;
923
+ }>, Schema.TaggedStruct<"ExitReport", {
924
+ readonly code: Schema.Int;
925
+ readonly signal: Schema.String;
926
+ }>, Schema.TaggedStruct<"InferredReport", {
927
+ readonly failedProbes: Schema.Int;
928
+ }>, Schema.TaggedStruct<"DeadlineMissed", {
929
+ readonly waitedMillis: Schema.Int;
930
+ }>]>;
931
+ }>]>;
932
+ }>]>;
933
+ type SupervisionEvent = typeof SupervisionEvent.Type;
136
934
  //#endregion
137
- //#region src/LoopTags.d.ts
935
+ //#region src/kernel/SupervisionLimits.schema.d.ts
936
+ /** How many times a child incarnation has been replaced: any non-negative safe integer. Generation stays small so generation+1 stays in range. */
937
+ declare const Generation: Schema.Int;
938
+ type Generation = typeof Generation.Type;
939
+ declare const ChildId: Schema.String;
940
+ type ChildId = typeof ChildId.Type;
941
+ //#endregion
942
+ //#region src/Supervisor/bound-child.d.ts
138
943
  /**
139
- * Discriminants on the public Worker loop variants.
140
- *
141
- * These tags are part of the published type identity of `poll`, `stream`,
142
- * and `subscription`. They are not unpublished wiring.
944
+ * A child bound to the medium that interprets its program, and to the services
945
+ * that medium needs (KTD9, R15, R17, R18). Every operation already runs in the
946
+ * context the supervisor acquired, so the handle stores one bound child per
947
+ * declared and dynamic child, and the executor never names a medium.
143
948
  */
144
- export declare const PollLoopTag: {
145
- readonly _tag: 'Poll';
146
- };
147
- export type PollLoopTag = typeof PollLoopTag;
148
- export declare const StreamLoopTag: {
149
- readonly _tag: 'Stream';
150
- };
151
- export type StreamLoopTag = typeof StreamLoopTag;
152
- export declare const SubscriptionLoopTag: {
153
- readonly _tag: 'Subscription';
154
- };
155
- export type SubscriptionLoopTag = typeof SubscriptionLoopTag;
949
+ interface BoundChild {
950
+ /**
951
+ * Starts one incarnation in a fresh child scope. A medium whose `start` fails
952
+ * produces an abnormal `TerminationReason` instead of a failure, so nothing
953
+ * downstream claims the child started (R15, KTD8).
954
+ */
955
+ readonly start: Effect.Effect<Started, TerminationReason, Scope.Scope>;
956
+ readonly report: (evidence: Started) => Effect.Effect<TerminationReason, never, never>;
957
+ readonly probe: (evidence: Started) => Effect.Effect<boolean, never, never>;
958
+ readonly stop: (evidence: Started, mode: ShutdownMode) => Effect.Effect<Stopped, never, never>;
959
+ }
156
960
  //#endregion
157
- //#region src/DaemonSpec.schema.d.ts
158
- export type LockConfig = {
159
- mode: 'none';
160
- } | {
161
- mode: 'optional';
162
- key: string;
163
- } | {
164
- mode: 'required';
165
- key: string;
166
- acquireRetryBackoff: Schedule.Schedule<Duration.Duration>;
167
- };
168
- export interface CommonOpts<L extends LockConfig> {
169
- readonly name: string;
170
- readonly child?: ChildPolicyConfig;
171
- readonly tick: TickPolicyConfig;
172
- readonly tickHooks?: TickPolicyHooks;
173
- readonly lock: L;
174
- }
175
- export type PollOpts<A, E, R, L extends LockConfig> = CommonOpts<L> & {
176
- readonly interval: Duration.Input;
177
- } & ({
178
- readonly prereq?: undefined;
179
- readonly work: Effect.Effect<A, E, R>;
180
- } | {
181
- readonly prereq: Effect.Effect<Option.Option<A>, E, R>;
182
- readonly work: (data: A) => Effect.Effect<void, E, R>;
183
- });
184
- export interface TickPolicyHooks<RetrySchedule = unknown> {
185
- readonly spanAttributes?: Effect.Effect<Record<string, string | number | boolean>>;
186
- readonly innerRetry?: Schedule.Schedule<RetrySchedule>;
187
- readonly trackDuration?: Metric.Histogram<Duration.Duration>;
188
- }
189
- export interface ReporterPolicyHooks {
190
- readonly onRestart?: (cause: Cause.Cause<never>) => Effect.Effect<void>;
191
- readonly onExhausted?: (cause: Cause.Cause<never>) => Effect.Effect<void>;
192
- }
193
- export interface PollLoop<E, R> extends PollLoopTag {
194
- readonly gate: Effect.Effect<Option.Option<Effect.Effect<void, E, R>>, E, R>;
195
- readonly interval: Duration.Input;
196
- }
197
- export interface StreamLoop<E, R, A = unknown> extends StreamLoopTag {
198
- readonly stream: Stream.Stream<A, E, R>;
199
- }
200
- export interface SubscriptionLoop<E, R> extends SubscriptionLoopTag {
201
- readonly acquire: Effect.Effect<void, E, R>;
202
- }
203
- export type LoopShape<E, R> = PollLoop<E, R> | StreamLoop<E, R> | SubscriptionLoop<E, R>;
204
- export interface Worker<E, R, L extends LockConfig = LockConfig> {
205
- readonly [WorkerTypeId]: WorkerTypeId;
206
- readonly name: string;
207
- readonly loop: LoopShape<E, R>;
208
- readonly child: ChildPolicyConfig;
209
- readonly tick: TickPolicyConfig;
210
- readonly tickHooks: TickPolicyHooks;
211
- readonly lock: L;
212
- }
213
- export interface Supervisor<E, R, L extends LockConfig = LockConfig> {
214
- readonly [SupervisorTypeId]: SupervisorTypeId;
215
- readonly name: string;
216
- readonly strategy: 'one_for_one' | 'one_for_all' | 'rest_for_one';
217
- readonly children: readonly (Worker<E, R> | Supervisor<E, R>)[];
218
- readonly supervision: Effect.Effect<SupervisionPolicy>;
219
- readonly lock: L;
220
- readonly reporter: ReporterPolicyHooks;
221
- }
222
- export interface DynamicSpec<E, R, Args> {
223
- readonly [DynamicSpecTypeId]: DynamicSpecTypeId;
224
- readonly name: string;
225
- readonly child: (args: Args) => Worker<E, R>;
226
- readonly maxChildren: MaxChildren;
961
+ //#region src/Supervisor/running-supervisor.handle.d.ts
962
+ /** Brands a running supervisor handle. */
963
+ declare const TypeId: unique symbol;
964
+ /** The running supervisor brand. */
965
+ type TypeId = typeof TypeId;
966
+ /** One kernel step as observed: the decoded event and the decision it produced. */
967
+ interface TraceEntry {
968
+ readonly event: SupervisionEvent;
969
+ readonly decision: typeof SupervisionDecision.Encoded;
227
970
  }
228
- export type Child<E, R> = Worker<E, R> | Supervisor<E, R>;
229
- export interface SupervisionPolicy {
230
- readonly intensity: Intensity;
231
- readonly backoff: Schedule.Schedule<Duration.Duration>;
232
- readonly cooldown: Duration.Input;
971
+ /** A dynamic start the supervisor accepted, naming the child it allocated. */
972
+ interface DynamicStartAccepted {
973
+ readonly outcome: 'accepted';
974
+ readonly childId: ChildId;
975
+ readonly generation: Generation;
233
976
  }
234
- export interface SupervisionConfig {
235
- readonly backoffBase: Duration.Input;
236
- readonly intensity: Intensity;
237
- readonly cooldown: Duration.Input;
977
+ /** A dynamic start the supervisor refused (ceiling reached, or not running). */
978
+ interface DynamicStartRefused {
979
+ readonly outcome: 'refused';
238
980
  }
239
- export interface SupervisorOpts<E, R, L extends LockConfig> {
240
- readonly name: string;
241
- readonly children: readonly Child<E, R>[];
242
- readonly supervision: Effect.Effect<SupervisionPolicy>;
243
- readonly lock: L;
244
- readonly reporter?: ReporterPolicyHooks;
981
+ /** The answer to a dynamic start. */
982
+ type DynamicStartOutcome = DynamicStartAccepted | DynamicStartRefused;
983
+ /** A dynamic stop that removed the child. */
984
+ interface DynamicStopDone {
985
+ readonly outcome: 'stopped';
245
986
  }
246
- //#endregion
247
- //#region src/RunDynamic.d.ts
248
- declare const dynamic$1: <E, R, Args>(spec: DynamicSpec<E, R, Args>) => Effect.Effect<DynamicHandle<Args, R | LeaderLock | DaemonReporter | Scope.Scope>, never, R | LeaderLock | DaemonReporter | Scope.Scope>;
249
- //#endregion
250
- //#region src/RunSupervisor.d.ts
987
+ /** A dynamic stop that named no current incarnation. */
988
+ interface DynamicStopMissed {
989
+ readonly outcome: 'missed';
990
+ }
991
+ /** The answer to a dynamic stop. */
992
+ type DynamicStopOutcome = DynamicStopDone | DynamicStopMissed;
993
+ /** Any dynamic answer, as the reply table stores it. */
994
+ type DynamicOutcome = DynamicStartOutcome | DynamicStopOutcome;
995
+ interface SupervisorSlot {
996
+ readonly state: Ref.Ref<SupervisorState>;
997
+ readonly mailbox: Queue.Queue<SupervisionEvent>;
998
+ readonly trace: PubSub.PubSub<TraceEntry>;
999
+ readonly evidence: Ref.Ref<HashMap.HashMap<string, Started>>;
1000
+ readonly replies: Ref.Ref<HashMap.HashMap<string, Deferred.Deferred<DynamicOutcome>>>;
1001
+ readonly boundChildren: Ref.Ref<HashMap.HashMap<ChildId, BoundChild>>;
1002
+ readonly pending: Ref.Ref<HashMap.HashMap<string, BoundChild>>;
1003
+ readonly requests: Ref.Ref<number>;
1004
+ readonly terminated: Deferred.Deferred<void, SupervisorTerminated>;
1005
+ readonly scope: Scope.Scope;
1006
+ readonly context: Context.Context<Scope.Scope>;
1007
+ readonly fiber: Medium<FiberProgram, never, Scope.Scope>;
1008
+ }
1009
+ declare const RunningSupervisorDef: Handle.Definition<typeof TypeId, {
1010
+ readonly name: string;
1011
+ }, SupervisorSlot, never>;
251
1012
  /**
252
- * The supervisor: acquires the `DaemonReporter` and — unless the lock mode is none —
253
- * the `LeaderLock` capabilities at the composition root, then hands them down to the
254
- * supervisor body via the lock binding. The body itself only ever sees the service
255
- * values.
1013
+ * A running supervisor. Its state lives in the handle's slot, never in a module
1014
+ * registry; the only public operations are the functions exported beside it.
256
1015
  */
257
- export declare const supervisor: <E, R>(s: Supervisor<E, R, LockConfig>) => Effect.Effect<SupervisorHealth, never, R | DaemonReporter | LeaderLock | Scope.Scope>;
258
- //#endregion
259
- //#region src/RunWorker.d.ts
1016
+ type RunningSupervisor = Handle.Of<typeof RunningSupervisorDef>;
1017
+ /** Whether a value is a running supervisor handle. */
1018
+ declare const isRunningSupervisor: (u: unknown) => u is Handle.Handle<typeof TypeId, {
1019
+ readonly name: string;
1020
+ }, SupervisorSlot, never>;
1021
+ /**
1022
+ * The kernel trace: every step's decoded event and decision, in mailbox order,
1023
+ * from the moment the stream is subscribed.
1024
+ */
1025
+ declare const traceOf: (self: RunningSupervisor) => Stream.Stream<TraceEntry>;
1026
+ /** The supervisor's current phase and children, as the kernel last folded them. */
1027
+ declare const statusOf: (self: RunningSupervisor) => Effect.Effect<SupervisorState>;
1028
+ /** Completes once the supervisor has terminated; fails when it gave up. */
1029
+ declare const awaitTerminated: (self: RunningSupervisor) => Effect.Effect<void, SupervisorTerminated>;
1030
+ /**
1031
+ * Asks the supervisor to shut down and waits until it has terminated: children stop
1032
+ * in reverse start order through their media before this completes.
1033
+ */
1034
+ declare const shutdown: (self: RunningSupervisor) => Effect.Effect<void, SupervisorTerminated>;
1035
+ /**
1036
+ * Starts a dynamic child running `program`. The supervisor allocates its id and
1037
+ * answers `accepted` with that id, or `refused` at the declared ceiling.
1038
+ */
1039
+ declare const startChild: {
1040
+ (program: FiberProgram): (self: RunningSupervisor) => Effect.Effect<DynamicOutcome, SupervisorTerminated>;
1041
+ (self: RunningSupervisor, program: FiberProgram): Effect.Effect<DynamicOutcome, SupervisorTerminated>;
1042
+ };
260
1043
  /**
261
- * Boots a worker. The leader-lock capability is acquired here, at the composition
262
- * root, and handed down as part of the lock binding: the executor behind this
263
- * entry point never sees the tag. A worker whose lock is `{ mode: 'none' }`
264
- * takes no lock at all.
1044
+ * Stops the dynamic child's named incarnation and removes it. Answers `stopped`, or
1045
+ * `missed` when that incarnation is no longer current.
265
1046
  */
266
- export declare const worker: {
267
- <E, R>(w: Worker<E, R, {
268
- mode: 'none';
269
- }>): Effect.Effect<DaemonHealth, never, R | Scope.Scope>;
270
- <E, R>(w: Worker<E, R, LockConfig>): Effect.Effect<DaemonHealth, never, R | LeaderLock | Scope.Scope>;
1047
+ declare const stopChild: {
1048
+ (childId: ChildId, generation: Generation): (self: RunningSupervisor) => Effect.Effect<DynamicOutcome, SupervisorTerminated>;
1049
+ (self: RunningSupervisor, childId: ChildId, generation: Generation): Effect.Effect<DynamicOutcome, SupervisorTerminated>;
271
1050
  };
272
1051
  //#endregion
273
- //#region src/WithLeaderLock.d.ts
274
- interface LeaderLockOptions {
275
- readonly key: string;
276
- readonly mode: 'required' | 'optional';
277
- readonly acquireRetryBackoff?: Schedule.Schedule<Duration.Duration>;
1052
+ //#region src/Supervisor/Supervisor.d.ts
1053
+ declare const SpecTypeId: unique symbol;
1054
+ type SpecTypeId = typeof SpecTypeId;
1055
+ /** A fiber-hosted child: a bare effect, a function of `ready`, or a nested spec. */
1056
+ type FiberChild<R = never> = BareFiberProgram | ((ready: Effect.Effect<void>) => Effect.Effect<void, SupervisorTerminated, Scope.Scope | R>) | SupervisorSpec<R>;
1057
+ /** Any child program, on any medium. */
1058
+ type ChildProgram<R = never> = BareFiberProgram | FiberProgram | SupervisorSpec<R>;
1059
+ /**
1060
+ * A child declared against a medium port, or against the default fiber medium
1061
+ * (KTD9, R17, R18). Its `binding` resolves the medium from context at
1062
+ * acquisition, so the same declaration runs on any medium.
1063
+ */
1064
+ interface ChildSpec<R = never> extends Pipeable {
1065
+ readonly childId: ChildId;
1066
+ readonly declaration: ChildDeclaration;
1067
+ readonly binding: Effect.Effect<BoundChild, never, Scope.Scope | R>;
1068
+ }
1069
+ interface Binding<R> {
1070
+ readonly declaration: ChildDeclaration;
1071
+ readonly binding: Effect.Effect<BoundChild, never, Scope.Scope | R>;
1072
+ }
1073
+ interface SpecParts<R> {
1074
+ readonly name: string;
1075
+ readonly strategy: RestartStrategy;
1076
+ readonly intensity: number;
1077
+ readonly periodMillis: number;
1078
+ readonly autoShutdown: AutoShutdown;
1079
+ readonly coolDownMillis: number | undefined;
1080
+ readonly backoff: BackoffSchedule;
1081
+ readonly livenessTickMillis: number;
1082
+ readonly declarations: ReadonlyArray<ChildDeclaration>;
1083
+ readonly bindings: ReadonlyArray<Binding<R>>;
1084
+ readonly dynamic: DynamicKind;
278
1085
  }
279
1086
  /**
280
- * Runs `self` while holding the named leader lock.
1087
+ * A supervision tree (KTD11). `R` is the environment its children need beyond
1088
+ * the supervisor's own scope: the ports they are bound to and the media they
1089
+ * run on (R17, R18).
281
1090
  */
282
- export declare const withLeaderLock: {
283
- <A, E, R>(options: LeaderLockOptions, lock: LeaderLock['Service']): (self: Effect.Effect<A, E, R>) => Effect.Effect<A | void, E | LeaderLockAcquireError, R>;
284
- <A, E, R>(self: Effect.Effect<A, E, R>, options: LeaderLockOptions, lock: LeaderLock['Service']): Effect.Effect<A | void, E | LeaderLockAcquireError, R>;
1091
+ interface SupervisorSpec<R = never> extends Pipeable, SpecParts<R> {
1092
+ readonly [SpecTypeId]: typeof SpecTypeId;
1093
+ readonly scoped: Effect.Effect<RunningSupervisor, never, Scope.Scope | R>;
1094
+ readonly layer: Layer.Layer<never, never, Exclude<R, Scope.Scope>>;
1095
+ }
1096
+ declare const isSupervisorSpec: (value: unknown) => value is SupervisorSpec<never>;
1097
+ declare const make: (name: string) => SupervisorSpec<never>;
1098
+ declare const strategy: {
1099
+ (strategy: RestartStrategy): <R>(self: SupervisorSpec<R>) => SupervisorSpec<R>;
1100
+ <R>(self: SupervisorSpec<R>, strategy: RestartStrategy): SupervisorSpec<R>;
285
1101
  };
286
- //#endregion
287
- //#region src/SupervisionCustom.d.ts
288
- declare const custom: <P>(policy: P) => Effect.Effect<P>;
289
- //#endregion
290
- //#region src/SupervisionLeader.d.ts
291
- export declare const LeaderConfig: Context.Reference<SupervisionConfig>;
292
- //#endregion
293
- //#region src/SupervisionTask.d.ts
294
- export declare const TaskConfig: Context.Reference<SupervisionConfig>;
295
- //#endregion
296
- //#region src/SupervisionWorker.d.ts
297
- export declare const WorkerConfig: Context.Reference<SupervisionConfig>;
298
- //#endregion
299
- //#region src/mod.d.ts
300
- export declare const poll: <A, E, R, L extends LockConfig>(opts: PollOpts<A, E, R, L>) => Worker<E, R, L>;
301
- export declare const stream: <A, E, R, L extends LockConfig>(opts: CommonOpts<L> & {
302
- readonly stream: Stream.Stream<A, E, R>;
303
- }) => Worker<E, R, L>;
304
- export declare const subscription: <A, E, R, L extends LockConfig>(opts: CommonOpts<L> & {
305
- readonly acquire: Effect.Effect<A, E, R>;
306
- }) => Worker<E, R, L>;
307
- export declare const Daemon: {
308
- readonly poll: typeof poll;
309
- readonly stream: typeof stream;
310
- readonly subscription: typeof subscription;
1102
+ declare const intensity: {
1103
+ (intensity: number, periodMillis: number): <R>(self: SupervisorSpec<R>) => SupervisorSpec<R>;
1104
+ <R>(self: SupervisorSpec<R>, intensity: number, periodMillis: number): SupervisorSpec<R>;
311
1105
  };
312
- export declare const run: {
313
- readonly worker: {
314
- <E, R>(w: Worker<E, R, {
315
- mode: 'none';
316
- }>): Effect.Effect<DaemonHealth, never, R | import("effect/Scope").Scope>;
317
- <E, R>(w: Worker<E, R, LockConfig>): Effect.Effect<DaemonHealth, never, R | LeaderLock | import("effect/Scope").Scope>;
318
- };
319
- readonly supervisor: typeof supervisor;
320
- readonly dynamic: typeof dynamic$1;
1106
+ declare const autoShutdown: {
1107
+ (autoShutdown: AutoShutdown): <R>(self: SupervisorSpec<R>) => SupervisorSpec<R>;
1108
+ <R>(self: SupervisorSpec<R>, autoShutdown: AutoShutdown): SupervisorSpec<R>;
321
1109
  };
322
- export declare const leader: (cap: Duration.Input) => Effect.Effect<SupervisionPolicy>;
323
- export declare const task: (budget: Duration.Input) => Effect.Effect<SupervisionPolicy>;
324
- export declare const supervision: (cap: Duration.Input) => Effect.Effect<SupervisionPolicy>;
325
- export declare const Supervision: {
326
- readonly leader: typeof leader;
327
- readonly worker: typeof supervision;
328
- readonly task: typeof task;
329
- readonly custom: typeof custom;
1110
+ declare const coolDown: {
1111
+ (millis: number): <R>(self: SupervisorSpec<R>) => SupervisorSpec<R>;
1112
+ <R>(self: SupervisorSpec<R>, millis: number): SupervisorSpec<R>;
330
1113
  };
331
- export declare const dynamic: <E, R, Args>(opts: {
332
- readonly name: string;
333
- readonly child: (args: Args) => Worker<E, R>;
334
- readonly maxChildren?: MaxChildren;
335
- }) => DynamicSpec<E, R, Args>;
336
- export declare const oneForAll: <E, R, L extends LockConfig = LockConfig>(opts: SupervisorOpts<E, R, L>) => Supervisor<E, R, L>;
337
- export declare const oneForOne: <E, R, L extends LockConfig = LockConfig>(opts: SupervisorOpts<E, R, L>) => Supervisor<E, R, L>;
338
- export declare const restForOne: <E, R, L extends LockConfig = LockConfig>(opts: SupervisorOpts<E, R, L>) => Supervisor<E, R, L>;
1114
+ declare const backoff: {
1115
+ (schedule: BackoffSchedule): <R>(self: SupervisorSpec<R>) => SupervisorSpec<R>;
1116
+ <R>(self: SupervisorSpec<R>, schedule: BackoffSchedule): SupervisorSpec<R>;
1117
+ };
1118
+ declare const livenessTick: {
1119
+ (millis: number): <R>(self: SupervisorSpec<R>) => SupervisorSpec<R>;
1120
+ <R>(self: SupervisorSpec<R>, millis: number): SupervisorSpec<R>;
1121
+ };
1122
+ interface DynamicOptions extends Omit<ChildOptions, 'significant'> {
1123
+ readonly ceiling: number;
1124
+ }
1125
+ declare const dynamic: {
1126
+ (options: DynamicOptions): <R>(self: SupervisorSpec<R>) => SupervisorSpec<R>;
1127
+ <R>(self: SupervisorSpec<R>, options: DynamicOptions): SupervisorSpec<R>;
1128
+ };
1129
+ interface ChildOptions {
1130
+ readonly restartType?: ChildDeclaration['restartType'];
1131
+ readonly shutdown?: ChildDeclaration['shutdown'];
1132
+ readonly significant?: boolean;
1133
+ readonly startTimeoutMillis?: number;
1134
+ }
1135
+ declare const childSpecMake: <R = never>(childId: ChildId, program: FiberChild<R>, options?: ChildOptions) => ChildSpec<R>;
1136
+ declare const childSpecOn: <Program, StartError, R = never>(port: Context.Service<MediumPortShape<Program, StartError, Scope.Scope | R>, MediumPortShape<Program, StartError, Scope.Scope | R>>) => (childId: ChildId, program: Program, options?: ChildOptions) => ChildSpec<MediumPortShape<Program, StartError, Scope.Scope | R> | R>;
1137
+ /**
1138
+ * The two ways to declare a child: `make`, which binds to the fiber medium (and
1139
+ * to the `FiberMedium` port when one is provided), and `on`, which binds to a
1140
+ * named medium port (KTD9).
1141
+ */
1142
+ declare const ChildSpecs: {
1143
+ readonly make: typeof childSpecMake;
1144
+ readonly on: typeof childSpecOn;
1145
+ };
1146
+ declare const children: {
1147
+ <R>(specs: ReadonlyArray<ChildSpec<R>>): <R2>(self: SupervisorSpec<R2>) => SupervisorSpec<R | R2>;
1148
+ <R2, R>(self: SupervisorSpec<R2>, specs: ReadonlyArray<ChildSpec<R>>): SupervisorSpec<R | R2>;
1149
+ };
1150
+ declare const child: {
1151
+ <R>(childId: ChildId, program: FiberChild<R>, options?: ChildOptions): <R2>(self: SupervisorSpec<R2>) => SupervisorSpec<R | R2>;
1152
+ <R2, R>(self: SupervisorSpec<R2>, childId: ChildId, program: FiberChild<R>, options?: ChildOptions): SupervisorSpec<R | R2>;
1153
+ };
1154
+ declare namespace mod_d_exports {
1155
+ export { BareFiberProgram, ChildOptions, ChildProgram, ChildSpec, ChildSpecs, 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, coolDown, dynamic, intensity, isRunningSupervisor, isSupervisorSpec, livenessTick, make, readyOnStart, shutdown, startChild, statusOf, stopChild, strategy, traceOf };
1156
+ }
339
1157
  //#endregion
340
- export type { LeaderLockOptions };
1158
+ export { mod_d_exports as Supervisor };