effect-machine 0.13.0 → 0.15.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.
Files changed (49) hide show
  1. package/README.md +19 -11
  2. package/dist/actor.d.ts +18 -6
  3. package/dist/actor.js +151 -61
  4. package/dist/cluster/entity-machine.d.ts +1 -1
  5. package/dist/cluster/entity-machine.js +2 -1
  6. package/dist/cluster/to-entity.d.ts +1 -1
  7. package/dist/errors.d.ts +9 -2
  8. package/dist/errors.js +8 -2
  9. package/dist/index.d.ts +4 -4
  10. package/dist/index.js +4 -4
  11. package/dist/internal/runtime.d.ts +21 -2
  12. package/dist/internal/runtime.js +64 -56
  13. package/dist/internal/transition.d.ts +9 -9
  14. package/dist/internal/transition.js +3 -5
  15. package/dist/machine.d.ts +129 -135
  16. package/dist/machine.js +97 -112
  17. package/dist/schema.d.ts +17 -1
  18. package/dist/schema.js +10 -0
  19. package/dist/slot.d.ts +112 -86
  20. package/dist/slot.js +92 -59
  21. package/dist/testing.d.ts +16 -16
  22. package/dist/testing.js +3 -3
  23. package/package.json +3 -3
  24. package/v3/dist/actor.d.ts +25 -12
  25. package/v3/dist/actor.js +174 -89
  26. package/v3/dist/cluster/entity-machine.d.ts +1 -1
  27. package/v3/dist/cluster/entity-machine.js +1 -0
  28. package/v3/dist/cluster/to-entity.d.ts +1 -1
  29. package/v3/dist/errors.d.ts +12 -3
  30. package/v3/dist/errors.js +10 -4
  31. package/v3/dist/index.d.ts +6 -6
  32. package/v3/dist/index.js +2 -2
  33. package/v3/dist/inspection.d.ts +3 -22
  34. package/v3/dist/inspection.js +1 -15
  35. package/v3/dist/internal/brands.d.ts +4 -8
  36. package/v3/dist/internal/inspection.js +1 -1
  37. package/v3/dist/internal/runtime.d.ts +27 -8
  38. package/v3/dist/internal/runtime.js +91 -61
  39. package/v3/dist/internal/transition.d.ts +10 -10
  40. package/v3/dist/internal/transition.js +8 -10
  41. package/v3/dist/internal/utils.js +5 -1
  42. package/v3/dist/machine.d.ts +160 -120
  43. package/v3/dist/machine.js +118 -115
  44. package/v3/dist/schema.d.ts +25 -11
  45. package/v3/dist/schema.js +18 -5
  46. package/v3/dist/slot.d.ts +112 -86
  47. package/v3/dist/slot.js +92 -59
  48. package/v3/dist/testing.d.ts +16 -16
  49. package/v3/dist/testing.js +7 -7
package/dist/slot.js CHANGED
@@ -1,31 +1,29 @@
1
- import { ServiceMap } from "effect";
1
+ import { Schema, ServiceMap } from "effect";
2
2
  //#region src/slot.ts
3
3
  /**
4
- * Slot module - schema-based, parameterized guards and effects.
4
+ * Slot module unified, schema-based parameterized slots.
5
5
  *
6
- * Guards and Effects are defined with schemas for their parameters,
7
- * and provided implementations receive typed parameters plus machine context.
6
+ * Replaces the split Guards/Effects API with a single `Slot.define` + `Slot.fn`.
7
+ * Each slot declares its parameter schema and (optional) return schema.
8
+ * Handlers receive only params — machine context is accessed via `yield* machine.Context`.
8
9
  *
9
10
  * @example
10
11
  * ```ts
11
12
  * import { Slot } from "effect-machine"
12
13
  * import { Schema } from "effect"
13
14
  *
14
- * const MyGuards = Slot.Guards({
15
- * canRetry: { max: Schema.Number },
16
- * isValid: {}, // no params
17
- * })
18
- *
19
- * const MyEffects = Slot.Effects({
20
- * fetchData: { url: Schema.String },
21
- * notify: { message: Schema.String },
15
+ * const MySlots = Slot.define({
16
+ * canRetry: Slot.fn({ max: Schema.Number }, Schema.Boolean),
17
+ * isValid: Slot.fn({}, Schema.Boolean),
18
+ * fetchData: Slot.fn({ url: Schema.String }),
19
+ * notify: Slot.fn({ message: Schema.String }),
22
20
  * })
23
21
  *
24
22
  * // Used in handlers:
25
- * .on(State.X, Event.Y, ({ guards, effects }) =>
23
+ * .on(State.X, Event.Y, ({ slots }) =>
26
24
  * Effect.gen(function* () {
27
- * if (yield* guards.canRetry({ max: 3 })) {
28
- * yield* effects.fetchData({ url: "/api" })
25
+ * if (yield* slots.canRetry({ max: 3 })) {
26
+ * yield* slots.fetchData({ url: "/api" })
29
27
  * return State.Next
30
28
  * }
31
29
  * return state
@@ -36,62 +34,97 @@ import { ServiceMap } from "effect";
36
34
  * @module
37
35
  */
38
36
  /**
39
- * Shared Context tag for all machines.
40
- * Single module-level tag instead of per-machine allocation.
41
- * @internal
42
- */
43
- const MachineContextTag = ServiceMap.Service("@effect-machine/Context");
44
- /**
45
- * Generic slot schema factory. Used internally by Guards() and Effects().
46
- * @internal
47
- */
48
- const createSlotSchema = (tag, slotTag, definitions) => ({
49
- _tag: tag,
50
- definitions,
51
- _createSlots: (resolve) => {
52
- const slots = {};
53
- for (const name of Object.keys(definitions)) {
54
- const slot = (params) => resolve(name, params);
55
- Object.defineProperty(slot, "_tag", {
56
- value: slotTag,
57
- enumerable: true
58
- });
59
- Object.defineProperty(slot, "name", {
60
- value: name,
61
- enumerable: true
62
- });
63
- slots[name] = slot;
64
- }
65
- return slots;
66
- }
67
- });
68
- /**
69
- * Create a guards schema with parameterized guard definitions.
37
+ * Define a single slot function with parameter schema and optional return schema.
70
38
  *
71
39
  * @example
72
40
  * ```ts
73
- * const MyGuards = Slot.Guards({
74
- * canRetry: { max: Schema.Number },
75
- * isValid: {},
76
- * })
41
+ * // Guard-like: returns boolean
42
+ * Slot.fn({ max: Schema.Number }, Schema.Boolean)
43
+ *
44
+ * // Effect-like: returns void (default)
45
+ * Slot.fn({ url: Schema.String })
46
+ *
47
+ * // No params, returns boolean
48
+ * Slot.fn({}, Schema.Boolean)
77
49
  * ```
78
50
  */
79
- const Guards = (definitions) => createSlotSchema("GuardsSchema", "GuardSlot", definitions);
51
+ const fn = (fields, returnSchema) => {
52
+ return {
53
+ _tag: "SlotFnDef",
54
+ fields,
55
+ returnSchema,
56
+ inputSchema: Object.keys(fields).length > 0 ? Schema.Struct(fields) : Schema.Void,
57
+ outputSchema: returnSchema ?? Schema.Void
58
+ };
59
+ };
80
60
  /**
81
- * Create an effects schema with parameterized effect definitions.
61
+ * Shared Context tag for all machines.
62
+ * Single module-level tag instead of per-machine allocation.
63
+ * @internal
64
+ */
65
+ const MachineContextTag = ServiceMap.Service("@effect-machine/Context");
66
+ /**
67
+ * Define a set of slots with parameter and return schemas.
82
68
  *
83
69
  * @example
84
70
  * ```ts
85
- * const MyEffects = Slot.Effects({
86
- * fetchData: { url: Schema.String },
87
- * notify: { message: Schema.String },
71
+ * const MySlots = Slot.define({
72
+ * canRetry: Slot.fn({ max: Schema.Number }, Schema.Boolean),
73
+ * fetchData: Slot.fn({ url: Schema.String }),
74
+ * notify: Slot.fn({ message: Schema.String }),
88
75
  * })
89
76
  * ```
90
77
  */
91
- const Effects = (definitions) => createSlotSchema("EffectsSchema", "EffectSlot", definitions);
78
+ const define = (definitions) => {
79
+ const names = Object.keys(definitions);
80
+ const requestSchemas = [];
81
+ const resultSchemas = [];
82
+ const invocationSchemas = [];
83
+ for (const name of names) {
84
+ const def = definitions[name];
85
+ if (def === void 0) continue;
86
+ requestSchemas.push(Schema.TaggedStruct("SlotRequest", {
87
+ name: Schema.Literal(name),
88
+ params: def.inputSchema
89
+ }));
90
+ resultSchemas.push(Schema.TaggedStruct("SlotResult", {
91
+ name: Schema.Literal(name),
92
+ result: def.outputSchema
93
+ }));
94
+ invocationSchemas.push(Schema.TaggedStruct("SlotInvocation", {
95
+ name: Schema.Literal(name),
96
+ params: def.inputSchema,
97
+ result: def.outputSchema
98
+ }));
99
+ }
100
+ const buildUnion = (schemas) => schemas.length === 0 ? Schema.Never : Schema.Union(schemas);
101
+ return {
102
+ _tag: "SlotsSchema",
103
+ definitions,
104
+ requestSchema: buildUnion(requestSchemas),
105
+ resultSchema: buildUnion(resultSchemas),
106
+ invocationSchema: buildUnion(invocationSchemas),
107
+ _createSlots: (resolve) => {
108
+ const slots = {};
109
+ for (const name of names) {
110
+ const slot = (params) => resolve(name, params);
111
+ Object.defineProperty(slot, "_tag", {
112
+ value: "Slot",
113
+ enumerable: true
114
+ });
115
+ Object.defineProperty(slot, "name", {
116
+ value: name,
117
+ enumerable: true
118
+ });
119
+ slots[name] = slot;
120
+ }
121
+ return slots;
122
+ }
123
+ };
124
+ };
92
125
  const Slot = {
93
- Guards,
94
- Effects
126
+ fn,
127
+ define
95
128
  };
96
129
  //#endregion
97
- export { Effects, Guards, MachineContextTag, Slot };
130
+ export { MachineContextTag, Slot, define, fn };
package/dist/testing.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { AssertionError } from "./errors.js";
2
- import { EffectsDef, GuardsDef, MachineContext } from "./slot.js";
2
+ import { MachineContext, ProvideSlots, SlotsDef } from "./slot.js";
3
3
  import { Machine, MachineRef } from "./machine.js";
4
4
  import { Effect, SubscriptionRef } from "effect";
5
5
 
6
6
  //#region src/testing.d.ts
7
- type MachineInput<S, E, R, GD extends GuardsDef, EFD extends EffectsDef> = Machine<S, E, R, any, any, GD, EFD>;
7
+ type MachineInput<S, E, R, SD extends SlotsDef = Record<string, never>> = Machine<S, E, R, any, any, SD>;
8
8
  /**
9
9
  * Result of simulating events through a machine
10
10
  */
@@ -15,7 +15,7 @@ interface SimulationResult<S> {
15
15
  /**
16
16
  * Simulate a sequence of events through a machine without running an actor.
17
17
  * Useful for testing state transitions in isolation.
18
- * Does not run onEnter/spawn/background effects, but does run guard/effect slots
18
+ * Does not run onEnter/spawn/background effects, but does run slots
19
19
  * within transition handlers.
20
20
  *
21
21
  * @example
@@ -36,8 +36,8 @@ declare const simulate: <S extends {
36
36
  readonly _tag: string;
37
37
  }, E extends {
38
38
  readonly _tag: string;
39
- }, R, GD extends GuardsDef = Record<string, never>, EFD extends EffectsDef = Record<string, never>>(input: MachineInput<S, E, R, GD, EFD>, events: readonly E[], options?: {
40
- slots?: Record<string, any>;
39
+ }, R, SD extends SlotsDef = Record<string, never>>(input: MachineInput<S, E, R, SD>, events: readonly E[], options?: {
40
+ slots?: ProvideSlots<SD, any>;
41
41
  } | undefined) => Effect.Effect<{
42
42
  states: S[];
43
43
  finalState: S;
@@ -49,8 +49,8 @@ declare const assertReaches: <S extends {
49
49
  readonly _tag: string;
50
50
  }, E extends {
51
51
  readonly _tag: string;
52
- }, R, GD extends GuardsDef = Record<string, never>, EFD extends EffectsDef = Record<string, never>>(input: MachineInput<S, E, R, GD, EFD>, events: readonly E[], expectedTag: string, options?: {
53
- slots?: Record<string, any>;
52
+ }, R, SD extends SlotsDef = Record<string, never>>(input: MachineInput<S, E, R, SD>, events: readonly E[], expectedTag: string, options?: {
53
+ slots?: ProvideSlots<SD, any>;
54
54
  } | undefined) => Effect.Effect<S, AssertionError, Exclude<R, MachineContext<S, E, MachineRef<E>>>>;
55
55
  /**
56
56
  * Assert that a machine follows a specific path of state tags
@@ -68,8 +68,8 @@ declare const assertPath: <S extends {
68
68
  readonly _tag: string;
69
69
  }, E extends {
70
70
  readonly _tag: string;
71
- }, R, GD extends GuardsDef = Record<string, never>, EFD extends EffectsDef = Record<string, never>>(input: MachineInput<S, E, R, GD, EFD>, events: readonly E[], expectedPath: readonly string[], options?: {
72
- slots?: Record<string, any>;
71
+ }, R, SD extends SlotsDef = Record<string, never>>(input: MachineInput<S, E, R, SD>, events: readonly E[], expectedPath: readonly string[], options?: {
72
+ slots?: ProvideSlots<SD, any>;
73
73
  } | undefined) => Effect.Effect<{
74
74
  states: S[];
75
75
  finalState: S;
@@ -91,8 +91,8 @@ declare const assertNeverReaches: <S extends {
91
91
  readonly _tag: string;
92
92
  }, E extends {
93
93
  readonly _tag: string;
94
- }, R, GD extends GuardsDef = Record<string, never>, EFD extends EffectsDef = Record<string, never>>(input: MachineInput<S, E, R, GD, EFD>, events: readonly E[], forbiddenTag: string, options?: {
95
- slots?: Record<string, any>;
94
+ }, R, SD extends SlotsDef = Record<string, never>>(input: MachineInput<S, E, R, SD>, events: readonly E[], forbiddenTag: string, options?: {
95
+ slots?: ProvideSlots<SD, any>;
96
96
  } | undefined) => Effect.Effect<{
97
97
  states: S[];
98
98
  finalState: S;
@@ -108,18 +108,18 @@ interface TestHarness<S, E, R> {
108
108
  /**
109
109
  * Options for creating a test harness
110
110
  */
111
- interface TestHarnessOptions<S, E> {
111
+ interface TestHarnessOptions<S, E, SD extends SlotsDef = Record<string, never>> {
112
112
  /**
113
113
  * Called after each transition with the previous state, event, and new state.
114
114
  * Useful for logging or spying on transitions.
115
115
  */
116
116
  readonly onTransition?: (from: S, event: E, to: S) => void;
117
- /** Slot handler implementations for machines with guards/effects. */
118
- readonly slots?: Record<string, any>;
117
+ /** Slot handler implementations. */
118
+ readonly slots?: ProvideSlots<SD, any>;
119
119
  }
120
120
  /**
121
121
  * Create a test harness for step-by-step testing.
122
- * Does not run onEnter/spawn/background effects, but does run guard/effect slots
122
+ * Does not run onEnter/spawn/background effects, but does run slots
123
123
  * within transition handlers.
124
124
  *
125
125
  * @example Basic usage
@@ -142,7 +142,7 @@ declare const createTestHarness: <S extends {
142
142
  readonly _tag: string;
143
143
  }, E extends {
144
144
  readonly _tag: string;
145
- }, R, GD extends GuardsDef = Record<string, never>, EFD extends EffectsDef = Record<string, never>>(input: MachineInput<S, E, R, GD, EFD>, options?: TestHarnessOptions<S, E> | undefined) => Effect.Effect<{
145
+ }, R, SD extends SlotsDef = Record<string, never>>(input: MachineInput<S, E, R, SD>, options?: TestHarnessOptions<S, E, SD> | undefined) => Effect.Effect<{
146
146
  state: SubscriptionRef.SubscriptionRef<S>;
147
147
  send: (event: E) => Effect.Effect<S, never, Exclude<R, MachineContext<S, E, MachineRef<E>>>>;
148
148
  getState: Effect.Effect<S, never, never>;
package/dist/testing.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { stubSystem } from "./internal/utils.js";
2
- import { executeTransition, shouldPostpone } from "./internal/transition.js";
3
2
  import { AssertionError } from "./errors.js";
3
+ import { executeTransition, shouldPostpone } from "./internal/transition.js";
4
4
  import { materializeMachine } from "./machine.js";
5
5
  import { Effect, SubscriptionRef } from "effect";
6
6
  //#region src/testing.ts
@@ -16,7 +16,7 @@ const makeDummySelf = (label) => {
16
16
  /**
17
17
  * Simulate a sequence of events through a machine without running an actor.
18
18
  * Useful for testing state transitions in isolation.
19
- * Does not run onEnter/spawn/background effects, but does run guard/effect slots
19
+ * Does not run onEnter/spawn/background effects, but does run slots
20
20
  * within transition handlers.
21
21
  *
22
22
  * @example
@@ -122,7 +122,7 @@ const assertNeverReaches = Effect.fn("effect-machine.assertNeverReaches")(functi
122
122
  });
123
123
  /**
124
124
  * Create a test harness for step-by-step testing.
125
- * Does not run onEnter/spawn/background effects, but does run guard/effect slots
125
+ * Does not run onEnter/spawn/background effects, but does run slots
126
126
  * within transition handlers.
127
127
  *
128
128
  * @example Basic usage
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "effect-machine",
3
- "version": "0.13.0",
3
+ "version": "0.15.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/cevr/effect-machine.git"
@@ -56,7 +56,7 @@
56
56
  "release": "bun run build && changeset publish"
57
57
  },
58
58
  "dependencies": {
59
- "effect": "4.0.0-beta.42"
59
+ "effect": "4.0.0-beta.43"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@changesets/changelog-github": "^0.6.0",
@@ -81,6 +81,6 @@
81
81
  }
82
82
  },
83
83
  "overrides": {
84
- "effect": "4.0.0-beta.42"
84
+ "effect": "4.0.0-beta.43"
85
85
  }
86
86
  }
@@ -1,9 +1,9 @@
1
- import { ActorExit, Supervision } from "./supervision.js";
2
1
  import { ExtractReply, ReplyTypeBrand } from "./internal/brands.js";
3
2
  import { ActorStoppedError, DuplicateActorError, NoReplyError } from "./errors.js";
4
- import { EffectsDef, GuardsDef } from "./slot.js";
3
+ import { ProvideSlots, SlotsDef } from "./slot.js";
4
+ import { ActorExit, Supervision } from "./supervision.js";
5
5
  import { ProcessEventError, ProcessEventHooks, ProcessEventResult, processEventCore, resolveTransition, runSpawnEffects } from "./internal/transition.js";
6
- import { Machine } from "./machine.js";
6
+ import { Lifecycle, Machine } from "./machine.js";
7
7
  import { RuntimeQueuedEvent } from "./internal/runtime.js";
8
8
  import { Context, Deferred, Effect, Layer, Option, PubSub, Queue, Ref, Scope, Stream, SubscriptionRef } from "effect";
9
9
 
@@ -54,6 +54,12 @@ interface ActorRef<State extends {
54
54
  readonly state: SubscriptionRef.SubscriptionRef<State>;
55
55
  /** Stop the actor gracefully. */
56
56
  readonly stop: Effect.Effect<void>;
57
+ /**
58
+ * Start the actor — fork event loop, background effects, spawn effects.
59
+ * Called automatically by `system.spawn`. For `Machine.spawn`, the caller
60
+ * must call `start` explicitly. Events sent before start() are queued.
61
+ */
62
+ readonly start: Effect.Effect<void>;
57
63
  /** Get current state snapshot. */
58
64
  readonly snapshot: Effect.Effect<State>;
59
65
  /** Check if current state matches tag. */
@@ -96,7 +102,7 @@ interface ActorRef<State extends {
96
102
  readonly awaitExit: Effect.Effect<ActorExit<State>>;
97
103
  /**
98
104
  * Watch another actor. Returns an Effect that resolves with the exit reason
99
- * when the watched actor terminally stops. Ignores restarts.
105
+ * when the watched actor terminally stops. Ignores restarts (Step 3).
100
106
  * Built on the other actor's exitDeferred — authoritative, not system events.
101
107
  */
102
108
  readonly watch: (other: {
@@ -148,14 +154,20 @@ type SystemEventListener = (event: SystemEvent) => void;
148
154
  interface ActorSystem {
149
155
  /**
150
156
  * Spawn a new actor with the given machine.
157
+ *
158
+ * @example
159
+ * ```ts
160
+ * const actor = yield* system.spawn("my-actor", machine);
161
+ * ```
151
162
  */
152
163
  readonly spawn: <S extends {
153
164
  readonly _tag: string;
154
165
  }, E extends {
155
166
  readonly _tag: string;
156
- }, R>(id: string, machine: Machine<S, E, R, any, any, any, any>, options?: {
157
- slots?: Record<string, any>;
158
- supervision?: Supervision.Policy;
167
+ }, R, SD extends SlotsDef = Record<string, never>>(id: string, machine: Machine<S, E, R, any, any, SD>, options?: {
168
+ readonly supervision?: Supervision.Policy;
169
+ readonly slots?: ProvideSlots<SD, any>;
170
+ readonly lifecycle?: Lifecycle<S, E>;
159
171
  }) => Effect.Effect<ActorRef<S, E>, DuplicateActorError, R>;
160
172
  /**
161
173
  * Get an existing actor by ID
@@ -198,18 +210,19 @@ declare const buildActorRefCore: <S extends {
198
210
  readonly _tag: string;
199
211
  }, E extends {
200
212
  readonly _tag: string;
201
- }, R, GD extends GuardsDef, EFD extends EffectsDef>(id: string, machine: Machine<S, E, R, any, any, GD, EFD>, stateRef: SubscriptionRef.SubscriptionRef<S>, eventQueueRef: Ref.Ref<Queue.Queue<QueuedEvent<E>>>, stoppedRef: Ref.Ref<boolean>, listeners: Listeners<S>, stop: Effect.Effect<void>, system: ActorSystem, childrenMap: ReadonlyMap<string, ActorRef<AnyState, unknown>>, pendingReplies: Set<Deferred.Deferred<unknown, unknown>>, transitionsPubSub: PubSub.PubSub<TransitionInfo<S, E>> | undefined, exitDeferred: Deferred.Deferred<ActorExit<S>, never>) => ActorRef<S, E>;
213
+ }, R, SD extends SlotsDef>(id: string, machine: Machine<S, E, R, any, any, SD>, stateRef: SubscriptionRef.SubscriptionRef<S>, eventQueueRef: Ref.Ref<Queue.Queue<QueuedEvent<E>>>, stoppedRef: Ref.Ref<boolean>, listeners: Listeners<S>, stop: Effect.Effect<void>, start: Effect.Effect<void>, system: ActorSystem, childrenMap: ReadonlyMap<string, ActorRef<AnyState, unknown>>, pendingReplies: Set<Deferred.Deferred<unknown, unknown>>, transitionsPubSub: PubSub.PubSub<TransitionInfo<S, E>> | undefined, exitDeferred: Deferred.Deferred<ActorExit<S>, never>) => ActorRef<S, E>;
202
214
  /**
203
215
  * Create and start an actor for a machine.
204
- * Uses the shared runtime kernel with lifecycle hooks for actor-specific concerns.
216
+ * Delegates to the shared runtime kernel with actor-specific lifecycle hooks.
205
217
  */
206
218
  declare const createActor: <S extends {
207
219
  readonly _tag: string;
208
220
  }, E extends {
209
221
  readonly _tag: string;
210
- }, R, GD extends GuardsDef, EFD extends EffectsDef>(id: string, machine: Machine<S, E, R, Record<string, never>, Record<string, never>, GD, EFD>, options?: {
222
+ }, R, SD extends SlotsDef>(id: string, machine: Machine<S, E, R, any, any, SD>, options?: {
211
223
  initialState?: S;
212
- supervision?: Supervision.Policy; /** @internal Called by system after each restart — emits ActorRestarted system event */
224
+ supervision?: Supervision.Policy;
225
+ lifecycle?: Lifecycle<S, E>; /** @internal Called by system after each restart — emits ActorRestarted system event */
213
226
  onRestart?: (generation: number, exit: ActorExit<unknown>) => Effect.Effect<void>;
214
227
  } | undefined) => Effect.Effect<ActorRef<S, E>, never, never>;
215
228
  /** Fail all pending call/ask Deferreds with ActorStoppedError. Safe to call multiple times. */
@@ -222,6 +235,6 @@ declare const makeSystem: () => Effect.Effect<ActorSystem, never, Scope.Scope>;
222
235
  /**
223
236
  * Default ActorSystem layer
224
237
  */
225
- declare const Default: Layer.Layer<ActorSystem, never, Scope.Scope>;
238
+ declare const Default: Layer.Layer<ActorSystem, never, never>;
226
239
  //#endregion
227
240
  export { ActorRef, ActorRefSync, ActorSystem, Default, Listeners, type ProcessEventError, type ProcessEventHooks, type ProcessEventResult, QueuedEvent, SystemEvent, SystemEventListener, TransitionInfo, buildActorRefCore, createActor, makeSystem, notifyListeners, processEventCore, resolveTransition, runSpawnEffects, settlePendingReplies };