motely-wasm 22.2.2 → 23.0.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/LICENSE +21 -0
- package/README.md +157 -0
- package/dist/dotnet/dotnet.native.js +1 -1
- package/dist/generated/modules/index.g.d.mts +30 -0
- package/dist/generated/modules/index.g.mjs +35 -0
- package/dist/generated/resources.g.mjs +1 -1
- package/dist/generated/serializer.g.mjs +3 -0
- package/package.json +4 -7
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nathanial P. Howard
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# motely-wasm
|
|
2
|
+
|
|
3
|
+
`motely-wasm` is the Bootsharp/WebAssembly package for MotelyJAML: the production Balatro seed-search engine, JAML loader, JAMLyzer analyzer, JUMMY one-line parser, and selected seed utilities exposed to JavaScript.
|
|
4
|
+
|
|
5
|
+
JAML is Jimbo's Ante Markup Language. YAML and JSON are the concrete syntaxes; both load to the same typed `JamlConfig` that the engine executes.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install motely-wasm
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Boot
|
|
14
|
+
|
|
15
|
+
Bootsharp exports a default runtime object plus named API namespaces. Subscribe to exported events and bind imports before `boot()`.
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import bootsharp, {
|
|
19
|
+
MotelyJaml,
|
|
20
|
+
MotelyJamlyzer,
|
|
21
|
+
MotelySearch,
|
|
22
|
+
Jimmolate,
|
|
23
|
+
} from "motely-wasm";
|
|
24
|
+
|
|
25
|
+
MotelySearch.onProgress.subscribe((p) => {
|
|
26
|
+
console.log(`searched=${p.seedsSearched} matches=${p.matchingSeeds}`);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
MotelySearch.onSeedMatch.subscribe((seedOrRow) => console.log(seedOrRow));
|
|
30
|
+
MotelySearch.onScoredResult.subscribe((result) => console.log(result.seed, result.score));
|
|
31
|
+
|
|
32
|
+
Jimmolate.findSeed = (seed, deck, stake) => true;
|
|
33
|
+
|
|
34
|
+
await bootsharp.boot();
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Parse and validate JAML
|
|
38
|
+
|
|
39
|
+
Use `fromYaml` or `fromJson` once, then pass the returned `JamlConfig` to analyzer/search calls. Invalid filters fail loudly; unknown keys are not silently ignored.
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
const jaml = MotelyJaml.fromYaml(`
|
|
43
|
+
name: example
|
|
44
|
+
deck: Red
|
|
45
|
+
stake: White
|
|
46
|
+
seeds: [AAAAAAAA, BBBBBBBB]
|
|
47
|
+
must:
|
|
48
|
+
- voucher: Overstock
|
|
49
|
+
antes: [1]
|
|
50
|
+
`);
|
|
51
|
+
|
|
52
|
+
const error = MotelyJaml.validate("must: [");
|
|
53
|
+
if (error) console.error(error);
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Analyze seeds with JAMLyzer
|
|
57
|
+
|
|
58
|
+
```js
|
|
59
|
+
const results = MotelyJamlyzer.analyzeSeeds(jaml);
|
|
60
|
+
for (const result of results) {
|
|
61
|
+
console.log(result.seed, result.antes[0].voucher, result.antes[0].packs.length);
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Scrollable analysis uses the `streamStates` object returned by a previous page. The state is seed-specific, so resume with a single-seed `JamlConfig`.
|
|
66
|
+
|
|
67
|
+
```js
|
|
68
|
+
const first = MotelyJamlyzer.analyzeSeedsPaged(jaml, 10)[0];
|
|
69
|
+
const next = MotelyJamlyzer.resumeSeeds(jaml, first.streamStates, 10)[0];
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Search
|
|
73
|
+
|
|
74
|
+
Searches emit results through events. The returned promise only signals completion.
|
|
75
|
+
|
|
76
|
+
```js
|
|
77
|
+
const found = [];
|
|
78
|
+
const onResult = (r) => found.push(r.seed);
|
|
79
|
+
MotelySearch.onScoredResult.subscribe(onResult);
|
|
80
|
+
try {
|
|
81
|
+
await MotelySearch.searchList(jaml);
|
|
82
|
+
} finally {
|
|
83
|
+
MotelySearch.onScoredResult.unsubscribe(onResult);
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Available modes:
|
|
88
|
+
|
|
89
|
+
```js
|
|
90
|
+
await MotelySearch.searchList(jaml);
|
|
91
|
+
await MotelySearch.searchRandom(jaml, 1000);
|
|
92
|
+
await MotelySearch.searchSequential(jaml, 0n, 1n, 1);
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
`searchSequential` uses bigint batch indices because the C# parameters are `long`.
|
|
96
|
+
|
|
97
|
+
## Jimmolate
|
|
98
|
+
|
|
99
|
+
Jimmolate is an optional JS-authored seed predicate in the engine filter chain. The browser-safe WASM surface receives `seed`, `deck`, and `stake`; live `MotelySingleSearchContext` ref-struct streams remain engine-side and are not marshalled to JavaScript.
|
|
100
|
+
|
|
101
|
+
```js
|
|
102
|
+
Jimmolate.findSeed = (seed, deck, stake) => seed === "UNITTEST";
|
|
103
|
+
Jimmolate.enabled = true;
|
|
104
|
+
try {
|
|
105
|
+
await MotelySearch.searchList(jaml);
|
|
106
|
+
} finally {
|
|
107
|
+
Jimmolate.enabled = false;
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## JUMMY
|
|
112
|
+
|
|
113
|
+
JUMMY is one human line per JAML criterion. The WASM wrapper delegates to the engine's `JummyLine` parser/formatter so packed item identity stays canonical.
|
|
114
|
+
|
|
115
|
+
```js
|
|
116
|
+
MotelyJummy.validate("Eternal Blueprint in antes 1 or 2"); // null
|
|
117
|
+
MotelyJummy.canonicalize("Showman in antes 1, 2"); // "Showman in antes 1 or 2"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Utilities
|
|
121
|
+
|
|
122
|
+
`MotelyUtilities` exposes seed math and keyword sequence helpers used by the CLI/provider modes.
|
|
123
|
+
|
|
124
|
+
```js
|
|
125
|
+
MotelyUtilities.seedToTotalIndex("11111111"); // 66231629136n
|
|
126
|
+
MotelyUtilities.totalIndexToSeed(66231629136n); // "11111111"
|
|
127
|
+
MotelyUtilities.searchIndexToSeed(0n, 8); // "11111111"
|
|
128
|
+
MotelyUtilities.repeatCharKeywords(3)[0]; // "AAA"
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Local development
|
|
132
|
+
|
|
133
|
+
From `Motely.Wasm/`:
|
|
134
|
+
|
|
135
|
+
```sh
|
|
136
|
+
npm test
|
|
137
|
+
npm run pack:check
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
`npm test` runs `dotnet publish Motely.Wasm.csproj -c Release` first, then runs the Node test suite against `dist/index.mjs`.
|
|
141
|
+
|
|
142
|
+
The release script at the repository root syncs `package.json` to `<MotelyVersion>` in `Directory.Packages.props`, publishes the WASM build, runs the JS tests against that artifact, and then calls `npm publish`.
|
|
143
|
+
|
|
144
|
+
## Current coverage focus
|
|
145
|
+
|
|
146
|
+
The package test suite mirrors the C# behavior tests that are meaningful through the public WASM surface:
|
|
147
|
+
|
|
148
|
+
- boot/runtime and version export
|
|
149
|
+
- JAML YAML/JSON parse and validation strictness
|
|
150
|
+
- JAMLyzer ante structure, event windows, score-by-analysis, and stream-state resume
|
|
151
|
+
- real list/random/sequential searches
|
|
152
|
+
- Jimmolate accept/reject/predicate/deck-stake behavior
|
|
153
|
+
- AND scoring, default source fallback, Hieroglyph pack-slot reachability, and luck-source regressions
|
|
154
|
+
- JUMMY canonicalization
|
|
155
|
+
- seed math and keyword utility parity
|
|
156
|
+
|
|
157
|
+
Corpus-file loading and live ref-struct seed-router introspection remain native test concerns rather than JavaScript package behavior.
|