@datamoc/mw_games 0.26.1 → 0.27.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 (66) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/api-surface.json +474 -0
  3. package/dist/ai/Suggest.d.ts +54 -0
  4. package/dist/ai/Suggest.d.ts.map +1 -0
  5. package/dist/ai/Suggest.js +48 -0
  6. package/dist/ai/Suggest.js.map +1 -0
  7. package/dist/ai/index.d.ts +2 -0
  8. package/dist/ai/index.d.ts.map +1 -1
  9. package/dist/ai/index.js +1 -0
  10. package/dist/ai/index.js.map +1 -1
  11. package/dist/core/Random.d.ts +32 -5
  12. package/dist/core/Random.d.ts.map +1 -1
  13. package/dist/core/Random.js.map +1 -1
  14. package/dist/core/Replay.d.ts +28 -4
  15. package/dist/core/Replay.d.ts.map +1 -1
  16. package/dist/core/Replay.js +38 -9
  17. package/dist/core/Replay.js.map +1 -1
  18. package/dist/core/ReplayFile.d.ts +197 -0
  19. package/dist/core/ReplayFile.d.ts.map +1 -0
  20. package/dist/core/ReplayFile.js +257 -0
  21. package/dist/core/ReplayFile.js.map +1 -0
  22. package/dist/core/index.d.ts +4 -2
  23. package/dist/core/index.d.ts.map +1 -1
  24. package/dist/core/index.js +2 -1
  25. package/dist/core/index.js.map +1 -1
  26. package/dist/mw_games.global.js +113 -113
  27. package/dist/simulation/Training.d.ts +77 -0
  28. package/dist/simulation/Training.d.ts.map +1 -1
  29. package/dist/simulation/Training.js +87 -0
  30. package/dist/simulation/Training.js.map +1 -1
  31. package/dist/simulation/index.d.ts +2 -2
  32. package/dist/simulation/index.d.ts.map +1 -1
  33. package/dist/simulation/index.js +1 -1
  34. package/dist/simulation/index.js.map +1 -1
  35. package/dist/two-d/render/Beam.d.ts +93 -0
  36. package/dist/two-d/render/Beam.d.ts.map +1 -0
  37. package/dist/two-d/render/Beam.js +154 -0
  38. package/dist/two-d/render/Beam.js.map +1 -0
  39. package/dist/two-d/render/Flights.d.ts +79 -0
  40. package/dist/two-d/render/Flights.d.ts.map +1 -0
  41. package/dist/two-d/render/Flights.js +120 -0
  42. package/dist/two-d/render/Flights.js.map +1 -0
  43. package/dist/two-d/render/Particles.d.ts +48 -0
  44. package/dist/two-d/render/Particles.d.ts.map +1 -1
  45. package/dist/two-d/render/Particles.js +59 -1
  46. package/dist/two-d/render/Particles.js.map +1 -1
  47. package/dist/two-d/render/index.d.ts +5 -1
  48. package/dist/two-d/render/index.d.ts.map +1 -1
  49. package/dist/two-d/render/index.js +2 -0
  50. package/dist/two-d/render/index.js.map +1 -1
  51. package/dist/two-d/ui/MessageLog.d.ts +28 -0
  52. package/dist/two-d/ui/MessageLog.d.ts.map +1 -1
  53. package/dist/two-d/ui/MessageLog.js +23 -6
  54. package/dist/two-d/ui/MessageLog.js.map +1 -1
  55. package/dist/two-d/ui/TextPrompt.d.ts +115 -0
  56. package/dist/two-d/ui/TextPrompt.d.ts.map +1 -0
  57. package/dist/two-d/ui/TextPrompt.js +227 -0
  58. package/dist/two-d/ui/TextPrompt.js.map +1 -0
  59. package/dist/two-d/ui/index.d.ts +4 -2
  60. package/dist/two-d/ui/index.d.ts.map +1 -1
  61. package/dist/two-d/ui/index.js +2 -1
  62. package/dist/two-d/ui/index.js.map +1 -1
  63. package/dist/version.d.ts +1 -1
  64. package/dist/version.js +1 -1
  65. package/package.json +1 -1
  66. package/sbom.cdx.json +6 -6
package/CHANGELOG.md CHANGED
@@ -7,6 +7,83 @@ the public API may still change between minor versions.
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.27.0] - 2026-10-07
11
+
12
+ Two strands in one release. A run is durable and drives the AI (roadmap 396-397): the
13
+ versioned replay envelope refuses another game or framework build by name, `LastRun` keeps
14
+ the newest recording, `runCheckpoint`/`resumeRunPlayer` restore a run mid-run, and the
15
+ `file://` plumbing (download, picker, Blob read) ships with it; `imitationFromReplay` turns
16
+ a recorded run into training samples against its own seeded environment, `runSeededEpisode`
17
+ plays a whole run from a named seed behind any deterministic chooser, and `ai.Suggester`
18
+ is the throttled, non-mutating hint source. The render and UI strand: `Flights` owns live
19
+ projectile flights, `Beam`/`Beams` draw one-shot beams, `TextPrompt` asks for one line with
20
+ IME and screen-reader support, `MessageLog.lastEntries` reads retained entries back, and
21
+ `ParticleEmitter.attach` follows a target; `core.FloatSource` narrows the injectable random
22
+ stream for float-only helpers.
23
+
24
+ ### Added
25
+
26
+ - `core.FloatSource` splits `core.RandomSource`: helpers that draw floats only
27
+ (`float`, `chance`, `weighted`, `weightedKey`) accept the narrower
28
+ `{ float(): number }`, so a float-only stream needs no dead `int`. The
29
+ integer helpers (`int`, `range`, `normalRange`, `element`, `shuffle`) keep
30
+ requiring the full source; `element` stays wide deliberately, because it
31
+ draws through `int()` and re-spelling that draw would change its stream.
32
+
33
+ - `MessageLog.lastEntries(n)` reads the newest retained entries back as plain
34
+ `{ text, level }` records, oldest first, without scraping rendered children:
35
+ entries the wrapped-line budget already dropped are gone, over-count reads
36
+ everything retained, and zero or negative reads nothing. The slice lives in
37
+ the pure `takeLastEntries` beside the existing `linesToDrop` budget, so the
38
+ readback contract is testable without a renderer.
39
+
40
+ - `ParticleEmitter.attach(target)` follows a display object or position thunk on
41
+ every update tick and every `burst()`, with `offsetX`/`offsetY`, an `enabled`
42
+ callback gating tick emission, and auto-detach for destroyed targets;
43
+ `detach()` keeps the last position. The follow math is tested headless through
44
+ textureless emitters.
45
+
46
+ - `Flights` owns a scene's live projectile flights over the existing `Projectile`:
47
+ `add(sprite | texture, from, to, { speed, tint?, spin?, fadeIn?, onArrive? })`
48
+ returns a handle, `update(dt)` drives positions with per-flight spin and fade,
49
+ each arrival dispatches once after leaving the list, and `cancel()`/`clear()`
50
+ forget without dispatching. Caller sprites stay caller-owned; texture-built
51
+ sprites are parented here and destroyed with their flight.
52
+
53
+ - `Beam`/`Beams` draw one-shot beams between two screen points: a fading line by
54
+ default, a fading repeating texture strip with `texture`, additive blend unless
55
+ opted out, `retarget` for tracking endpoints, and `update` reporting expiry
56
+ exactly once so the `Beams` group can remove finished beams itself.
57
+
58
+ - `TextPrompt` asks for one line of text over a `TextModel`: typing through
59
+ `onText` (the newest open prompt wins), caret and edits through
60
+ `left`/`right`/`backspace`/`delete` actions, `confirm` gated by `validate` and
61
+ `cancel` giving up. IME compositions preview until they commit, and the
62
+ message plus validation errors announce through `screenReader` (assertive for
63
+ the errors), with an injectable announcer for tests.
64
+
65
+ - A run is durable now (roadmap 396): `exportReplayFile`/`importReplayFile` wrap a
66
+ recording in a versioned, self-describing envelope that refuses another game or
67
+ framework build by name, `LastRun` keeps the newest recording (one deep, bounded,
68
+ over the same storage a save slot uses), and `runCheckpoint`/`resumeRunPlayer`
69
+ pair the partial recording with the saved state so a restored run resumes mid-run
70
+ instead of restarting - `Recorder` and `Player` both take `fromFrame`, and
71
+ `parseReplayEvents` factors out the half of `deserializeReplay`'s check that
72
+ validates an already-parsed array. The `file://` plumbing rides along:
73
+ `downloadReplayFile` (a Blob download, never `fetch()`), `pickReplayFile`
74
+ (the file picker, null on cancel) and `readReplayFile` (any `Blob`, headless
75
+ Node included).
76
+
77
+ - Replays train and drive the AI (roadmap 397): `imitationFromReplay` walks a
78
+ recorded run against the same seeded `TrainingEnvironment` it was played on and
79
+ returns the `(observation, action)` samples a game's own trainer fits;
80
+ `runSeededEpisode` plays a whole run with any deterministic chooser (a heuristic,
81
+ a `NeuralPolicy`'s argmax, not just a `NeuralModel` like `runRollouts`) from a
82
+ named seed, recording every chosen action so runs compare across builds and
83
+ policies; and `ai.Suggester` is the in-game suggestion mode, the same decision
84
+ call pointed at a hint UI instead of the world, throttled by a frame-count budget
85
+ and never mutating state to compute a hint.
86
+
10
87
  ## [0.26.1] - 2026-10-07
11
88
 
12
89
  The 0.26.0 follow-up: its Chrome end-to-end test failed on every CI run, so the