@typeonce/effect-machine 0.41.0 → 0.42.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 (67) hide show
  1. package/README.md +33 -6
  2. package/dist/Machine.d.ts +159 -27
  3. package/dist/Machine.d.ts.map +1 -1
  4. package/dist/Machine.js +20 -6
  5. package/dist/Machine.js.map +1 -1
  6. package/dist/internal/machine/atom.d.ts +2 -7
  7. package/dist/internal/machine/atom.d.ts.map +1 -1
  8. package/dist/internal/machine/atom.js +132 -87
  9. package/dist/internal/machine/atom.js.map +1 -1
  10. package/dist/internal/machine/childRegistry.d.ts +7 -0
  11. package/dist/internal/machine/childRegistry.d.ts.map +1 -1
  12. package/dist/internal/machine/childRegistry.js +7 -0
  13. package/dist/internal/machine/childRegistry.js.map +1 -1
  14. package/dist/internal/machine/invocation.d.ts.map +1 -1
  15. package/dist/internal/machine/invocation.js +13 -2
  16. package/dist/internal/machine/invocation.js.map +1 -1
  17. package/dist/internal/machine/invocationDefinition.d.ts +7 -0
  18. package/dist/internal/machine/invocationDefinition.d.ts.map +1 -1
  19. package/dist/internal/machine/invocationDefinition.js +16 -0
  20. package/dist/internal/machine/invocationDefinition.js.map +1 -1
  21. package/dist/internal/machine/machine.d.ts.map +1 -1
  22. package/dist/internal/machine/machine.js +69 -6
  23. package/dist/internal/machine/machine.js.map +1 -1
  24. package/dist/internal/machine/plannedSnapshot.d.ts +30 -0
  25. package/dist/internal/machine/plannedSnapshot.d.ts.map +1 -0
  26. package/dist/internal/machine/plannedSnapshot.js +103 -0
  27. package/dist/internal/machine/plannedSnapshot.js.map +1 -0
  28. package/dist/internal/machine/planner.d.ts +5 -0
  29. package/dist/internal/machine/planner.d.ts.map +1 -1
  30. package/dist/internal/machine/planner.js +1 -1
  31. package/dist/internal/machine/planner.js.map +1 -1
  32. package/dist/internal/machine/runtime.d.ts +5 -4
  33. package/dist/internal/machine/runtime.d.ts.map +1 -1
  34. package/dist/internal/machine/runtime.js +60 -15
  35. package/dist/internal/machine/runtime.js.map +1 -1
  36. package/dist/internal/machine/runtimeCompiled.js +2 -2
  37. package/dist/internal/machine/runtimeCompiled.js.map +1 -1
  38. package/dist/internal/machine/runtimeGeneric.js +1 -1
  39. package/dist/internal/machine/runtimeGeneric.js.map +1 -1
  40. package/dist/internal/machine/runtimeProtocol.d.ts +2 -1
  41. package/dist/internal/machine/runtimeProtocol.d.ts.map +1 -1
  42. package/dist/internal/machine/runtimeProtocol.js +2 -2
  43. package/dist/internal/machine/runtimeProtocol.js.map +1 -1
  44. package/dist/testing/MachineTest.d.ts +2 -2
  45. package/dist/testing/MachineTest.js +2 -2
  46. package/dist/unstable/reactivity/AtomMachine.d.ts +82 -19
  47. package/dist/unstable/reactivity/AtomMachine.d.ts.map +1 -1
  48. package/dist/unstable/reactivity/AtomMachine.js +0 -7
  49. package/dist/unstable/reactivity/AtomMachine.js.map +1 -1
  50. package/docs/agent-guide.md +28 -5
  51. package/docs/effect-atom-react.md +207 -11
  52. package/docs/machine-review.md +18 -4
  53. package/package.json +4 -4
  54. package/src/Machine.ts +229 -32
  55. package/src/internal/machine/atom.ts +263 -113
  56. package/src/internal/machine/childRegistry.ts +9 -0
  57. package/src/internal/machine/invocation.ts +17 -2
  58. package/src/internal/machine/invocationDefinition.ts +19 -0
  59. package/src/internal/machine/machine.ts +65 -2
  60. package/src/internal/machine/plannedSnapshot.ts +113 -0
  61. package/src/internal/machine/planner.ts +1 -1
  62. package/src/internal/machine/runtime.ts +101 -28
  63. package/src/internal/machine/runtimeCompiled.ts +2 -2
  64. package/src/internal/machine/runtimeGeneric.ts +1 -1
  65. package/src/internal/machine/runtimeProtocol.ts +4 -2
  66. package/src/testing/MachineTest.ts +2 -2
  67. package/src/unstable/reactivity/AtomMachine.ts +90 -20
package/dist/Machine.js CHANGED
@@ -811,6 +811,9 @@ export const waitFor = internal.waitFor;
811
811
  * `prepared.start`. Ordinary callers can continue to use {@link start}, which
812
812
  * starts directly and does not allocate the prepared lifecycle boundary.
813
813
  *
814
+ * `prepared.start` is one-shot and scoped: the `Scope` that first evaluates it
815
+ * owns the machine, and closing that `Scope` is equivalent to `ref.stop`.
816
+ *
814
817
  * ```ts
815
818
  * const prepared = yield* Machine.prepare(machine)
816
819
  *
@@ -827,7 +830,7 @@ export const waitFor = internal.waitFor;
827
830
  */
828
831
  export const prepare = internal.prepare;
829
832
  /**
830
- * Starts a machine.
833
+ * Starts a machine owned by the current `Scope`.
831
834
  *
832
835
  * **When to use**
833
836
  *
@@ -841,6 +844,13 @@ export const prepare = internal.prepare;
841
844
  * publishes the new state, delivers emitted events, and then starts invokes
842
845
  * for entered states.
843
846
  *
847
+ * The machine is a scoped resource, like `Effect.forkScoped`. Closing the
848
+ * `Scope` is equivalent to `ref.stop`: active invocations are interrupted,
849
+ * owned children stop, the snapshot becomes `stopped`, and later sends fail
850
+ * with `StoppedError`. An earlier `ref.stop` or terminal completion leaves the
851
+ * finalizer with nothing to do. Own a `Scope` explicitly, for example with
852
+ * `Scope.make` and `Scope.provide`, when the machine must outlive the caller.
853
+ *
844
854
  * **Gotchas**
845
855
  *
846
856
  * The returned handle's `send` operation only enqueues events. Transition
@@ -867,10 +877,10 @@ export const prepare = internal.prepare;
867
877
  * Idle: {}
868
878
  * }
869
879
  * })
870
- * const state = Effect.gen(function*() {
880
+ * const state = Effect.scoped(Effect.gen(function*() {
871
881
  * const ref = yield* Machine.start(machine)
872
882
  * return yield* ref.state
873
- * })
883
+ * }))
874
884
  * ```
875
885
  *
876
886
  * @see {@link plan} for inspecting the same transition plan without executing it.
@@ -880,10 +890,14 @@ export const prepare = internal.prepare;
880
890
  */
881
891
  export const start = internal.start;
882
892
  /**
883
- * Starts a fresh managed runtime from a decoded logical snapshot.
893
+ * Starts a fresh managed runtime from a decoded logical snapshot, owned by the
894
+ * current `Scope`.
884
895
  *
885
896
  * **Details**
886
897
  *
898
+ * The resumed machine has the same scoped lifetime as {@link start}: closing
899
+ * the `Scope` is equivalent to `ref.stop`.
900
+ *
887
901
  * `resume` validates and normalizes the supplied snapshot before publishing it
888
902
  * as the first state. It does not call the machine's initial function, replay
889
903
  * entry or transition actions, re-deliver raised or emitted events, or
@@ -922,12 +936,12 @@ export const start = internal.start;
922
936
  * Idle: {}
923
937
  * }
924
938
  * })
925
- * const resumed = Effect.gen(function*() {
939
+ * const resumed = Effect.scoped(Effect.gen(function*() {
926
940
  * const initial = yield* Machine.planInitial(machine)
927
941
  * const encoded = yield* Machine.encodeSnapshot(machine, initial.state)
928
942
  * const snapshot = yield* Machine.decodeSnapshot(machine, encoded)
929
943
  * return yield* Machine.resume(machine, snapshot)
930
- * })
944
+ * }))
931
945
  * ```
932
946
  *
933
947
  * @see {@link decodeSnapshot} for the schema and transport boundary.
@@ -1 +1 @@
1
- {"version":3,"file":"Machine.js","sourceRoot":"","sources":["../src/Machine.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAc9C,OAAO,KAAK,QAAQ,MAAM,+BAA+B,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAgBlE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAW,iBAAiB,CAAA;AAS/C,MAAM,YAAY,GAAG,wBAAwB,CAAA;AAE7C,MAAM,uBAAuB,GAA4C,QAAQ,CAAC,uBAAuB,CAAA;AAEzG;;;;;;GAMG;AACH,OAAO,EAAE,kBAAkB,EAAE,CAAA;AAa7B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAiB,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAA;AAEtE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAU,EAAqB,EAAE,CAAC,WAAW,CAAC,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,kBAAkB,CAAA;AAmQxH,OAAO;AACL;;;;;;GAMG;AACH,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;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GASf,QAAQ,CAAC,MAAM,CAAA;AAEnB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAGlB,QAAQ,CAAC,SAAS,CAAA;AAEtB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,KAAK,GAEyC,QAAQ,CAAC,KAAK,CAAA;AAEzE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,OAAO,GAqBhB,QAAQ,CAAC,OAAO,CAAA;AAEpB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,OAAO,GA6DhB,QAAQ,CAAC,OAAO,CAAA;AAEpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,MAAM,CAAC,MAAM,KAAK,GA6Dd,QAAQ,CAAC,KAAK,CAAA;AAElB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,MAAM,CAAC,MAAM,MAAM,GAuDf,QAAQ,CAAC,MAAM,CAAA"}
@@ -12,11 +12,6 @@ import type * as Machine from "../../Machine.js";
12
12
  import type { Bound, ChildMachineAtom, MachineAtom } from "../../unstable/reactivity/AtomMachine.js";
13
13
  import type { EnsureExecutable } from "./readiness.js";
14
14
  import type { ExcludeCompatibleRuntime as ExcludeCompatibleMachineRuntime, IsAny } from "./requirements.js";
15
- declare const NotReadyError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
16
- readonly _tag: "NotReadyError";
17
- } & Readonly<A>;
18
- export declare class NotReadyError extends NotReadyError_base {
19
- }
20
15
  declare const ChildNotActiveError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
21
16
  readonly _tag: "ChildNotActiveError";
22
17
  } & Readonly<A>;
@@ -81,13 +76,13 @@ export declare const factory: any;
81
76
  export declare const resume: {
82
77
  <M extends Machine.Machine.Any>(machine: M & EnsureNoExternalRequirements<MachineResumeRequirementsOf<NoInfer<M>>> & EnsureMachineExecutable<NoInfer<M>> & Machine.Machine.RootCompatible<Machine.Machine.ParentEvents<NoInfer<M>>>, snapshot: Machine.Machine.Snapshot<Machine.Machine.States<M>>): ResumedMachineAtomOf<M, never>;
83
78
  };
84
- type FamilyBridge = MachineAtom<any, never, any, any, any, any> | ChildMachineAtom<any, any>;
79
+ type FamilyBridge = MachineAtom.Any | ChildMachineAtom.Any;
85
80
  type FamilyOptions = {
86
81
  readonly atoms: Readonly<Record<string, (bridge: FamilyBridge) => Atom.Atom<any>>>;
87
82
  readonly label?: (key: any, atomName: string) => string | undefined;
88
83
  };
89
84
  export declare const family: (machine: Machine.Machine.Any, options: FamilyOptions) => Readonly<Record<string, (key: any) => Atom.Atom<any>>>;
90
- export declare const familyChild: (parent: MachineAtom<any, never, any, any, any, any> | ChildMachineAtom<any, any>, options: FamilyOptions & {
85
+ export declare const familyChild: (parent: FamilyBridge, options: FamilyOptions & {
91
86
  readonly child: (key: any) => Machine.ChildMachine.Any;
92
87
  }) => Readonly<Record<string, (key: any) => Atom.Atom<any>>>;
93
88
  export declare const bind: <Services, RuntimeError>(runtime: Atom.AtomRuntime<Services, RuntimeError>) => Bound<Services, RuntimeError>;
@@ -1 +1 @@
1
- {"version":3,"file":"atom.d.ts","sourceRoot":"","sources":["../../../src/internal/machine/atom.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACnE,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAC5C,OAAO,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Aa,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,YAAY,CAAC,GAAG,CAAA;CAAE,KAClF,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAIrD,CAAA;AAEH,eAAO,MAAM,IAAI,GAAI,QAAQ,EAAE,YAAY,EACzC,SAAS,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,YAAY,CAAC,KAChD,KAAK,CAAC,QAAQ,EAAE,YAAY,CAqB9B,CAAA"}
@@ -12,9 +12,8 @@ import * as Option from "effect/Option";
12
12
  import { AsyncResult, Atom, AtomRegistry } from "effect/reactivity";
13
13
  import * as Stream from "effect/Stream";
14
14
  import * as internalMachine from "./machine.js";
15
+ import * as PlannedSnapshot from "./plannedSnapshot.js";
15
16
  import * as Topology from "./topology.js";
16
- export class NotReadyError extends Data.TaggedError("NotReadyError") {
17
- }
18
17
  export class ChildNotActiveError extends Data.TaggedError("ChildNotActiveError") {
19
18
  }
20
19
  const ExternalRequirementsTypeId = "~effect/reactivity/AtomMachine/ExternalRequirements";
@@ -51,6 +50,22 @@ const retainedFamily = (makeValue) => {
51
50
  const runMachineAtomEffect = (get, start) => Effect.scoped(Effect.acquireRelease(start, (ref) => ref.stop).pipe(Effect.tap((ref) => Effect.sync(() => get.setSelf(AsyncResult.success(ref)))), Effect.flatMap(() => Effect.never)));
52
51
  const startPreparedMachineAtomEffect = (get, prepared) => runMachineAtomEffect(get, get.result(prepared).pipe(Effect.flatMap((prepared) => prepared.start)));
53
52
  const resumeMachineAtomEffect = (get, machine, snapshot) => runMachineAtomEffect(get, internalMachine.resume(machine, snapshot));
53
+ // Effect stores the server read on the atom without exposing it in `Atom`'s
54
+ // type. This is the only erased boundary of the server protocol.
55
+ const readServerValue = (atom, get) => Atom.ServerValueTypeId in atom ? atom[Atom.ServerValueTypeId](get) : get(atom);
56
+ // Plans are computed on the first server read, at most once per bridge, so
57
+ // client starts never pay for them.
58
+ const lazyPlan = (plan) => {
59
+ let planned;
60
+ return () => {
61
+ if (planned === undefined)
62
+ planned = { value: plan() };
63
+ return planned.value;
64
+ };
65
+ };
66
+ // Planned snapshots are erased to the machine's snapshot schema; the bridge
67
+ // that owns a plan types its state, error and output.
68
+ const plannedSnapshot = (planned) => planned.snapshot;
54
69
  export const emissions = (self) => {
55
70
  const prepared = preparedByMachineAtom.get(self);
56
71
  if (prepared === undefined) {
@@ -102,6 +117,64 @@ export const childEmissions = (self) => Atom.toStreamResult(self.ref).pipe(Strea
102
117
  onNone: () => Stream.empty,
103
118
  onSome: (ref) => ref.emissions
104
119
  })));
120
+ // A write context exposes no registry, but a read through it does. Commands
121
+ // written before a machine is ready wait on that registry for the ref.
122
+ const registryAtom = Atom.readable((get) => get.registry).pipe(Atom.keepAlive);
123
+ const drainCommands = (queue) => Effect.suspend(() => {
124
+ const next = queue.pending.shift();
125
+ if (next === undefined) {
126
+ queue.draining = false;
127
+ return Effect.void;
128
+ }
129
+ return Effect.andThen(next, drainCommands(queue));
130
+ });
131
+ const getCommandQueue = (queues, registry) => {
132
+ let queue = queues.get(registry);
133
+ if (queue === undefined) {
134
+ queue = { pending: [], draining: false };
135
+ queues.set(registry, queue);
136
+ }
137
+ return queue;
138
+ };
139
+ /**
140
+ * Builds a command atom over a bridge ref.
141
+ *
142
+ * A write runs the command at once when the ref is ready and no earlier
143
+ * command is held. Otherwise the command is held until the ref settles, the
144
+ * write result stays waiting, and it settles with the command exit or with the
145
+ * startup failure.
146
+ */
147
+ const makeCommandAtom = (ref, queues, command) => Atom.writable((get) => {
148
+ const current = AsyncResult.map(get(ref), () => undefined);
149
+ const queue = queues.get(get.registry);
150
+ if (queue === undefined || !queue.draining) {
151
+ return current;
152
+ }
153
+ return Option.getOrElse(Option.map(get.self(), AsyncResult.waiting), () => AsyncResult.initial(true));
154
+ }, (ctx, value) => {
155
+ const current = ctx.get(ref);
156
+ const registry = ctx.get(registryAtom);
157
+ const queue = getCommandQueue(queues, registry);
158
+ if (AsyncResult.isInitial(current) || queue.draining) {
159
+ ctx.setSelf(AsyncResult.initial(true));
160
+ queue.pending.push(AtomRegistry.getResult(registry, ref).pipe(Effect.flatMap((ready) => command(ready, value)), Effect.exit, Effect.map((exit) => {
161
+ const result = AsyncResult.fromExit(exit);
162
+ ctx.setSelf(queue.pending.length === 0 ? result : AsyncResult.waiting(result));
163
+ })));
164
+ if (!queue.draining) {
165
+ queue.draining = true;
166
+ Effect.runFork(drainCommands(queue));
167
+ }
168
+ }
169
+ else if (AsyncResult.isFailure(current)) {
170
+ ctx.setSelf(AsyncResult.map(current, () => undefined));
171
+ }
172
+ else {
173
+ Effect.runCallback(command(current.value, value), {
174
+ onExit: (exit) => ctx.setSelf(AsyncResult.fromExit(exit))
175
+ });
176
+ }
177
+ }).pipe(Atom.withServerValueInitial);
105
178
  const makeRuntimeResultAtom = (snapshot) => Atom.readable((get) => {
106
179
  const current = get(snapshot);
107
180
  if (AsyncResult.isInitial(current)) {
@@ -122,7 +195,9 @@ const makeRuntimeResultAtom = (snapshot) => Atom.readable((get) => {
122
195
  return AsyncResult.success(current.value.state, {
123
196
  waiting: current.waiting
124
197
  });
125
- }).pipe(Atom.withEquality(Equal.equals));
198
+ }).pipe(Atom.withEquality(Equal.equals),
199
+ // A planned snapshot is never an error, so its state is the server result.
200
+ Atom.withServerValue((get) => AsyncResult.map(readServerValue(snapshot, get), (current) => current.state)));
126
201
  const makeChildRuntimeResultAtom = (snapshot) => Atom.readable((get) => {
127
202
  const current = get(snapshot);
128
203
  if (AsyncResult.isInitial(current)) {
@@ -152,7 +227,7 @@ const makeChildRuntimeResultAtom = (snapshot) => Atom.readable((get) => {
152
227
  return AsyncResult.success(Option.some(current.value.value.state), {
153
228
  waiting: current.waiting
154
229
  });
155
- }).pipe(Atom.withEquality(Equal.equals));
230
+ }).pipe(Atom.withEquality(Equal.equals), Atom.withServerValue((get) => AsyncResult.map(readServerValue(snapshot, get), Option.map((current) => current.state))));
156
231
  const makeChildRefAtom = (parentRef, child) => Atom.readable((get) => {
157
232
  const parent = get(parentRef);
158
233
  if (AsyncResult.isInitial(parent)) {
@@ -172,8 +247,8 @@ const makeChildRefAtom = (parentRef, child) => Atom.readable((get) => {
172
247
  const cancel = Effect.runCallback(Effect.yieldNow.pipe(Effect.andThen(handle.childChanges(child).pipe(Stream.runForEach((ref) => Effect.sync(() => get.setSelf(AsyncResult.success(ref))))))));
173
248
  get.addFinalizer(cancel);
174
249
  return AsyncResult.success(current);
175
- });
176
- const makeChildFromRefAtom = (ref, descriptor) => {
250
+ }).pipe(Atom.withServerValueInitial);
251
+ const makeChildFromRefAtom = (ref, descriptor, plan) => {
177
252
  const snapshot = Atom.readable((get) => {
178
253
  const result = get(ref);
179
254
  if (AsyncResult.isInitial(result)) {
@@ -192,40 +267,19 @@ const makeChildFromRefAtom = (ref, descriptor) => {
192
267
  const cancel = Effect.runCallback(handle.changes.pipe(Stream.runForEach((snapshot) => Effect.sync(() => get.setSelf(AsyncResult.success(Option.some(snapshot)))))));
193
268
  get.addFinalizer(cancel);
194
269
  return AsyncResult.success(Option.some(Effect.runSync(handle.snapshot)));
195
- });
196
- const send = Atom.writable((get) => AsyncResult.map(get(ref), () => undefined), (ctx, event) => {
197
- const result = ctx.get(ref);
198
- if (AsyncResult.isInitial(result)) {
199
- ctx.setSelf(AsyncResult.fail(new NotReadyError()));
200
- }
201
- else if (AsyncResult.isFailure(result)) {
202
- ctx.setSelf(AsyncResult.map(result, () => undefined));
203
- }
204
- else if (Option.isNone(result.value)) {
205
- ctx.setSelf(AsyncResult.fail(new ChildNotActiveError({ id: descriptor.id })));
206
- }
207
- else {
208
- Effect.runCallback(result.value.value.send(event), {
209
- onExit: (exit) => ctx.setSelf(AsyncResult.fromExit(exit))
210
- });
211
- }
212
- });
213
- const stop = Atom.writable((get) => AsyncResult.map(get(ref), () => undefined), (ctx) => {
214
- const result = ctx.get(ref);
215
- if (AsyncResult.isInitial(result)) {
216
- ctx.setSelf(AsyncResult.fail(new NotReadyError()));
217
- }
218
- else if (AsyncResult.isFailure(result)) {
219
- ctx.setSelf(AsyncResult.map(result, () => undefined));
220
- }
221
- else if (Option.isNone(result.value)) {
222
- ctx.setSelf(AsyncResult.fail(new ChildNotActiveError({ id: descriptor.id })));
223
- }
224
- else {
225
- Effect.runCallback(result.value.value.stop);
226
- }
227
- });
228
- const child = makeChildSelector(ref);
270
+ }).pipe(Atom.withServerValue(() => {
271
+ const planned = plan();
272
+ return planned === undefined
273
+ ? AsyncResult.initial(true)
274
+ : AsyncResult.success(Option.map(planned, (plannedSnapshot)), { waiting: true });
275
+ }));
276
+ const commands = new WeakMap();
277
+ const activeChild = (current) => Option.isSome(current)
278
+ ? Effect.succeed(current.value)
279
+ : Effect.fail(new ChildNotActiveError({ id: descriptor.id }));
280
+ const send = makeCommandAtom(ref, commands, (current, event) => Effect.flatMap(activeChild(current), (child) => child.send(event)));
281
+ const stop = makeCommandAtom(ref, commands, (current, _) => Effect.flatMap(activeChild(current), (child) => child.stop));
282
+ const child = makeChildSelector(ref, plan);
229
283
  return {
230
284
  ref,
231
285
  snapshot,
@@ -235,7 +289,7 @@ const makeChildFromRefAtom = (ref, descriptor) => {
235
289
  child
236
290
  };
237
291
  };
238
- const makeChildSelector = (parentRef) => {
292
+ const makeChildSelector = (parentRef, parentPlan) => {
239
293
  const byMachine = new WeakMap();
240
294
  return (descriptor) => {
241
295
  let family = byMachine.get(descriptor.machine);
@@ -243,7 +297,12 @@ const makeChildSelector = (parentRef) => {
243
297
  const machine = descriptor.machine;
244
298
  const atoms = Atom.family((id) => {
245
299
  const child = internalMachine.child(id, machine);
246
- return makeChildFromRefAtom(makeChildRefAtom(parentRef, child), child);
300
+ return makeChildFromRefAtom(makeChildRefAtom(parentRef, child), child, lazyPlan(() => {
301
+ const parent = parentPlan();
302
+ return parent === undefined || Option.isNone(parent)
303
+ ? parent
304
+ : PlannedSnapshot.planInvokedChild(parent.value, child);
305
+ }));
247
306
  });
248
307
  family = (id) => atoms(id);
249
308
  byMachine.set(machine, family);
@@ -251,7 +310,8 @@ const makeChildSelector = (parentRef) => {
251
310
  return family(descriptor.id);
252
311
  };
253
312
  };
254
- const makeFromRefAtom = (ref, machine) => {
313
+ const makeFromRefAtom = (liveRef, machine, plan) => {
314
+ const ref = Atom.withServerValueInitial(liveRef);
255
315
  const snapshot = Atom.readable((get) => {
256
316
  const result = get(ref);
257
317
  if (AsyncResult.isInitial(result)) {
@@ -272,35 +332,20 @@ const makeFromRefAtom = (ref, machine) => {
272
332
  return AsyncResult.success(current, {
273
333
  waiting: current.status === "active"
274
334
  });
275
- });
276
- const send = Atom.writable((get) => AsyncResult.map(get(ref), () => undefined), (ctx, event) => {
277
- const result = ctx.get(ref);
278
- if (AsyncResult.isInitial(result)) {
279
- ctx.setSelf(AsyncResult.fail(new NotReadyError()));
280
- }
281
- else if (AsyncResult.isFailure(result)) {
282
- ctx.setSelf(AsyncResult.map(result, () => undefined));
283
- }
284
- else {
285
- Effect.runCallback(result.value.send(event), {
286
- onExit: (exit) => ctx.setSelf(AsyncResult.fromExit(exit))
287
- });
288
- }
289
- });
290
- const stop = Atom.writable((get) => AsyncResult.map(get(ref), () => undefined), (ctx) => {
291
- const result = ctx.get(ref);
292
- if (AsyncResult.isInitial(result)) {
293
- ctx.setSelf(AsyncResult.fail(new NotReadyError()));
294
- }
295
- else if (AsyncResult.isFailure(result)) {
296
- ctx.setSelf(AsyncResult.map(result, () => undefined));
297
- }
298
- else {
299
- Effect.runCallback(result.value.stop);
300
- }
301
- });
335
+ }).pipe(Atom.withServerValue(() => {
336
+ const planned = plan();
337
+ return planned === undefined
338
+ ? AsyncResult.initial(true)
339
+ : AsyncResult.success(plannedSnapshot(planned), { waiting: true });
340
+ }));
341
+ const commands = new WeakMap();
342
+ const send = makeCommandAtom(ref, commands, (handle, event) => handle.send(event));
343
+ const stop = makeCommandAtom(ref, commands, (handle, _) => handle.stop);
302
344
  const optionalRef = Atom.mapResult(ref, Option.some);
303
- const child = makeChildSelector(optionalRef);
345
+ const child = makeChildSelector(optionalRef, () => {
346
+ const planned = plan();
347
+ return planned === undefined ? undefined : Option.some(planned);
348
+ });
304
349
  const result = {
305
350
  ref,
306
351
  snapshot,
@@ -314,6 +359,8 @@ const makeFromRefAtom = (ref, machine) => {
314
359
  };
315
360
  const selectValueByPath = (snapshot, path) => Topology.getSnapshotByPath(snapshot, path).pipe(Option.map((snapshot) => snapshot.value));
316
361
  const selectSnapshotByPath = (snapshot, path) => Topology.getSnapshotByPath(snapshot, path);
362
+ // Selectors project the bridge result live and its planned result on the server.
363
+ const mapResultSelector = (source, f) => Atom.mapResult(source, f).pipe(Atom.withEquality(Equal.equals), Atom.withServerValue((get) => AsyncResult.map(readServerValue(source, get), f)));
317
364
  const selectorsByBridge = new WeakMap();
318
365
  const cachedSelector = (bridge, kind, path, make) => {
319
366
  let selectorsByKind = selectorsByBridge.get(bridge);
@@ -334,12 +381,12 @@ const cachedSelector = (bridge, kind, path, make) => {
334
381
  selectorsByPath.set(path, selector);
335
382
  return selector;
336
383
  };
337
- export const select = (self, path) => cachedSelector(self, "select", path, () => Atom.mapResult(self.result, (snapshot) => selectValueByPath(snapshot, path)).pipe(Atom.withEquality(Equal.equals)));
338
- export const selectSnapshot = (self, path) => cachedSelector(self, "selectSnapshot", path, () => Atom.mapResult(self.result, (snapshot) => selectSnapshotByPath(snapshot, path)).pipe(Atom.withEquality(Equal.equals)));
339
- export const selectChild = (self, path) => cachedSelector(self, "selectChild", path, () => Atom.mapResult(self.result, Option.flatMap((snapshot) => selectValueByPath(snapshot, path))).pipe(Atom.withEquality(Equal.equals)));
340
- export const selectSnapshotChild = (self, path) => cachedSelector(self, "selectSnapshotChild", path, () => Atom.mapResult(self.result, Option.flatMap((snapshot) => selectSnapshotByPath(snapshot, path))).pipe(Atom.withEquality(Equal.equals)));
341
- export const matches = (self, path) => cachedSelector(self, "matches", path, () => Atom.mapResult(self.result, (snapshot) => Option.isSome(Topology.getSnapshotByPath(snapshot, path))).pipe(Atom.withEquality(Equal.equals)));
342
- export const matchesChild = (self, path) => cachedSelector(self, "matchesChild", path, () => Atom.mapResult(self.result, Option.exists((snapshot) => Option.isSome(Topology.getSnapshotByPath(snapshot, path)))).pipe(Atom.withEquality(Equal.equals)));
384
+ export const select = (self, path) => cachedSelector(self, "select", path, () => mapResultSelector(self.result, (snapshot) => selectValueByPath(snapshot, path)));
385
+ export const selectSnapshot = (self, path) => cachedSelector(self, "selectSnapshot", path, () => mapResultSelector(self.result, (snapshot) => selectSnapshotByPath(snapshot, path)));
386
+ export const selectChild = (self, path) => cachedSelector(self, "selectChild", path, () => mapResultSelector(self.result, Option.flatMap((snapshot) => selectValueByPath(snapshot, path))));
387
+ export const selectSnapshotChild = (self, path) => cachedSelector(self, "selectSnapshotChild", path, () => mapResultSelector(self.result, Option.flatMap((snapshot) => selectSnapshotByPath(snapshot, path))));
388
+ export const matches = (self, path) => cachedSelector(self, "matches", path, () => mapResultSelector(self.result, (snapshot) => Option.isSome(Topology.getSnapshotByPath(snapshot, path))));
389
+ export const matchesChild = (self, path) => cachedSelector(self, "matchesChild", path, () => mapResultSelector(self.result, Option.exists((snapshot) => Option.isSome(Topology.getSnapshotByPath(snapshot, path)))));
343
390
  export const can = (event) => {
344
391
  const byBridge = new WeakMap();
345
392
  return (self) => {
@@ -350,9 +397,7 @@ export const can = (event) => {
350
397
  const query = machine === undefined
351
398
  ? () => Effect.die(new Error("AtomMachine.can requires a machine atom created by AtomMachine"))
352
399
  : internalMachine.can(machine);
353
- const result = Atom.readable((get) => {
354
- const current = get(self.snapshot);
355
- const previous = get.self();
400
+ const evaluate = (current, input, previous) => {
356
401
  if (AsyncResult.isInitial(current)) {
357
402
  return AsyncResult.initial(current.waiting);
358
403
  }
@@ -371,7 +416,6 @@ export const can = (event) => {
371
416
  else if (current.value.status !== "active") {
372
417
  return AsyncResult.success(false, { waiting: current.waiting });
373
418
  }
374
- const input = Atom.isAtom(event) ? get(event) : event;
375
419
  const exit = Effect.runSyncExit(query(current.value.state, input));
376
420
  return exit._tag === "Success"
377
421
  ? AsyncResult.success(exit.value, { waiting: current.waiting })
@@ -379,7 +423,8 @@ export const can = (event) => {
379
423
  previous,
380
424
  waiting: current.waiting
381
425
  });
382
- }).pipe(Atom.withEquality(Equal.equals));
426
+ };
427
+ const result = Atom.readable((get) => evaluate(get(self.snapshot), Atom.isAtom(event) ? get(event) : event, get.self())).pipe(Atom.withEquality(Equal.equals), Atom.withServerValue((get) => evaluate(readServerValue(self.snapshot, get), Atom.isAtom(event) ? readServerValue(event, get) : event, Option.none())));
383
428
  byBridge.set(self, result);
384
429
  return result;
385
430
  };
@@ -387,29 +432,29 @@ export const can = (event) => {
387
432
  export const make = ((machine, ...args) => {
388
433
  const prepared = Atom.make(() => internalMachine.prepare(machine, ...args));
389
434
  const ref = Atom.make((get) => startPreparedMachineAtomEffect(get, prepared));
390
- const result = makeFromRefAtom(ref, machine);
435
+ const result = makeFromRefAtom(ref, machine, lazyPlan(() => PlannedSnapshot.planStart(machine, args)));
391
436
  preparedByMachineAtom.set(result, prepared);
392
437
  return result;
393
438
  });
394
439
  export const factory = ((machine) => (...args) => make(machine, ...args));
395
440
  export const resume = ((machine, snapshot) => {
396
441
  const ref = Atom.make((get) => resumeMachineAtomEffect(get, machine, snapshot));
397
- return makeFromRefAtom(ref, machine);
442
+ return makeFromRefAtom(ref, machine, lazyPlan(() => PlannedSnapshot.planResume(machine, snapshot)));
398
443
  });
399
444
  const makeWithRuntime = (runtime, machine, args) => {
400
445
  const prepared = runtime.atom(() => internalMachine.prepare(machine, ...args));
401
446
  const ref = runtime.atom((get) => startPreparedMachineAtomEffect(get, prepared));
402
- const result = makeFromRefAtom(ref, machine);
447
+ const result = makeFromRefAtom(ref, machine, lazyPlan(() => PlannedSnapshot.planStart(machine, args)));
403
448
  preparedByMachineAtom.set(result, prepared);
404
449
  return result;
405
450
  };
406
451
  const resumeWithRuntime = (runtime, machine, snapshot) => {
407
452
  const ref = runtime.atom((get) => resumeMachineAtomEffect(get, machine, snapshot));
408
- return makeFromRefAtom(ref, machine);
453
+ return makeFromRefAtom(ref, machine, lazyPlan(() => PlannedSnapshot.planResume(machine, snapshot)));
409
454
  };
410
455
  const retainFamilyOwner = (owner, source, label) => {
411
456
  const retained = { owner, source };
412
- let atom = Atom.transform(source, (get) => get(retained.source), { initialValueTarget: source }).pipe(Atom.withEquality((value, next) => retained.source.equals(value, next)));
457
+ let atom = Atom.transform(source, (get) => get(retained.source), { initialValueTarget: source }).pipe(Atom.withEquality((value, next) => retained.source.equals(value, next)), Atom.withServerValue((get) => readServerValue(retained.source, get)));
413
458
  if (label !== undefined) {
414
459
  atom = atom.pipe(Atom.withLabel(label));
415
460
  }