@typeonce/ritmo-devtools 0.14.0 → 0.16.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 (109) hide show
  1. package/CHANGELOG.md +283 -0
  2. package/README.md +303 -55
  3. package/dist/Desync.d.ts +23 -3
  4. package/dist/Desync.d.ts.map +1 -1
  5. package/dist/Desync.js +17 -15
  6. package/dist/Desync.js.map +1 -1
  7. package/dist/Determinism.d.ts +20 -6
  8. package/dist/Determinism.d.ts.map +1 -1
  9. package/dist/Determinism.js +11 -3
  10. package/dist/Determinism.js.map +1 -1
  11. package/dist/Format.d.ts +43 -8
  12. package/dist/Format.d.ts.map +1 -1
  13. package/dist/Format.js +66 -31
  14. package/dist/Format.js.map +1 -1
  15. package/dist/Fuzz.d.ts +275 -0
  16. package/dist/Fuzz.d.ts.map +1 -0
  17. package/dist/Fuzz.js +362 -0
  18. package/dist/Fuzz.js.map +1 -0
  19. package/dist/Invariant.d.ts +9 -2
  20. package/dist/Invariant.d.ts.map +1 -1
  21. package/dist/Invariant.js.map +1 -1
  22. package/dist/Lint.d.ts +11 -5
  23. package/dist/Lint.d.ts.map +1 -1
  24. package/dist/Lint.js.map +1 -1
  25. package/dist/PlaywrightEngine.d.ts +29 -0
  26. package/dist/PlaywrightEngine.d.ts.map +1 -0
  27. package/dist/PlaywrightEngine.js +196 -0
  28. package/dist/PlaywrightEngine.js.map +1 -0
  29. package/dist/Replay.d.ts +47 -23
  30. package/dist/Replay.d.ts.map +1 -1
  31. package/dist/Replay.js +26 -30
  32. package/dist/Replay.js.map +1 -1
  33. package/dist/ReplayNodeSink.d.ts.map +1 -1
  34. package/dist/ReplayNodeSink.js +4 -1
  35. package/dist/ReplayNodeSink.js.map +1 -1
  36. package/dist/ReplayVitePlugin.d.ts +1 -0
  37. package/dist/ReplayVitePlugin.d.ts.map +1 -1
  38. package/dist/ReplayVitePlugin.js.map +1 -1
  39. package/dist/Session.d.ts +224 -18
  40. package/dist/Session.d.ts.map +1 -1
  41. package/dist/Session.js +571 -58
  42. package/dist/Session.js.map +1 -1
  43. package/dist/Verify.d.ts +150 -0
  44. package/dist/Verify.d.ts.map +1 -0
  45. package/dist/Verify.js +154 -0
  46. package/dist/Verify.js.map +1 -0
  47. package/dist/cli.js +157 -16
  48. package/dist/cli.js.map +1 -1
  49. package/dist/index.d.ts +3 -2
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +3 -2
  52. package/dist/index.js.map +1 -1
  53. package/dist/internal/dependencyScan.d.ts +44 -0
  54. package/dist/internal/dependencyScan.d.ts.map +1 -0
  55. package/dist/internal/dependencyScan.js +313 -0
  56. package/dist/internal/dependencyScan.js.map +1 -0
  57. package/dist/internal/fuzzNetwork.d.ts +56 -0
  58. package/dist/internal/fuzzNetwork.d.ts.map +1 -0
  59. package/dist/internal/fuzzNetwork.js +96 -0
  60. package/dist/internal/fuzzNetwork.js.map +1 -0
  61. package/dist/internal/simulationCoverage.d.ts.map +1 -1
  62. package/dist/internal/simulationCoverage.js +2 -1
  63. package/dist/internal/simulationCoverage.js.map +1 -1
  64. package/dist/internal/skillLink.d.ts +14 -0
  65. package/dist/internal/skillLink.d.ts.map +1 -0
  66. package/dist/internal/skillLink.js +46 -0
  67. package/dist/internal/skillLink.js.map +1 -0
  68. package/dist/internal/values.d.ts +9 -1
  69. package/dist/internal/values.d.ts.map +1 -1
  70. package/dist/internal/values.js +11 -1
  71. package/dist/internal/values.js.map +1 -1
  72. package/dist/internal/verifyRunner.d.ts +19 -0
  73. package/dist/internal/verifyRunner.d.ts.map +1 -0
  74. package/dist/internal/verifyRunner.js +47 -0
  75. package/dist/internal/verifyRunner.js.map +1 -0
  76. package/dist/internal/version.d.ts +1 -1
  77. package/dist/internal/version.js +1 -1
  78. package/package.json +28 -3
  79. package/src/Desync.ts +40 -17
  80. package/src/Determinism.ts +49 -11
  81. package/src/Format.ts +101 -34
  82. package/src/Fuzz.ts +551 -0
  83. package/src/Invariant.ts +9 -2
  84. package/src/Lint.ts +11 -5
  85. package/src/PlaywrightEngine.ts +232 -0
  86. package/src/Replay.ts +100 -47
  87. package/src/ReplayNodeSink.ts +4 -1
  88. package/src/ReplayVitePlugin.ts +1 -0
  89. package/src/Session.ts +816 -73
  90. package/src/Verify.ts +276 -0
  91. package/src/cli.ts +150 -15
  92. package/src/index.ts +3 -2
  93. package/src/internal/dependencyScan.ts +356 -0
  94. package/src/internal/fuzzNetwork.ts +130 -0
  95. package/src/internal/simulationCoverage.ts +2 -1
  96. package/src/internal/skillLink.ts +53 -0
  97. package/src/internal/values.ts +20 -1
  98. package/src/internal/verifyRunner.ts +46 -0
  99. package/src/internal/version.ts +1 -1
  100. package/dist/Monitor.d.ts +0 -101
  101. package/dist/Monitor.d.ts.map +0 -1
  102. package/dist/Monitor.js +0 -602
  103. package/dist/Monitor.js.map +0 -1
  104. package/dist/internal/monitor.d.ts +0 -126
  105. package/dist/internal/monitor.d.ts.map +0 -1
  106. package/dist/internal/monitor.js +0 -279
  107. package/dist/internal/monitor.js.map +0 -1
  108. package/src/Monitor.ts +0 -713
  109. package/src/internal/monitor.ts +0 -370
package/dist/Monitor.d.ts DELETED
@@ -1,101 +0,0 @@
1
- /**
2
- * A live monitor panel for a running game in the browser: how the game is
3
- * built and what it is doing, without reading its code.
4
- *
5
- * - **Overview**: time per schedule tick, the busiest systems, entity counts
6
- * over the last seconds, state machines, and alerts (failed systems, NaN or
7
- * infinite numbers written, messages discarded by skipped systems).
8
- * - **Systems**: every schedule as its systems in order, grouped by run
9
- * conditions, with what each reads, writes, emits, and spawns. A dot shows
10
- * whether a system is working, idle, or skipped. Hover a name to light up
11
- * the systems that write it (orange) and read it (blue).
12
- * - **Entity**: pick an entity on screen (or by id) to follow its components
13
- * live and the changes systems make to it.
14
- *
15
- * The monitor observes the runtime only while it is open, so a closed monitor
16
- * costs nothing. While open it reduces trace events to counts and shows its
17
- * own cost per tick. It needs a runtime made with `debug: { hostClock }`, and the page passed as `host`.
18
- *
19
- * @module Monitor
20
- * @docGroup devtools
21
- *
22
- * @example
23
- * ```ts
24
- * const monitor = Monitor.attach(runtime, {
25
- * host: window,
26
- * schedules: { fixedUpdate: step, frame },
27
- * pick: (event) => entityUnderPointer(event),
28
- * locate: (entity) => screenPositionOf(entity)
29
- * })
30
- * // Toggle with the backslash key or the corner button.
31
- * ```
32
- */
33
- import type * as Debug from "@typeonce/ritmo/Debug";
34
- import type { AnyScheduleOrder, ExecutableScheduleDefinition } from "@typeonce/ritmo/Schedule";
35
- import type { Schema } from "@typeonce/ritmo/Schema";
36
- import { Collector, recentSchedule, recentSystem } from "./internal/monitor.ts";
37
- /**
38
- * The numbers behind the panel, without DOM: pass `collector.observe` to
39
- * `debug.observe`, call `sample(now)` periodically, read `history`, `alerts`,
40
- * spawn kinds, and the selected entity's changes. Use it for a custom UI or in
41
- * tests.
42
- */
43
- export { Collector, recentSchedule, recentSystem };
44
- export type { Alert, CollectorOptions, EntityLine, Sample, ScheduleWindow, SpawnKind, SystemWindow } from "./internal/monitor.ts";
45
- /** What the monitor needs from a runtime: its debug handle. */
46
- export interface Target<S extends Schema.Any, Root> {
47
- readonly debug: Debug.Handle<S, Root>;
48
- }
49
- /** What `attach` shows, where, and how the panel is opened. */
50
- export interface Options<S extends Schema.Any, Root> {
51
- /**
52
- * The schedules the game ticks, by name. They name the schedules in the
53
- * panel and make up the system map. Name the schedule objects actually
54
- * passed to `tick`: nested schedules are flattened into them.
55
- */
56
- readonly schedules: Readonly<Record<string, ExecutableScheduleDefinition<S, any, Root, any, any, AnyScheduleOrder>>>;
57
- /**
58
- * The page the panel lives in, passed explicitly (`window`): its
59
- * `document`, timers, animation frames, keyboard events, and
60
- * `performance` clock. The monitor reads no globals.
61
- */
62
- readonly host: Window;
63
- /** Where the panel is added. Defaults to `host.document.body`. */
64
- readonly mount?: HTMLElement;
65
- /** `KeyboardEvent.code` that toggles the panel. Defaults to `Backslash`. */
66
- readonly key?: string;
67
- /** Opens the panel right away. */
68
- readonly open?: boolean;
69
- /** The entity under a pointer event, for "Pick on screen". */
70
- readonly pick?: (event: PointerEvent) => number | undefined;
71
- /** An entity's position in client (viewport) pixels, to mark the selected entity. */
72
- readonly locate?: (entity: number) => {
73
- readonly x: number;
74
- readonly y: number;
75
- } | undefined;
76
- /** Milliseconds between panel refreshes. Defaults to 250. */
77
- readonly refreshMs?: number;
78
- /**
79
- * A replay recorder (`Replay.recorder`): adds a "Save replay" button that
80
- * saves the last seconds of play with the reason "Save replay button".
81
- */
82
- readonly replay?: {
83
- readonly save: (reason: string) => unknown;
84
- };
85
- }
86
- /** An attached monitor panel, from `attach`. */
87
- export interface Monitor {
88
- readonly open: () => void;
89
- readonly close: () => void;
90
- readonly toggle: () => void;
91
- /** Selects an entity in the Entity tab (`undefined` clears it). */
92
- readonly select: (entity: number | undefined) => void;
93
- /** Removes the panel and stops observing. */
94
- readonly detach: () => void;
95
- }
96
- /**
97
- * Adds the monitor to the page. The panel starts closed unless `open` is set;
98
- * toggle it with the key (`Backslash` by default) or the corner button.
99
- */
100
- export declare const attach: <S extends Schema.Any, Root>(runtime: Target<S, Root>, options: Options<S, Root>) => Monitor;
101
- //# sourceMappingURL=Monitor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Monitor.d.ts","sourceRoot":"","sources":["../src/Monitor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,KAAK,KAAK,KAAK,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAA;AAC9F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAGpD,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAG/E;;;;;GAKG;AACH,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,YAAY,EAAE,CAAA;AAClD,YAAY,EAAE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