@kestack/kabuki 0.0.0-stage → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +274 -2
- package/dist/core/actor/actor.d.ts +42 -0
- package/dist/core/actor/actor.d.ts.map +1 -0
- package/dist/core/actor/actor.js +168 -0
- package/dist/core/actor/command.d.ts +24 -0
- package/dist/core/actor/command.d.ts.map +1 -0
- package/dist/core/actor/command.js +31 -0
- package/dist/core/actor/index.d.ts +6 -0
- package/dist/core/actor/index.d.ts.map +1 -0
- package/dist/core/actor/index.js +3 -0
- package/dist/core/actor/types.d.ts +295 -0
- package/dist/core/actor/types.d.ts.map +1 -0
- package/dist/core/actor/types.js +2 -0
- package/dist/core/history/history.d.ts +67 -0
- package/dist/core/history/history.d.ts.map +1 -0
- package/dist/core/history/history.js +145 -0
- package/dist/core/history/index.d.ts +5 -0
- package/dist/core/history/index.d.ts.map +1 -0
- package/dist/core/history/index.js +2 -0
- package/dist/core/history/replay.d.ts +34 -0
- package/dist/core/history/replay.d.ts.map +1 -0
- package/dist/core/history/replay.js +82 -0
- package/dist/core/history/saved.d.ts +7 -0
- package/dist/core/history/saved.d.ts.map +1 -0
- package/dist/core/history/saved.js +126 -0
- package/dist/core/index.d.ts +9 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +4 -0
- package/dist/core/runtime/index.d.ts +4 -0
- package/dist/core/runtime/index.d.ts.map +1 -0
- package/dist/core/runtime/index.js +1 -0
- package/dist/core/runtime/instance/command.d.ts +4 -0
- package/dist/core/runtime/instance/command.d.ts.map +1 -0
- package/dist/core/runtime/instance/command.js +12 -0
- package/dist/core/runtime/instance/index.d.ts +4 -0
- package/dist/core/runtime/instance/index.d.ts.map +1 -0
- package/dist/core/runtime/instance/index.js +1 -0
- package/dist/core/runtime/instance/instance.d.ts +16 -0
- package/dist/core/runtime/instance/instance.d.ts.map +1 -0
- package/dist/core/runtime/instance/instance.js +113 -0
- package/dist/core/runtime/instance/self.d.ts +35 -0
- package/dist/core/runtime/instance/self.d.ts.map +1 -0
- package/dist/core/runtime/instance/self.js +42 -0
- package/dist/core/runtime/instance/worker.d.ts +16 -0
- package/dist/core/runtime/instance/worker.d.ts.map +1 -0
- package/dist/core/runtime/instance/worker.js +52 -0
- package/dist/core/runtime/mailbox.d.ts +10 -0
- package/dist/core/runtime/mailbox.d.ts.map +1 -0
- package/dist/core/runtime/mailbox.js +64 -0
- package/dist/core/runtime/runtime.d.ts +36 -0
- package/dist/core/runtime/runtime.d.ts.map +1 -0
- package/dist/core/runtime/runtime.js +93 -0
- package/dist/core/runtime/time.d.ts +11 -0
- package/dist/core/runtime/time.d.ts.map +1 -0
- package/dist/core/runtime/time.js +22 -0
- package/dist/core/snapshot/handle.d.ts +14 -0
- package/dist/core/snapshot/handle.d.ts.map +1 -0
- package/dist/core/snapshot/handle.js +70 -0
- package/dist/core/snapshot/index.d.ts +8 -0
- package/dist/core/snapshot/index.d.ts.map +1 -0
- package/dist/core/snapshot/index.js +4 -0
- package/dist/core/snapshot/invoke.d.ts +17 -0
- package/dist/core/snapshot/invoke.d.ts.map +1 -0
- package/dist/core/snapshot/invoke.js +119 -0
- package/dist/core/snapshot/restore.d.ts +16 -0
- package/dist/core/snapshot/restore.d.ts.map +1 -0
- package/dist/core/snapshot/restore.js +63 -0
- package/dist/core/snapshot/snapshot.d.ts +61 -0
- package/dist/core/snapshot/snapshot.d.ts.map +1 -0
- package/dist/core/snapshot/snapshot.js +4 -0
- package/dist/core/snapshot/tree.d.ts +26 -0
- package/dist/core/snapshot/tree.d.ts.map +1 -0
- package/dist/core/snapshot/tree.js +77 -0
- package/dist/react/app.d.ts +49 -0
- package/dist/react/app.d.ts.map +1 -0
- package/dist/react/app.js +214 -0
- package/dist/react/child.d.ts +32 -0
- package/dist/react/child.d.ts.map +1 -0
- package/dist/react/child.js +80 -0
- package/dist/react/drawn.d.ts +4 -0
- package/dist/react/drawn.d.ts.map +1 -0
- package/dist/react/drawn.js +118 -0
- package/dist/react/index.d.ts +7 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +3 -0
- package/dist/react/registry.d.ts +12 -0
- package/dist/react/registry.d.ts.map +1 -0
- package/dist/react/registry.js +25 -0
- package/dist/react/view.d.ts +80 -0
- package/dist/react/view.d.ts.map +1 -0
- package/dist/react/view.js +47 -0
- package/package.json +55 -3
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import type { Context, Effect, Layer, Scope, Stream } from 'effect';
|
|
2
|
+
export type Tagged = {
|
|
3
|
+
readonly _tag: string;
|
|
4
|
+
};
|
|
5
|
+
/** The one State of an Actor declared without States. */
|
|
6
|
+
export type Single = {
|
|
7
|
+
readonly _tag: 'Single';
|
|
8
|
+
};
|
|
9
|
+
type AnyKey = Context.Key<any, any>;
|
|
10
|
+
/** The Capabilities an Actor's own code may use. */
|
|
11
|
+
export type Requires = ReadonlyArray<AnyKey>;
|
|
12
|
+
type IdsOf<R extends Requires> = R[number] extends infer K ? K extends Context.Key<infer I, any> ? I : never : never;
|
|
13
|
+
export type Only<U, T> = Extract<U, {
|
|
14
|
+
readonly _tag: T;
|
|
15
|
+
}>;
|
|
16
|
+
/** An Instance's data at one moment: its own Model and State, and the Props its parent hands it. */
|
|
17
|
+
export type Data<Model, State, Props = void> = {
|
|
18
|
+
readonly model: Model;
|
|
19
|
+
readonly state: State;
|
|
20
|
+
/** What the parent hands it now. Read only: a change runs none of its rules. */
|
|
21
|
+
readonly props: Props;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* What an Instance's own work holds of it: Workers and Provides. Sends go
|
|
25
|
+
* only to this Instance; `get` and `changes` are always current.
|
|
26
|
+
*/
|
|
27
|
+
export interface Self<Model, State, Msg, Props = void> {
|
|
28
|
+
readonly id: string;
|
|
29
|
+
readonly send: (message: Msg) => Effect.Effect<void>;
|
|
30
|
+
readonly get: Effect.Effect<Data<Model, State, Props>>;
|
|
31
|
+
/** The current data, then each new value after a Message or the parent changes it. */
|
|
32
|
+
readonly changes: Stream.Stream<Data<Model, State, Props>>;
|
|
33
|
+
/**
|
|
34
|
+
* The app's Time now, in milliseconds since the Runtime started: the clock
|
|
35
|
+
* Messages are stamped with, which stands still while stopped. A Worker
|
|
36
|
+
* that waits until a Time in the Model sleeps for `that - now`, so it waits
|
|
37
|
+
* only what is left when it starts again on a resume or a fork.
|
|
38
|
+
*/
|
|
39
|
+
readonly now: Effect.Effect<number>;
|
|
40
|
+
}
|
|
41
|
+
/** Where a Command keeps the Effect it runs, out of sight of a comparison. */
|
|
42
|
+
export declare const RUN: unique symbol;
|
|
43
|
+
/**
|
|
44
|
+
* An errand an Update asks for, as `Command.make` makes it: its name and
|
|
45
|
+
* args, and the Effect that ends with at most one Message, Sent to its
|
|
46
|
+
* Instance. Nothing stops it but its Instance stopping; work that must be
|
|
47
|
+
* stopped, show progress or survive a stop is a Worker.
|
|
48
|
+
*/
|
|
49
|
+
export interface Command<Out, Ids = never> {
|
|
50
|
+
readonly name: string;
|
|
51
|
+
readonly args: unknown;
|
|
52
|
+
readonly [RUN]: Effect.Effect<Out, never, Ids>;
|
|
53
|
+
}
|
|
54
|
+
/** The Updates of one level, by Message tag. */
|
|
55
|
+
type Rules<Model, State, Props, Msg extends Tagged, R extends Requires, Next> = {
|
|
56
|
+
readonly [K in Msg['_tag']]?: (message: Only<Msg, K>, scope: Data<Model, State, Props> & {
|
|
57
|
+
/** The Message's Time, in milliseconds since the Runtime started. */
|
|
58
|
+
readonly at: number;
|
|
59
|
+
}) => {
|
|
60
|
+
readonly model?: Model;
|
|
61
|
+
readonly state?: Next;
|
|
62
|
+
/** The Commands to run, concurrently. */
|
|
63
|
+
readonly command?: Command<Msg | void, IdsOf<R>> | ReadonlyArray<Command<Msg | void, IdsOf<R>>>;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
/** A Worker's Effect: scoped, Sending its Instance, given the key it runs for. */
|
|
67
|
+
type Run<Model, State, Props, Msg, R extends Requires> = (self: Self<Model, State, Msg, Props>, key: string) => Effect.Effect<unknown, never, IdsOf<R> | Scope.Scope>;
|
|
68
|
+
/**
|
|
69
|
+
* Work that runs for exactly as long as its Condition holds, read from the
|
|
70
|
+
* Instance's own data, Props included, whenever it changes. Where it is
|
|
71
|
+
* written is part of the Condition: at the top it is owned by the Instance,
|
|
72
|
+
* in a State's block by that State. Inside that, it runs always, `while` a test is true, or once
|
|
73
|
+
* per key `each` names. When the Condition stops holding, its Scope closes.
|
|
74
|
+
*/
|
|
75
|
+
export type Worker<Model, State, Msg, R extends Requires, Props = void> = {
|
|
76
|
+
readonly while?: never;
|
|
77
|
+
readonly each?: never;
|
|
78
|
+
readonly run: Run<Model, State, Props, Msg, R>;
|
|
79
|
+
} | {
|
|
80
|
+
readonly while: (data: Data<Model, State, Props>) => boolean;
|
|
81
|
+
readonly each?: never;
|
|
82
|
+
readonly run: Run<Model, State, Props, Msg, R>;
|
|
83
|
+
} | {
|
|
84
|
+
readonly while?: never;
|
|
85
|
+
readonly each: (data: Data<Model, State, Props>) => ReadonlyArray<string>;
|
|
86
|
+
readonly run: Run<Model, State, Props, Msg, R>;
|
|
87
|
+
};
|
|
88
|
+
/** Every Worker of one level, by name. */
|
|
89
|
+
export type Workers<Model, State, Msg, R extends Requires, Props = void> = Readonly<Record<string, Worker<Model, State, Msg, R, Props>>>;
|
|
90
|
+
/** A keyed Child: one Instance of `actor` per key the parent Invokes. */
|
|
91
|
+
export interface Many<A extends AnyActor> {
|
|
92
|
+
readonly _tag: 'Many';
|
|
93
|
+
readonly actor: A;
|
|
94
|
+
}
|
|
95
|
+
export type Slot = AnyActor | Many<AnyActor>;
|
|
96
|
+
export type Children = Readonly<Record<string, Slot>>;
|
|
97
|
+
export type ActorOf<S> = S extends Many<infer A> ? A : S;
|
|
98
|
+
/** What a parent hands one Child: its Input, read once, and its Props, read live. Each is required once the Child declares it. */
|
|
99
|
+
type Given<A> = ([Types<A>['input']] extends [void] ? {
|
|
100
|
+
readonly input?: Types<A>['input'];
|
|
101
|
+
} : {
|
|
102
|
+
readonly input: Types<A>['input'];
|
|
103
|
+
}) & ([Types<A>['props']] extends [void] ? {
|
|
104
|
+
readonly props?: Types<A>['props'];
|
|
105
|
+
} : {
|
|
106
|
+
readonly props: Types<A>['props'];
|
|
107
|
+
});
|
|
108
|
+
type ManyKeys<C> = {
|
|
109
|
+
[K in keyof C]: C[K] extends Many<any> ? K : never;
|
|
110
|
+
}[keyof C];
|
|
111
|
+
type NeedKeys<C> = {
|
|
112
|
+
[K in keyof C]: C[K] extends Many<any> ? never : {} extends Given<C[K]> ? never : K;
|
|
113
|
+
}[keyof C];
|
|
114
|
+
type FreeKeys<C> = Exclude<keyof C, ManyKeys<C> | NeedKeys<C>>;
|
|
115
|
+
/** What a level Invokes: the key, Input and Props of each keyed Child, and the Input and Props of each fixed one. */
|
|
116
|
+
export type Invocation<C> = {
|
|
117
|
+
readonly [K in ManyKeys<C>]: ReadonlyArray<{
|
|
118
|
+
readonly key: string;
|
|
119
|
+
} & Given<ActorOf<C[K]>>>;
|
|
120
|
+
} & {
|
|
121
|
+
readonly [K in NeedKeys<C>]: Given<C[K]>;
|
|
122
|
+
} & {
|
|
123
|
+
readonly [K in FreeKeys<C>]?: Given<C[K]>;
|
|
124
|
+
};
|
|
125
|
+
/** The Children a level, as written, Invokes. */
|
|
126
|
+
type KidsOf<L> = L extends {
|
|
127
|
+
readonly children: infer C;
|
|
128
|
+
} ? C : {};
|
|
129
|
+
/** `invoke` is required once a level has a Child that needs keys or Input. */
|
|
130
|
+
type InvokePart<Model, State, Props, C> = {} extends Invocation<C> ? {
|
|
131
|
+
readonly invoke?: (data: Data<Model, State, Props>) => Invocation<C>;
|
|
132
|
+
} : {
|
|
133
|
+
readonly invoke: (data: Data<Model, State, Props>) => Invocation<C>;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* One level of an Actor's behavior: the top, for as long as the Instance
|
|
137
|
+
* lives, or one State's block, for as long as that State lasts. `L` is the
|
|
138
|
+
* level as written, so `invoke` is checked against the `children` beside it.
|
|
139
|
+
*/
|
|
140
|
+
type Level<Model, State, Props, Msg extends Tagged, R extends Requires, Next, L> = {
|
|
141
|
+
/** The Capabilities this level gives everything below it, as one Layer. */
|
|
142
|
+
readonly provides?: (self: Self<Model, State, Msg, Props>) => Layer.Layer<any, never, IdsOf<R>>;
|
|
143
|
+
readonly children?: Children;
|
|
144
|
+
/** The Updates: per Message, the next Model and State and the Commands. */
|
|
145
|
+
readonly on?: Rules<Model, State, Props, Msg, R, Next>;
|
|
146
|
+
readonly workers?: Workers<Model, State, Msg, R, Props>;
|
|
147
|
+
} & InvokePart<Model, State, Props, KidsOf<L>>;
|
|
148
|
+
type ModelInit<Model> = {} extends Model ? {
|
|
149
|
+
readonly model?: Model;
|
|
150
|
+
} : {
|
|
151
|
+
readonly model: Model;
|
|
152
|
+
};
|
|
153
|
+
/** The block written for State `T`, if any. */
|
|
154
|
+
type BlockOf<B, T extends PropertyKey> = B extends {
|
|
155
|
+
readonly state: {
|
|
156
|
+
readonly [K in T]: infer L;
|
|
157
|
+
};
|
|
158
|
+
} ? L : {};
|
|
159
|
+
/** An Actor declared without a `state` Schema has one State, and no State blocks. */
|
|
160
|
+
export type IsSingle<State> = [State] extends [Single] ? true : false;
|
|
161
|
+
/**
|
|
162
|
+
* How an Actor is built. `B` is the behavior as written: each level's
|
|
163
|
+
* `invoke` is checked against its own `children`, and what the levels
|
|
164
|
+
* Provide and Invoke becomes the Actor's type.
|
|
165
|
+
*/
|
|
166
|
+
export type Behavior<Input, Props, Model, State extends Tagged, Msg extends Tagged, R extends Requires, B> = IsSingle<State> extends true ? Level<Model, Single, Props, Msg, R, never, B> & {
|
|
167
|
+
readonly state?: never;
|
|
168
|
+
} & ([Input] extends [void] ? {} extends Model ? {
|
|
169
|
+
readonly init?: (input: Input) => ModelInit<Model>;
|
|
170
|
+
} : {
|
|
171
|
+
readonly init: (input: Input) => ModelInit<Model>;
|
|
172
|
+
} : {
|
|
173
|
+
readonly init: (input: Input) => ModelInit<Model>;
|
|
174
|
+
}) : Level<Model, State, Props, Msg, R, State, B> & {
|
|
175
|
+
/** The first Model and State, from the Input. */
|
|
176
|
+
readonly init: (input: Input) => {
|
|
177
|
+
readonly state: State;
|
|
178
|
+
} & ModelInit<Model>;
|
|
179
|
+
/** One block per State, holding only while it lasts. */
|
|
180
|
+
readonly state?: {
|
|
181
|
+
readonly [T in State['_tag']]?: Level<Model, Only<State, T>, Props, Msg, R, State, BlockOf<B, T>>;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
/** The Capabilities a level's `provides` builds. */
|
|
185
|
+
type ProvidedOf<L> = L extends {
|
|
186
|
+
readonly provides: (...args: any) => Layer.Layer<infer P, any, any>;
|
|
187
|
+
} ? P : never;
|
|
188
|
+
type OpenOf<A> = A extends Actor<any, any, any, any, any, any, any, infer O> ? O : never;
|
|
189
|
+
/** What the Children of a level still need from above. */
|
|
190
|
+
type KidsOpen<C> = {
|
|
191
|
+
[K in keyof C]: OpenOf<ActorOf<C[K]>>;
|
|
192
|
+
}[keyof C];
|
|
193
|
+
/**
|
|
194
|
+
* What an Actor still needs from above: its own Requires, and whatever its
|
|
195
|
+
* Children need that is not Provided where they are placed. A Child's needs
|
|
196
|
+
* bubble up until something Provides them; the app's Layer covers the rest.
|
|
197
|
+
*/
|
|
198
|
+
export type OpenOfBehavior<R extends Requires, B> = IdsOf<R> | Exclude<KidsOpen<KidsOf<B>>, ProvidedOf<B>> | (B extends {
|
|
199
|
+
readonly state: infer S;
|
|
200
|
+
} ? {
|
|
201
|
+
[T in keyof S]: Exclude<KidsOpen<KidsOf<S[T]>>, ProvidedOf<B> | ProvidedOf<S[T]>>;
|
|
202
|
+
}[keyof S] : never);
|
|
203
|
+
/** The Children per State tag, top-level ones in every State, for Views. */
|
|
204
|
+
export type KidsByState<State extends Tagged, B> = {
|
|
205
|
+
readonly [T in State['_tag']]: KidsOf<B> & KidsOf<BlockOf<B, T>>;
|
|
206
|
+
};
|
|
207
|
+
/** Throws unless a value matches one of an Actor's Schemas; `what` names it in the error. */
|
|
208
|
+
export type Check = (value: unknown, what: string) => void;
|
|
209
|
+
/** One of an Actor's Schemas, to save a value as its encoded side and read it back. Both throw on a mismatch; without a Schema, both give the value. */
|
|
210
|
+
export interface Encoding {
|
|
211
|
+
readonly encode: (value: unknown) => unknown;
|
|
212
|
+
readonly decode: (value: unknown) => unknown;
|
|
213
|
+
}
|
|
214
|
+
/** One Child slot, as the engine sees it. */
|
|
215
|
+
export interface SlotDefinition {
|
|
216
|
+
readonly definition: ActorDefinition;
|
|
217
|
+
readonly many: boolean;
|
|
218
|
+
}
|
|
219
|
+
/** One Worker, as the engine sees it: which keys its Condition names, and what runs for each. */
|
|
220
|
+
export interface WorkerDefinition {
|
|
221
|
+
/** `state` for a Worker that runs always in its State's block. */
|
|
222
|
+
readonly kind: 'instance' | 'state' | 'while' | 'each';
|
|
223
|
+
/** The State whose block it is written in; none for a top-level Worker. */
|
|
224
|
+
readonly state?: string;
|
|
225
|
+
/** The keys the Condition names for this data; `''` for the one Worker of the other kinds. */
|
|
226
|
+
readonly keys: (data: Data<unknown, Tagged, unknown>) => ReadonlyArray<string>;
|
|
227
|
+
readonly run: Function;
|
|
228
|
+
}
|
|
229
|
+
/** The plain definition the engine works from; an Actor without States is keyed by its one State. */
|
|
230
|
+
export interface ActorDefinition {
|
|
231
|
+
readonly name: string;
|
|
232
|
+
/** Every State it can be in, by tag: the ones its State Schema names. */
|
|
233
|
+
readonly states: ReadonlyArray<string>;
|
|
234
|
+
readonly requires: Requires;
|
|
235
|
+
/** Throw unless a value matches the Actor's Schema for it. */
|
|
236
|
+
readonly check: {
|
|
237
|
+
readonly input: Check;
|
|
238
|
+
readonly props: Check;
|
|
239
|
+
readonly model: Check;
|
|
240
|
+
readonly state: Check;
|
|
241
|
+
readonly message: Check;
|
|
242
|
+
};
|
|
243
|
+
/** The Schemas a saved History is written and read with: what it holds of an Instance, and its Messages. */
|
|
244
|
+
readonly encoding: {
|
|
245
|
+
readonly props: Encoding;
|
|
246
|
+
readonly model: Encoding;
|
|
247
|
+
readonly state: Encoding;
|
|
248
|
+
readonly message: Encoding;
|
|
249
|
+
};
|
|
250
|
+
readonly init: (input: unknown) => {
|
|
251
|
+
readonly model?: unknown;
|
|
252
|
+
readonly state?: Tagged;
|
|
253
|
+
};
|
|
254
|
+
/** The Updates by State tag, and the top-level ones under `'*'`. */
|
|
255
|
+
readonly update: Readonly<Record<string, Readonly<Record<string, Function | undefined>> | undefined>>;
|
|
256
|
+
readonly workers: Readonly<Record<string, WorkerDefinition>>;
|
|
257
|
+
/** The top-level Provide, built once when the Instance starts. */
|
|
258
|
+
readonly provides: Function | undefined;
|
|
259
|
+
/** Each State's Provide, built each time it is entered. */
|
|
260
|
+
readonly stateProvides: Readonly<Record<string, Function | undefined>>;
|
|
261
|
+
/** The Children of each State: the top-level ones, then the State's own. */
|
|
262
|
+
readonly children: Readonly<Record<string, Readonly<Record<string, SlotDefinition>> | undefined>>;
|
|
263
|
+
/** The slots written at the top: they last as long as the Instance. */
|
|
264
|
+
readonly lasting: ReadonlyArray<string>;
|
|
265
|
+
/** What each State Invokes, the top-level Invocation included. */
|
|
266
|
+
readonly invoke: Readonly<Record<string, Function | undefined>>;
|
|
267
|
+
}
|
|
268
|
+
declare const types: unique symbol;
|
|
269
|
+
export interface Actor<out Name extends string, out Input, out Props, out Model, out State extends Tagged, out Msg extends Tagged, out Kids, out Needs> {
|
|
270
|
+
readonly name: Name;
|
|
271
|
+
readonly definition: ActorDefinition;
|
|
272
|
+
readonly [types]?: {
|
|
273
|
+
readonly input: Input;
|
|
274
|
+
readonly props: Props;
|
|
275
|
+
readonly model: Model;
|
|
276
|
+
readonly state: State;
|
|
277
|
+
readonly message: Msg;
|
|
278
|
+
readonly children: Kids;
|
|
279
|
+
readonly open: Needs;
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
export type AnyActor = Actor<string, any, any, any, any, any, any, any>;
|
|
283
|
+
/** Everything an Actor's types say, for the Runtime and Views. */
|
|
284
|
+
export type Types<A> = A extends Actor<any, infer Input, infer Props, infer Model, infer State, infer Msg, infer Kids, infer Needs> ? {
|
|
285
|
+
input: Input;
|
|
286
|
+
props: Props;
|
|
287
|
+
model: Model;
|
|
288
|
+
state: State;
|
|
289
|
+
message: Msg;
|
|
290
|
+
/** Slots per State tag. */
|
|
291
|
+
children: Kids;
|
|
292
|
+
open: Needs;
|
|
293
|
+
} : never;
|
|
294
|
+
export {};
|
|
295
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/actor/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEpE,MAAM,MAAM,MAAM,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/C,yDAAyD;AACzD,MAAM,MAAM,MAAM,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;AAEjD,KAAK,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACpC,oDAAoD;AACpD,MAAM,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;AAE7C,KAAK,KAAK,CAAC,CAAC,SAAS,QAAQ,IAAI,CAAC,CAAC,MAAM,CAAC,SAAS,MAAM,CAAC,GACtD,CAAC,SAAS,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,GACjC,CAAC,GACD,KAAK,GACP,KAAK,CAAC;AAEV,MAAM,MAAM,IAAI,CAAC,CAAC,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,EAAE;IAAE,QAAQ,CA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;AAED,MAAM,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAExE,kEAAkE;AAClE,MAAM,MAAM,KAAK,CAAC,CAAC,IACjB,CAAC,SAAS,KAAK,CACb,GAAG,EACH,MAAM,KAAK,EACX,MAAM,KAAK,EACX,MAAM,KAAK,EACX,MAAM,KAAK,EACX,MAAM,GAAG,EACT,MAAM,IAAI,EACV,MAAM,KAAK,CACZ,GACG;IACE,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,GAAG,CAAC;IACb,2BAA2B;IAC3B,QAAQ,EAAE,IAAI,CAAC;IACf,IAAI,EAAE,KAAK,CAAC;CACb,GACD,KAAK,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { Effect } from 'effect';
|
|
2
|
+
import type { AnyActor } from '../actor/index.ts';
|
|
3
|
+
import type { Envelope, Handled, Snapshot } from '../snapshot/index.ts';
|
|
4
|
+
import type { ReplayOptions } from './replay.ts';
|
|
5
|
+
/** One entry: an Envelope, and where it sits. */
|
|
6
|
+
export interface Entry extends Envelope {
|
|
7
|
+
/** Its position in the History. */
|
|
8
|
+
readonly id: number;
|
|
9
|
+
/** The entry before it, or `null` right after init. */
|
|
10
|
+
readonly parent: number | null;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A History as plain JSON, to keep and load again: every Message, and every
|
|
14
|
+
* Instance of a Restore's Snapshot, as its Actor's Schemas encode it.
|
|
15
|
+
*/
|
|
16
|
+
export interface SavedHistory {
|
|
17
|
+
/** Append-only: an entry's id is its position. */
|
|
18
|
+
readonly entries: ReadonlyArray<Entry>;
|
|
19
|
+
/** The entry the next Message goes after, or `null` right after init. */
|
|
20
|
+
readonly head: number | null;
|
|
21
|
+
}
|
|
22
|
+
export interface HistoryOptions extends ReplayOptions {
|
|
23
|
+
/** The root's Input. */
|
|
24
|
+
readonly input?: unknown;
|
|
25
|
+
}
|
|
26
|
+
export interface History<A = AnyActor> {
|
|
27
|
+
readonly actor: A;
|
|
28
|
+
/** The History as plain JSON: the same object until it changes, and never changed itself. */
|
|
29
|
+
readonly save: () => SavedHistory;
|
|
30
|
+
readonly head: () => number | null;
|
|
31
|
+
/** The entries from the first to `to`, the Head by default. */
|
|
32
|
+
readonly branch: (to?: number | null) => ReadonlyArray<Entry>;
|
|
33
|
+
/** The entries that follow an entry (`null`: init), oldest first. */
|
|
34
|
+
readonly children: (of: number | null) => ReadonlyArray<Entry>;
|
|
35
|
+
/** Write an Envelope after the Head, with what came of it, and move the Head to it. */
|
|
36
|
+
readonly append: (envelope: Envelope, handled: Handled) => Entry;
|
|
37
|
+
/** Move the Head to an entry (`null`: init). */
|
|
38
|
+
readonly moveHead: (to: number | null) => void;
|
|
39
|
+
/** Forget every entry, on every Branch. */
|
|
40
|
+
readonly clear: () => void;
|
|
41
|
+
/** The Snapshot right after an entry, the Head by default, yielding to the page as it plays. */
|
|
42
|
+
readonly seek: (entry?: number | null) => Effect.Effect<Snapshot>;
|
|
43
|
+
/** The Snapshot right after an entry (`null`: init), played now. */
|
|
44
|
+
readonly snapshotAt: (entry: number | null) => Snapshot;
|
|
45
|
+
/** What came of an entry: worked out again when not seen live. */
|
|
46
|
+
readonly outcome: (entry: number) => Handled['outcome'];
|
|
47
|
+
readonly subscribe: (listener: () => void) => () => void;
|
|
48
|
+
/** Keep the Head where it is while a Runtime runs on it. Call what it returns to let go. */
|
|
49
|
+
readonly lock: () => () => void;
|
|
50
|
+
}
|
|
51
|
+
declare const make: <A extends AnyActor>(actor: A, options?: HistoryOptions) => History<A>;
|
|
52
|
+
/** A History saved before, read with the Actor's code as it is now. Throws if `saved` is not a History's shape. */
|
|
53
|
+
declare const load: <A extends AnyActor>(actor: A, saved: SavedHistory, options?: HistoryOptions) => History<A>;
|
|
54
|
+
/**
|
|
55
|
+
* The lightest History an app can be saved as: right after init, one Restore
|
|
56
|
+
* of `snapshot` at Time `at`. Nothing before it can be travelled to but init.
|
|
57
|
+
*/
|
|
58
|
+
declare const restored: <A extends AnyActor>(actor: A, snapshot: Snapshot, at: number, options?: HistoryOptions) => History<A>;
|
|
59
|
+
export declare const History: {
|
|
60
|
+
make: typeof make;
|
|
61
|
+
load: typeof load;
|
|
62
|
+
restored: typeof restored;
|
|
63
|
+
};
|
|
64
|
+
/** Tells a History from an Actor. */
|
|
65
|
+
export declare const isHistory: (value: object) => value is History;
|
|
66
|
+
export {};
|
|
67
|
+
//# sourceMappingURL=history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../src/core/history/history.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAExE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAkBjD,iDAAiD;AACjD,MAAM,WAAW,KAAM,SAAQ,QAAQ;IACrC,mCAAmC;IACnC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,kDAAkD;IAClD,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;IACvC,yEAAyE;IACzE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,cAAe,SAAQ,aAAa;IAC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M,IAAI,CAAC;IACzD,4FAA4F;IAC5F,QAAQ,CAAC,IAAI,EAAE,MAAM,MAAM,IAAI,CAAC;CACjC;AAID,QAAA,MAAM,IAAI,GAAI,CAAC,SAAS,QAAQ,SACvB,CAAC,YACE,cAAc,KACvB,OAAO,CAAC,CAAC,CAAoC,CAAC;AAEjD,mHAAmH;AACnH,QAAA,MAAM,IAAI,GAAI,CAAC,SAAS,QAAQ,SACvB,CAAC,SACD,YAAY,YACT,cAAc,KACvB,OAAO,CAAC,CAAC,CAYX,CAAC;AAoIF;;;GAGG;AACH,QAAA,MAAM,QAAQ,GAAI,CAAC,SAAS,QAAQ,SAC3B,CAAC,YACE,QAAQ,MACd,MAAM,YACA,cAAc,KACvB,OAAO,CAAC,CAAC,CAkBT,CAAC;AAEJ,eAAO,MAAM,OAAO;;;;CAA2B,CAAC;AAEhD,qCAAqC;AACrC,eAAO,MAAM,SAAS,UAAW,MAAM,KAAG,KAAK,IAAI,OAA2B,CAAC"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { restore } from '../snapshot/index.js';
|
|
2
|
+
import { Replay, outcomeOf } from './replay.js';
|
|
3
|
+
import { checkSaved, decodeEntry, encodeEntry } from './saved.js';
|
|
4
|
+
const EMPTY = { entries: [], head: null };
|
|
5
|
+
const make = (actor, options) => open(actor, EMPTY, [], options);
|
|
6
|
+
/** A History saved before, read with the Actor's code as it is now. Throws if `saved` is not a History's shape. */
|
|
7
|
+
const load = (actor, saved, options) => {
|
|
8
|
+
checkSaved(saved);
|
|
9
|
+
const root = actor.definition;
|
|
10
|
+
return open(actor, {
|
|
11
|
+
entries: saved.entries.map((entry) => decodeEntry(root, entry)),
|
|
12
|
+
head: saved.head,
|
|
13
|
+
}, saved.entries, options);
|
|
14
|
+
};
|
|
15
|
+
/** A History of decoded entries, and those already encoded, by position. */
|
|
16
|
+
const open = (actor, from, saved, options = {}) => {
|
|
17
|
+
const root = actor.definition;
|
|
18
|
+
const children = new Map();
|
|
19
|
+
const outcomes = new Map();
|
|
20
|
+
const listeners = new Set();
|
|
21
|
+
let entries = [];
|
|
22
|
+
/** Each entry as saved, encoded once, when first saved or as it was loaded. */
|
|
23
|
+
let encoded = [...saved];
|
|
24
|
+
let replay = Replay.make(root, options.input, options);
|
|
25
|
+
let branches = new Map();
|
|
26
|
+
let head = from.head;
|
|
27
|
+
let state;
|
|
28
|
+
let locks = 0;
|
|
29
|
+
const change = (to) => {
|
|
30
|
+
head = to;
|
|
31
|
+
state = undefined;
|
|
32
|
+
branches = new Map();
|
|
33
|
+
for (const listener of listeners)
|
|
34
|
+
listener();
|
|
35
|
+
};
|
|
36
|
+
const unlocked = (what) => {
|
|
37
|
+
if (locks > 0)
|
|
38
|
+
throw new Error(`[@kestack/kabuki] stop the Runtime before ${what} its History`);
|
|
39
|
+
};
|
|
40
|
+
const add = (entry) => {
|
|
41
|
+
entries.push(entry);
|
|
42
|
+
const siblings = children.get(entry.parent) ?? [];
|
|
43
|
+
children.set(entry.parent, siblings);
|
|
44
|
+
siblings.push(entry);
|
|
45
|
+
return entry;
|
|
46
|
+
};
|
|
47
|
+
from.entries.forEach(add);
|
|
48
|
+
// 1. Append
|
|
49
|
+
const append = (envelope, handled) => {
|
|
50
|
+
const entry = add({ id: entries.length, parent: head, ...envelope });
|
|
51
|
+
outcomes.set(entry.id, handled.outcome);
|
|
52
|
+
replay.remember(entry.id, handled.snapshot);
|
|
53
|
+
change(entry.id);
|
|
54
|
+
return entry;
|
|
55
|
+
};
|
|
56
|
+
// 2. Move
|
|
57
|
+
const moveHead = (to) => {
|
|
58
|
+
unlocked('moving the Head of');
|
|
59
|
+
if (to !== null && !entries[to])
|
|
60
|
+
throw new RangeError(`[@kestack/kabuki] no History entry ${to}`);
|
|
61
|
+
change(to);
|
|
62
|
+
};
|
|
63
|
+
const clear = () => {
|
|
64
|
+
unlocked('clearing');
|
|
65
|
+
entries = [];
|
|
66
|
+
encoded = [];
|
|
67
|
+
children.clear();
|
|
68
|
+
outcomes.clear();
|
|
69
|
+
replay = Replay.make(root, options.input, options);
|
|
70
|
+
change(null);
|
|
71
|
+
};
|
|
72
|
+
// 3. Read
|
|
73
|
+
const branch = (to = head) => {
|
|
74
|
+
const known = branches.get(to);
|
|
75
|
+
if (known)
|
|
76
|
+
return known;
|
|
77
|
+
const path = [];
|
|
78
|
+
for (let at = to; at !== null; at = entries[at].parent)
|
|
79
|
+
path.unshift(entries[at]);
|
|
80
|
+
branches.set(to, path);
|
|
81
|
+
return path;
|
|
82
|
+
};
|
|
83
|
+
const outcome = (id) => {
|
|
84
|
+
const entry = entries[id];
|
|
85
|
+
if (!entry)
|
|
86
|
+
throw new RangeError(`[@kestack/kabuki] no History entry ${id}`);
|
|
87
|
+
const known = outcomes.get(id) ??
|
|
88
|
+
outcomeOf(root, replay.at(branch(entry.parent)), entry);
|
|
89
|
+
outcomes.set(id, known);
|
|
90
|
+
return known;
|
|
91
|
+
};
|
|
92
|
+
// 4. Save
|
|
93
|
+
/** A new array on every change, so one saved before never grows. */
|
|
94
|
+
const save = () => (state ??= {
|
|
95
|
+
entries: Object.freeze(entries.map((entry) => (encoded[entry.id] ??= encodeEntry(root, entry)))),
|
|
96
|
+
head,
|
|
97
|
+
});
|
|
98
|
+
return {
|
|
99
|
+
actor,
|
|
100
|
+
save,
|
|
101
|
+
head: () => head,
|
|
102
|
+
branch,
|
|
103
|
+
children: (of) => children.get(of) ?? [],
|
|
104
|
+
append,
|
|
105
|
+
moveHead,
|
|
106
|
+
clear,
|
|
107
|
+
seek: (entry = head) => replay.seek(branch(entry)),
|
|
108
|
+
snapshotAt: (entry) => replay.at(branch(entry)),
|
|
109
|
+
outcome,
|
|
110
|
+
subscribe: (listener) => {
|
|
111
|
+
listeners.add(listener);
|
|
112
|
+
return () => listeners.delete(listener);
|
|
113
|
+
},
|
|
114
|
+
// Counted, so two Runtimes on one History each hold it until they let go.
|
|
115
|
+
lock: () => {
|
|
116
|
+
locks++;
|
|
117
|
+
let held = true;
|
|
118
|
+
return () => {
|
|
119
|
+
if (held)
|
|
120
|
+
locks--;
|
|
121
|
+
held = false;
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* The lightest History an app can be saved as: right after init, one Restore
|
|
128
|
+
* of `snapshot` at Time `at`. Nothing before it can be travelled to but init.
|
|
129
|
+
*/
|
|
130
|
+
const restored = (actor, snapshot, at, options) => open(actor, {
|
|
131
|
+
entries: [
|
|
132
|
+
{
|
|
133
|
+
id: 0,
|
|
134
|
+
parent: null,
|
|
135
|
+
destination: actor.definition.name,
|
|
136
|
+
message: restore(snapshot),
|
|
137
|
+
source: { kind: 'restore' },
|
|
138
|
+
at,
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
head: 0,
|
|
142
|
+
}, [], options);
|
|
143
|
+
export const History = { make, load, restored };
|
|
144
|
+
/** Tells a History from an Actor. */
|
|
145
|
+
export const isHistory = (value) => 'actor' in value;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/history/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAClD,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAChD,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import type { ActorDefinition } from '../actor/index.ts';
|
|
3
|
+
import type { Envelope, Handled, Snapshot } from '../snapshot/index.ts';
|
|
4
|
+
import type { Entry } from './history.ts';
|
|
5
|
+
export interface ReplayOptions {
|
|
6
|
+
/** Millis of playing between yields to the main thread. Default 8. */
|
|
7
|
+
readonly budget?: number;
|
|
8
|
+
/** Remember a Snapshot every this many entries. Default 100. */
|
|
9
|
+
readonly every?: number;
|
|
10
|
+
}
|
|
11
|
+
/** Snapshots of one app, played from init and remembered, so playing again starts from the nearest one. */
|
|
12
|
+
export interface Replay {
|
|
13
|
+
/** The Snapshot right after the last entry of `branch`, played now. */
|
|
14
|
+
readonly at: (branch: ReadonlyArray<Entry>) => Snapshot;
|
|
15
|
+
/** The same, yielding to the page as it plays, so a long Branch never freezes it. */
|
|
16
|
+
readonly seek: (branch: ReadonlyArray<Entry>) => Effect.Effect<Snapshot>;
|
|
17
|
+
/** Remember the Snapshot right after an entry. */
|
|
18
|
+
readonly remember: (entry: number, snapshot: Snapshot) => void;
|
|
19
|
+
}
|
|
20
|
+
declare const make: (root: ActorDefinition, input: unknown, { budget, every }?: ReplayOptions) => Replay;
|
|
21
|
+
/**
|
|
22
|
+
* What came of an Envelope on this Snapshot: worked out by handling it again,
|
|
23
|
+
* never kept. One that no longer fits the code, which Replay skips, counts as
|
|
24
|
+
* ignored.
|
|
25
|
+
*/
|
|
26
|
+
export declare const outcomeOf: (root: ActorDefinition, snapshot: Snapshot, envelope: Envelope) => Handled['outcome'];
|
|
27
|
+
/** The Snapshot right after a whole Branch, played now from init with the root's Input. */
|
|
28
|
+
declare const fold: (root: ActorDefinition, branch: ReadonlyArray<Entry>, input?: unknown) => Snapshot;
|
|
29
|
+
export declare const Replay: {
|
|
30
|
+
make: typeof make;
|
|
31
|
+
fold: typeof fold;
|
|
32
|
+
};
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=replay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replay.d.ts","sourceRoot":"","sources":["../../../src/core/history/replay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EA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