aifsmjs 0.5.6 → 0.5.8

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/llms.txt CHANGED
@@ -1,37 +1,10 @@
1
1
  # aifsmjs
2
2
 
3
- > A small, strict FSM (finite state machine) library built for web game development. The lifecycle is a pure `step()` function with a fixed `guards → exit → action → entry` order. Chain-of-Responsibility intuition is reserved for cross-cutting concerns (observe / persist / replay), never for the transition core. Browser / Node / Flutter WebView friendly. Zero production dependencies; `fast-check` is an optional peer for the built-in property-based testing adapter.
4
-
5
- Primary audience: developers building browser-based games and interactive web experiences on PixiJS, Svelte 5 runes, plain Canvas, or WebGL. Typical use cases include scene flow (`loading → menu → playing → result`), character AI state, interactive UI flows, tutorial steps, and turn-based logic.
6
-
7
- Key guarantees: pure `step()` is deterministic and replayable; runtime exposes `dispose()`, `reset()`, and an `AbortSignal` that is threaded to every `EffectHandler`; named errors (`RuntimeDisposedError`, `UnknownGuardError`, `UnknownActionError`, `InvalidDefinitionError`) instead of bare throws; subpath exports with `sideEffects: false`; core gzip ~2.87 KB.
8
-
9
- ## Documentation
10
-
11
- - [README.md](README.md): canonical English README — full overview, Mental Model, Core API, Opt-in modules (guards / effects / inspect / replay / pbt / timer), Lifecycle Protocol, Lifecycle Invariants, AI-Agent Reading Guide, Testing Strategy, Comparison, Roadmap.
12
- - [README_ZHTW.md](README_ZHTW.md): Traditional Chinese mirror of the canonical README.
13
- - [CHANGELOG.md](CHANGELOG.md): Keep a Changelog format; v0.1.0 entry covers core + every opt-in plus CI guarantees.
14
- - [CONTRIBUTING.md](CONTRIBUTING.md): quick-start commands, what gets in easily vs needs discussion, design principles, commit & PR style.
15
- - [llms-full.txt](llms-full.txt): the canonical README plus CHANGELOG, CONTRIBUTING, examples README, and public type signatures concatenated into one file — load this when an AI agent needs the full context in a single fetch.
16
-
17
- ## Source layout
18
-
19
- - [src/index.ts](src/index.ts): main barrel — re-exports the `fsm/` core module.
20
- - [src/fsm/](src/fsm/): pure core — `definition.ts` (defineMachine / setup), `runtime.ts` (createRuntime with dispose / reset / signal), `lifecycle.ts` (the pure `step()`), `snapshot.ts`, `evaluator.ts`, `resolver.ts`, `updater.ts` (assign / mergeContext), `types.ts` (every public type collected in one file for AI consumption).
21
- - [src/guards/](src/guards/): `and`, `or`, `not`, `stateIn` higher-order combinators. Subpath import: `aifsmjs/guards`.
22
- - [src/effects/](src/effects/): `Enqueuer`, `createEnqueuer`, `runEffects` dispatcher with optional `AbortSignal`. Subpath: `aifsmjs/effects`.
23
- - [src/inspect/](src/inspect/): Koa-style read-only middleware — `logger`, `persist`, `recorder`. Subpath: `aifsmjs/inspect`.
24
- - [src/replay/](src/replay/): `replay(initial, log, def, impl)` pure event-log fold. Subpath: `aifsmjs/replay`.
25
- - [src/pbt/](src/pbt/): `commandsFromMachine` + 6 generic property tests + `assertAll`. Subpath: `aifsmjs/pbt`. Requires `fast-check` as an optional peer.
26
- - [src/timer/](src/timer/): cancellable `after(ms, fn, { signal })` and `createScheduler`. Subpath: `aifsmjs/timer`.
27
-
28
- ## Examples
29
-
30
- - [examples/01-traffic-light/index.ts](examples/01-traffic-light/index.ts): minimal `setup → defineMachine → createRuntime → send` loop with `assign` and a snapshot subscriber. Maps to a cyclic scene-flow pattern in a web game.
31
- - [examples/02-approval-workflow/index.ts](examples/02-approval-workflow/index.ts): multi-candidate guarded transitions with `and([...])`, effects + handlers, `persist` and `recorder` middleware, plus `replay()` to reproduce the final snapshot. Maps to turn-based logic with branching outcomes and post-mortem replay.
32
-
33
- ## Quality gates
34
-
35
- - [.github/workflows/ci.yml](.github/workflows/ci.yml): Node 20 + 22 matrix on Ubuntu; runs typecheck, lint (biome), coverage (vitest + @vitest/coverage-v8 with 100/100/100/90 thresholds), build (tsup multi-entry → ESM + CJS + .d.ts), exports verification, and size budget check.
36
- - [scripts/check-size.mjs](scripts/check-size.mjs): per-subpath gzip budget enforcement (core ≤3 KB, replay ≤1.6 KB, pbt ≤4.5 KB, others ≤1 KB).
37
- - [scripts/verify-exports.mjs](scripts/verify-exports.mjs): asserts every `package.json#exports` entry resolves to a real file in `dist/`.
3
+ Deterministic FSM toolkit with plain-data definitions, pure step(), runtime effects, replay, PBT, and timers.
4
+
5
+ - Start: README.md
6
+ - Stability: STABILITY.md
7
+ - Current backlog: REVIEW.md
8
+ - Examples: examples/README.md
9
+ - Changelog: CHANGELOG.md
10
+ - Full generated context: llms-full.txt
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aifsmjs",
3
- "version": "0.5.6",
3
+ "version": "0.5.8",
4
4
  "description": "Small, strict FSM library for deterministic, replayable state machines in any TypeScript/JS app — multi-step forms, checkout funnels, auth flows, tutorials, scene flow. Pure step() lifecycle, opt-in effects, inspect, replay, and a fast-check property-based testing adapter. Browser / Node / Bun / Deno / WebView / Worker friendly.",
5
5
  "keywords": [
6
6
  "fsm",