@statewalker/fsm 0.37.0 → 0.38.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.
@@ -0,0 +1,353 @@
1
+ //#region src/core/fsm-base-class.d.ts
2
+ type Handler<P extends unknown[] = unknown[], R = unknown> = (...args: P) => R;
3
+ /**
4
+ * Shared handler-registry substrate under both `FsmProcess` and `FsmState`.
5
+ *
6
+ * Both the process and every state need the same primitive: keep named lists of
7
+ * callbacks (`onEnter`, `onExit`, `dump`, …) and run them with consistent ordering
8
+ * and error routing. Centralising it here keeps the two subclasses thin and their
9
+ * hook methods one-liners. `handlers` maps a hook name to its ordered callback list;
10
+ * the protected `_addHandler` / `_removeHandler` / `_runHandler` manage and invoke
11
+ * them. Handlers run **sequentially** (awaited in turn); a throwing handler is routed
12
+ * to `_handleError` rather than aborting the batch. Subclasses expose typed sugar
13
+ * (e.g. `state.onEnter(fn)` calls `_addHandler("onEnter", fn)`) and override
14
+ * `_handleError` to forward errors.
15
+ */
16
+ declare class FsmBaseClass {
17
+ handlers: Record<string, Handler[]>;
18
+ /**
19
+ * Register `handler` under `type`; returns a disposer that removes it.
20
+ * `direct=false` prepends instead of appends — used so `onExit` handlers run in
21
+ * reverse (inner-to-outer) unwinding order.
22
+ */
23
+ protected _addHandler<T>(type: string, handler: T, direct?: boolean): () => void;
24
+ protected _removeHandler<T>(type: string, handler: T): void;
25
+ /** Run every handler of `type` in order, awaiting each; route throws to `_handleError`. */
26
+ _runHandler(type: string, ...args: unknown[]): Promise<void>;
27
+ /** Default error sink — logs. `FsmState`/`FsmProcess` override it to fire `onStateError`. */
28
+ _handleError(error: Error | unknown): Promise<void>;
29
+ }
30
+ /**
31
+ * Bind the named methods of `obj` to `obj` in place, so they can be passed as bare
32
+ * callbacks (e.g. `ctx[KEY_DISPATCH] = process.dispatch`) without losing `this`.
33
+ */
34
+ declare function bindMethods<T>(obj: T, ...methods: (string | symbol)[]): T;
35
+ //#endregion
36
+ //#region src/core/fsm-state-config.d.ts
37
+ /** Wildcard `from`-state: a transition that applies in *any* state. */
38
+ declare const STATE_ANY = "*";
39
+ /** Empty `from`-state: the *initial* pseudo-state a parent enters into. */
40
+ declare const STATE_INITIAL = "";
41
+ /** Empty `to`-state: the *final* pseudo-state; entering it exits the parent. */
42
+ declare const STATE_FINAL = "";
43
+ /** Wildcard `event`: a transition triggered by *any* event. */
44
+ declare const EVENT_ANY = "*";
45
+ /** Empty event: the eventless/automatic transition (fires with no named event). */
46
+ declare const EVENT_EMPTY = "";
47
+ type FsmStateKey = string;
48
+ type FsmEventKey = string;
49
+ /**
50
+ * Declarative definition of a (possibly nested) state machine.
51
+ *
52
+ * One plain-object shape describes an entire HFSM, so machines stay serializable,
53
+ * diffable, and inspectable by tooling — the config is data, not code. A config has:
54
+ * - `key` — the state's name (unique among its siblings);
55
+ * - `transitions` — `[from, event, to]` tuples, where `from`/`to` name sibling
56
+ * states, `""` is the initial (`from`) or final (`to`) pseudo-state, and `"*"` is a
57
+ * wildcard (see the constants above);
58
+ * - `states` — nested child configs; entering this state descends into its initial
59
+ * child. The index signature lets consumers attach arbitrary metadata.
60
+ *
61
+ * Pass a config to `new FsmProcess(config)` or `startProcess(ctx, config, …)`; it is
62
+ * compiled once into an `FsmStateDescriptor` for fast lookup at runtime.
63
+ */
64
+ type FsmStateConfig = {
65
+ key: FsmStateKey;
66
+ transitions?: [from: FsmStateKey, event: FsmEventKey, to: FsmStateKey][];
67
+ states?: FsmStateConfig[];
68
+ } & Record<string, unknown>;
69
+ //#endregion
70
+ //#region src/core/fsm-state-descriptor.d.ts
71
+ /**
72
+ * The *compiled* form of an `FsmStateConfig` subtree.
73
+ *
74
+ * Resolving a transition happens on every event, so the flat `[from, event, to]`
75
+ * tuple list is pre-indexed once into nested maps for O(1) lookup, and the
76
+ * wildcard-fallback order is applied here rather than re-derived on each dispatch.
77
+ * The shape is `transitions[from][event] = to` plus a `states` map of child
78
+ * descriptors. `FsmProcess` builds one from your config in its constructor; you
79
+ * rarely construct a descriptor directly.
80
+ */
81
+ declare class FsmStateDescriptor {
82
+ transitions: Record<string, Record<string, string>>;
83
+ states: Record<string, FsmStateDescriptor>;
84
+ /**
85
+ * Recursively compile a config (and its nested `states`) into descriptors,
86
+ * turning the tuple list into the indexed `transitions` map.
87
+ */
88
+ static build(config: FsmStateConfig): FsmStateDescriptor;
89
+ /**
90
+ * Resolve the target state for a `(stateKey, eventKey)` pair. Tries the most
91
+ * specific match first, then falls back through the wildcards —
92
+ * `(state, event)` → `(*, event)` → `(state, *)` → `(*, *)` — and returns
93
+ * `STATE_FINAL` if nothing matches, so an unmatched event exits the state rather
94
+ * than silently doing nothing.
95
+ */
96
+ getTargetStateKey(stateKey: string, eventKey: string): string;
97
+ }
98
+ //#endregion
99
+ //#region src/core/fsm-state.d.ts
100
+ /** Serialized form of a single state: its `key` plus the `data` bag its `dump` hooks filled. */
101
+ type FsmStateDump = Record<string, unknown> & {
102
+ key: string;
103
+ data: Record<string, unknown>;
104
+ };
105
+ /** An `onEnter` / `onExit` callback; receives the state it fired on. */
106
+ type FsmStateHandler = (state: FsmState, ...args: unknown[]) => void | Promise<void>;
107
+ /** A `dump` / `restore` callback; reads or fills the mutable per-state `data` bag. */
108
+ type FsmStateDumpHandler = (state: FsmState, dump: FsmStateDump) => void | Promise<void>;
109
+ /** An `onStateError` callback; receives the error thrown by another handler on this state. */
110
+ type FsmStateErrorHandler = (state: FsmState, error: unknown) => void | Promise<void>;
111
+ /**
112
+ * One live node in a running machine's active-state stack.
113
+ *
114
+ * A state needs a place to attach behaviour and record data while it is active.
115
+ * `FsmState` is that handle — created by the engine each time a state is entered,
116
+ * discarded when it exits — so handlers can capture per-activation closures instead
117
+ * of sharing mutable machine-wide state. It offers lifecycle hooks `onEnter` /
118
+ * `onExit` / `onStateError`, serialization hooks `dump` / `restore`, and the tree
119
+ * links `key` / `parent` / `descriptor`; every hook method returns a disposer.
120
+ * Attach hooks from within `FsmProcess.onStateCreate((state) => …)`, or let
121
+ * `startProcess` install them for you from a `load` callback.
122
+ */
123
+ declare class FsmState extends FsmBaseClass {
124
+ process: FsmProcess;
125
+ key: string;
126
+ parent?: FsmState;
127
+ descriptor?: FsmStateDescriptor;
128
+ constructor(process: FsmProcess, parent: FsmState | undefined, key: string, descriptor?: FsmStateDescriptor);
129
+ /** Run when this state is entered. */
130
+ onEnter(handler: FsmStateHandler): () => void;
131
+ /** Run when this state exits — registered inner-first so unwinding is inner-to-outer. */
132
+ onExit(handler: FsmStateHandler): () => void;
133
+ /** Handle an error thrown by another handler on this state (also bubbles to the process). */
134
+ onStateError(handler: FsmStateErrorHandler): () => void;
135
+ /** Contribute to this state's snapshot: fill `dump.data` when the process is dumped. */
136
+ dump(handler: FsmStateDumpHandler): () => void;
137
+ /** Rehydrate from this state's snapshot: read `dump.data` when the process is restored. */
138
+ restore(handler: FsmStateDumpHandler): () => void;
139
+ _handleError(error: Error | unknown): Promise<void>;
140
+ }
141
+ //#endregion
142
+ //#region src/core/fsm-process.d.ts
143
+ /** Not started / no current transition. */
144
+ declare const STATUS_NONE = 0;
145
+ /** Entering: descended into a parent's first (initial) child. */
146
+ declare const STATUS_FIRST = 1;
147
+ /** Entering: advanced to a resolved target (sibling) state. */
148
+ declare const STATUS_NEXT = 2;
149
+ /** Rested on a leaf — dispatch returns control here (the default `mask`). */
150
+ declare const STATUS_LEAF = 4;
151
+ /** Exiting: popped back up to the parent state. */
152
+ declare const STATUS_LAST = 8;
153
+ /** Terminated: the machine has exited its root and cannot advance further. */
154
+ declare const STATUS_FINISHED = 16;
155
+ /** Composite: any "entering" phase. */
156
+ declare const STATUS_ENTER: number;
157
+ /** Composite: any "exiting" phase. */
158
+ declare const STATUS_EXIT: number;
159
+ /** A process-level handler (`onStateCreate` / `onStateError`). */
160
+ type FsmProcessHandler = (process: FsmProcess, ...args: unknown[]) => void | Promise<void>;
161
+ /** Serialized form of the whole machine: status, last event, and the root→leaf state stack. */
162
+ type FsmProcessDump = Record<string, unknown> & {
163
+ status: number;
164
+ event?: string;
165
+ stack: FsmStateDump[];
166
+ };
167
+ type FsmProcessDumpHandler = (process: FsmProcess, dump: FsmProcessDump) => void | Promise<void>;
168
+ /**
169
+ * The running state machine — owner of the active-state stack and the traversal.
170
+ *
171
+ * This is the engine: given a compiled config it drives the enter/exit walk in
172
+ * response to events, so callers reason in terms of states and events, not manual
173
+ * stack bookkeeping. `dispatch(event)` advances the machine to the next resting leaf;
174
+ * `shutdown(event?)` unwinds every active state; `state` is the current leaf;
175
+ * `onStateCreate(handler)` is the primary extension point (fires once per created
176
+ * state — attach that state's hooks there); and `dump()` / `restore(dump)` snapshot
177
+ * and rehydrate the whole stack. Typical use: `new FsmProcess(config)`, register
178
+ * `onStateCreate`, then `dispatch("")` to enter the initial state and
179
+ * `dispatch(event)` for each subsequent event.
180
+ */
181
+ declare class FsmProcess extends FsmBaseClass {
182
+ state?: FsmState;
183
+ event?: string;
184
+ nextEvent?: string;
185
+ running: boolean;
186
+ mask: number;
187
+ status: number;
188
+ config: FsmStateConfig;
189
+ rootDescriptor: FsmStateDescriptor;
190
+ constructor(config: FsmStateConfig);
191
+ /** Force-exit the whole stack (root last), running each state's `onExit`; ends the machine. */
192
+ shutdown(event?: string): Promise<void>;
193
+ /**
194
+ * Feed an event to the machine and run the enter/exit cycle until it rests on a
195
+ * leaf (`status & mask`) or finishes.
196
+ *
197
+ * If a dispatch is already running (e.g. an `onEnter` handler dispatches
198
+ * synchronously), the event is queued in `nextEvent` and applied when the current
199
+ * run settles — runs never nest. Returns `false` once the machine has finished,
200
+ * `true` otherwise.
201
+ */
202
+ dispatch(event: string): Promise<boolean>;
203
+ /**
204
+ * Snapshot the machine to a plain object: `{ status, event, stack }` where the
205
+ * stack is root→leaf, each entry carrying whatever its `dump` hooks recorded.
206
+ */
207
+ dump(...args: unknown[]): Promise<FsmProcessDump>;
208
+ /**
209
+ * Rebuild the machine from a `dump`: recreate each state in the stack (firing
210
+ * `onStateCreate`) and replay its `restore` hooks, leaving the process resumable
211
+ * from where it was snapshotted.
212
+ */
213
+ restore(dump: FsmProcessDump, ...args: unknown[]): Promise<this>;
214
+ /** Primary extension point: fires once for every state the machine creates. */
215
+ onStateCreate(handler: FsmStateHandler): () => void;
216
+ onStateError(handler: (state: FsmState, error: unknown) => void | Promise<void>): () => void;
217
+ _handleStateError(state: FsmState, error: Error | unknown): Promise<void>;
218
+ _newState(parent: FsmState | undefined, key: string, descriptor: FsmStateDescriptor | undefined): Promise<FsmState>;
219
+ _getSubstate(parent: FsmState | undefined, prevStateKey: string | undefined): Promise<FsmState | undefined>;
220
+ _newSubstate(parent: FsmState | undefined, toState: string): Promise<FsmState>;
221
+ /**
222
+ * One step of the traversal: compute the next state and update `status`.
223
+ *
224
+ * Either descends to a child / advances to a resolved target (setting an ENTER
225
+ * status), or — when no target resolves — settles on the current leaf
226
+ * (`STATUS_LEAF`) or pops to the parent (`STATUS_LAST`), reaching `STATUS_FINISHED`
227
+ * once the root is exited. Returns `false` when finished.
228
+ */
229
+ _update(): Promise<boolean>;
230
+ }
231
+ //#endregion
232
+ //#region src/core/fsm-transitions.d.ts
233
+ /**
234
+ * List the transitions currently reachable from `state` — for a UI or viewer that
235
+ * needs to know which events can fire right now (e.g. to render only the enabled
236
+ * buttons). Collects `[from, event, to]` tuples by walking up the parent chain; the
237
+ * nearest state's rule for an event wins, so an outer fallback is masked by an inner
238
+ * override. The returned tuples are ordered outer→inner (root first).
239
+ */
240
+ declare function getStateTransitions(state?: FsmState): [from: string, event: string, to: string][];
241
+ /**
242
+ * Guard: would `event` trigger any transition in the process's current state? Used
243
+ * to avoid dispatching dead events — the runner calls it before `dispatch`, and
244
+ * consumers use it to enable/disable controls. Returns `true` iff `event` appears
245
+ * among `getStateTransitions(process.state)`.
246
+ */
247
+ declare function isStateTransitionEnabled(process: FsmProcess, event: string): boolean;
248
+ //#endregion
249
+ //#region src/start-process.d.ts
250
+ /**
251
+ * Per-state behaviour contract used by `startProcess`. One function shape expresses
252
+ * what to do while in a state, and its *return value* wires up the rest, so a state's
253
+ * setup and teardown live together. The handler runs on entry with the shared
254
+ * `context` and may return:
255
+ * - nothing — no teardown;
256
+ * - a cleanup `function` — registered as this state's `onExit`;
257
+ * - an async/sync generator — run concurrently, each yielded string dispatched back
258
+ * into the machine (self-driving/reactive states), auto-`return()`ed on exit.
259
+ */
260
+ type StageHandler<C = Record<string, unknown>> = (context: C) => void | (() => void | Promise<void>) | Promise<void | (() => void | Promise<void>)> | AsyncGenerator<string, void, unknown> | Generator<string, void, unknown>;
261
+ /**
262
+ * The caller's remote control returned by `startProcess`: stop the machine and
263
+ * snapshot/rehydrate it without holding a reference to the underlying `FsmProcess`.
264
+ */
265
+ interface ProcessHandle {
266
+ shutdown(): Promise<void>;
267
+ dump(...args: unknown[]): Promise<FsmProcessDump>;
268
+ restore(dump: FsmProcessDump, ...args: unknown[]): Promise<void>;
269
+ }
270
+ /** Context key: `(event) => Promise<void>` that dispatches an event (guarded). */
271
+ declare const KEY_DISPATCH = "fsm:dispatch";
272
+ /** Context key: `() => Promise<void>` that shuts the machine down. */
273
+ declare const KEY_TERMINATE = "fsm:terminate";
274
+ /** Context key: the current state-key stack (root→leaf), refreshed on every transition. */
275
+ declare const KEY_STATES = "fsm:states";
276
+ /** Context key: the last dispatched event. */
277
+ declare const KEY_EVENT = "fsm:event";
278
+ /**
279
+ * Ergonomic runner: build a machine, attach behaviour via one `load` callback, and
280
+ * bind the machine into `context`.
281
+ *
282
+ * Doing this by hand (`new FsmProcess` + `onStateCreate` + `onEnter` + a loader +
283
+ * context wiring) is boilerplate every consumer repeats, so `startProcess` does it
284
+ * once — most callers use this instead of the raw engine. It creates the process; on
285
+ * each state entry calls `load(stateKey, event)` and installs the returned
286
+ * `StageHandler`s (their return values become `onExit` cleanups or event-yielding
287
+ * generators — see `StageHandler`); binds `KEY_DISPATCH` / `KEY_TERMINATE` /
288
+ * `KEY_STATES` / `KEY_EVENT` into `context`; dispatches `startEvent` to enter the
289
+ * initial state; and returns a `ProcessHandle`.
290
+ *
291
+ * @param context shared object handlers read/write and the machine is bound into
292
+ * @param config the declarative machine definition
293
+ * @param load returns the handler(s) to run for a given `(stateKey, event)`
294
+ * @param startEvent initial event (default `""`, the eventless start)
295
+ */
296
+ declare function startProcess<C = unknown>(context: C, config: FsmStateConfig, load: (state: string, event: string | undefined) => StageHandler<C>[] | Promise<StageHandler<C>[]>, startEvent?: string): Promise<ProcessHandle>;
297
+ /** Permanent equal alias of {@link startProcess} — the name existing consumers import. */
298
+ declare const startFsmProcess: typeof startProcess;
299
+ //#endregion
300
+ //#region src/trace/printer.d.ts
301
+ /** A sink for trace output — anything shaped like `console.log`. */
302
+ type Printer = (...args: unknown[]) => void;
303
+ /**
304
+ * Tuning for a `Printer`.
305
+ * - `prefix` — string prepended to every line (e.g. a process tag).
306
+ * - `print` — the underlying sink (defaults to `console.log`).
307
+ * - `lineNumbers` — prepend an incrementing `[n]` counter.
308
+ */
309
+ type PrinterConfig = {
310
+ prefix?: string;
311
+ print?: (...args: unknown[]) => void;
312
+ lineNumbers?: boolean;
313
+ };
314
+ /**
315
+ * Build a `Printer` bound to `process` that indents each line by the current state
316
+ * nesting depth (two spaces per level), so log output visually mirrors the state
317
+ * tree — hierarchical indentation makes enter/exit traces readable at a glance.
318
+ */
319
+ declare function preparePrinter(process: FsmProcess, {
320
+ prefix,
321
+ print,
322
+ lineNumbers
323
+ }: PrinterConfig): Printer;
324
+ /**
325
+ * Attach a printer to `process` (stored in a weak map so it is GC'd with the
326
+ * process). Handlers/tracers then reach it via {@link getProcessPrinter} /
327
+ * {@link getPrinter} rather than threading a logger through every call.
328
+ */
329
+ declare function setProcessPrinter(process: FsmProcess, config?: PrinterConfig): void;
330
+ /** The printer attached to `process`, or `console.log` if none was set. */
331
+ declare function getProcessPrinter(process: FsmProcess): Printer;
332
+ /** The printer for a state — its own if set, else its process's (see {@link getProcessPrinter}). */
333
+ declare function getPrinter(state: {
334
+ process: FsmProcess;
335
+ }): Printer;
336
+ //#endregion
337
+ //#region src/trace/tracer.d.ts
338
+ /**
339
+ * Trace every state of `process`: as each state is created, attach a state tracer —
340
+ * so you can watch the machine move as a readable stream of enter/exit markers
341
+ * without editing any handler. Hooks `onStateCreate` and delegates to
342
+ * {@link setStateTracer}; pass a `print` sink to override the process printer.
343
+ */
344
+ declare function setProcessTracer(process: FsmProcess, print?: Printer): () => void;
345
+ /**
346
+ * Trace one state's lifecycle: emit `<key event="…">` on enter and `</key>` on exit
347
+ * (XML-like, so nested states read as nested tags). Falls back to the state's
348
+ * printer ({@link getPrinter}) when no `print` sink is given.
349
+ */
350
+ declare function setStateTracer(state: FsmState, print?: Printer): void;
351
+ //#endregion
352
+ export { EVENT_ANY, EVENT_EMPTY, FsmBaseClass, FsmEventKey, FsmProcess, FsmProcessDump, FsmProcessDumpHandler, FsmProcessHandler, FsmState, FsmStateConfig, FsmStateDescriptor, FsmStateDump, FsmStateDumpHandler, FsmStateErrorHandler, FsmStateHandler, FsmStateKey, KEY_DISPATCH, KEY_EVENT, KEY_STATES, KEY_TERMINATE, Printer, PrinterConfig, ProcessHandle, STATE_ANY, STATE_FINAL, STATE_INITIAL, STATUS_ENTER, STATUS_EXIT, STATUS_FINISHED, STATUS_FIRST, STATUS_LAST, STATUS_LEAF, STATUS_NEXT, STATUS_NONE, StageHandler, bindMethods, getPrinter, getProcessPrinter, getStateTransitions, isStateTransitionEnabled, preparePrinter, setProcessPrinter, setProcessTracer, setStateTracer, startFsmProcess, startProcess };
353
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/core/fsm-base-class.ts","../src/core/fsm-state-config.ts","../src/core/fsm-state-descriptor.ts","../src/core/fsm-state.ts","../src/core/fsm-process.ts","../src/core/fsm-transitions.ts","../src/start-process.ts","../src/trace/printer.ts","../src/trace/tracer.ts"],"mappings":";KAAK,OAAA,qDAA4D,IAAA,EAAM,CAAA,KAAM,CAAA;;;;;;;;;;;;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