honse-sim 0.1.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.
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "honse-sim",
3
+ "type": "module",
4
+ "description": "WebAssembly adapter for the uma-sim race simulation engines (contested + vacuum).",
5
+ "version": "0.1.0",
6
+ "license": "GPL-3.0-only",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/jalbarrang/torena-sim"
10
+ },
11
+ "files": [
12
+ "uma_sim_wasm_bg.wasm",
13
+ "uma_sim_wasm.js",
14
+ "uma_sim_wasm.d.ts"
15
+ ],
16
+ "main": "uma_sim_wasm.js",
17
+ "types": "uma_sim_wasm.d.ts",
18
+ "sideEffects": [
19
+ "./snippets/*"
20
+ ]
21
+ }
@@ -0,0 +1,130 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * A streaming race simulator with per-event JS callbacks.
6
+ *
7
+ * Construct with [`WasmRaceSimulator::new`], register callbacks, then call
8
+ * [`run`](WasmRaceSimulator::run) to drive the race aggregate over the
9
+ * configured rounds. Callbacks fire live; the serialized batch result is
10
+ * returned at the end.
11
+ */
12
+ export class WasmRaceSimulator {
13
+ free(): void;
14
+ [Symbol.dispose](): void;
15
+ /**
16
+ * Build a simulator from a [`WasmRaceSimParams`] JS object.
17
+ */
18
+ constructor(params: any);
19
+ /**
20
+ * Run the configured rounds, firing callbacks live, and return the
21
+ * serialized [`WasmRaceSimResult`].
22
+ */
23
+ run(): any;
24
+ /**
25
+ * Register the `after-runner-tick(snapshot)` callback.
26
+ */
27
+ setOnAfterRunnerTick(cb: Function): void;
28
+ /**
29
+ * Register the `before-tick(dt)` callback.
30
+ */
31
+ setOnBeforeTick(cb: Function): void;
32
+ /**
33
+ * Register the `round-end()` callback.
34
+ */
35
+ setOnRoundEnd(cb: Function): void;
36
+ /**
37
+ * Register the `round-start(seed)` callback.
38
+ */
39
+ setOnRoundStart(cb: Function): void;
40
+ /**
41
+ * Register the `runner-finished(runnerId)` callback.
42
+ */
43
+ setOnRunnerFinished(cb: Function): void;
44
+ }
45
+
46
+ /**
47
+ * All condition tokens the Rust engine's catalog recognizes.
48
+ *
49
+ * Exposed so the TS-side simulatability gate (ADR-0003, driven by the TS
50
+ * `knownConditionTokens` vocabulary) can be cross-checked against the engine
51
+ * that actually runs the sim, closing the dual-parser drift risk (ADR-0004):
52
+ * any token the UI treats as simulatable must be resolvable by this engine.
53
+ * Returned as a sorted JS string array.
54
+ */
55
+ export function knownConditionTokens(): string[];
56
+
57
+ /**
58
+ * Run a batch compare-family simulation and return the serialized result.
59
+ *
60
+ * `params` is a [`WasmCompareParams`] JS object (a small vacuum field over
61
+ * `nsamples` rounds). Returns a [`WasmCompareData`] (per-round, per-runner
62
+ * telemetry); the bashin-delta + summary stats are computed on the TS side.
63
+ */
64
+ export function runCompare(params: any): any;
65
+
66
+ /**
67
+ * Run a same-race compare-family simulation and return the serialized result.
68
+ *
69
+ * `params` is a [`WasmContestedCompareParams`] JS object (2..=12 compared
70
+ * runners, optionally mob-filled via `fillTo`). Returns the same [`WasmCompareData`] shape
71
+ * as vacuum compare so the TS reducer can be reused.
72
+ */
73
+ export function runContestedCompare(params: any): any;
74
+
75
+ /**
76
+ * Run a batch race simulation and return the serialized result.
77
+ *
78
+ * `params` is a [`WasmRaceSimParams`] JS object. Returns a
79
+ * [`WasmRaceSimResult`] (per-round finish orders + focus telemetry).
80
+ */
81
+ export function runRaceSim(params: any): any;
82
+
83
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
84
+
85
+ export interface InitOutput {
86
+ readonly memory: WebAssembly.Memory;
87
+ readonly __wbg_wasmracesimulator_free: (a: number, b: number) => void;
88
+ readonly knownConditionTokens: () => [number, number];
89
+ readonly runCompare: (a: any) => [number, number, number];
90
+ readonly runContestedCompare: (a: any) => [number, number, number];
91
+ readonly runRaceSim: (a: any) => [number, number, number];
92
+ readonly wasmracesimulator_new: (a: any) => [number, number, number];
93
+ readonly wasmracesimulator_run: (a: number) => [number, number, number];
94
+ readonly wasmracesimulator_setOnAfterRunnerTick: (a: number, b: any) => void;
95
+ readonly wasmracesimulator_setOnBeforeTick: (a: number, b: any) => void;
96
+ readonly wasmracesimulator_setOnRoundEnd: (a: number, b: any) => void;
97
+ readonly wasmracesimulator_setOnRoundStart: (a: number, b: any) => void;
98
+ readonly wasmracesimulator_setOnRunnerFinished: (a: number, b: any) => void;
99
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
100
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
101
+ readonly __wbindgen_exn_store: (a: number) => void;
102
+ readonly __externref_table_alloc: () => number;
103
+ readonly __wbindgen_externrefs: WebAssembly.Table;
104
+ readonly __externref_drop_slice: (a: number, b: number) => void;
105
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
106
+ readonly __externref_table_dealloc: (a: number) => void;
107
+ readonly __wbindgen_start: () => void;
108
+ }
109
+
110
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
111
+
112
+ /**
113
+ * Instantiates the given `module`, which can either be bytes or
114
+ * a precompiled `WebAssembly.Module`.
115
+ *
116
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
117
+ *
118
+ * @returns {InitOutput}
119
+ */
120
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
121
+
122
+ /**
123
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
124
+ * for everything else, calls `WebAssembly.instantiate` directly.
125
+ *
126
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
127
+ *
128
+ * @returns {Promise<InitOutput>}
129
+ */
130
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;