motely-wasm 14.0.2 → 14.2.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/README.md ADDED
@@ -0,0 +1,100 @@
1
+ # motely-wasm
2
+
3
+ Find Balatro seeds with plain-language JAML filters — Jimbo's Ante Markup Language. SIMD-vectorized seed search (Motely engine, C# → NativeAOT-LLVM WASM). Browser + Node.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install motely-wasm
9
+ ```
10
+
11
+ ## Boot & Search
12
+
13
+ ```ts
14
+ import motely, { MotelyWasm, MotelyWasmEvents } from "motely-wasm";
15
+
16
+ await motely.boot();
17
+
18
+ const jaml = `
19
+ name: Blueprint Copy Engine
20
+ deck: Red
21
+ stake: White
22
+ must:
23
+ - rareJoker: Blueprint
24
+ antes: [1, 2, 3]
25
+ should:
26
+ - rareJoker: Brainstorm
27
+ score: 80
28
+ `;
29
+
30
+ MotelyWasmEvents.onResult.subscribe((seed, score) => console.log(seed, score));
31
+ MotelyWasmEvents.onProgress.subscribe((searched, matching) => { /* … */ });
32
+ MotelyWasmEvents.onComplete.subscribe((status, searched, matched) => { /* … */ });
33
+
34
+ const search = MotelyWasm.startRandomSearch(jaml, 10000);
35
+ // later: search.cancel();
36
+ ```
37
+
38
+ ## CDN Delivery (recommended for MCP Apps / single-file bundles)
39
+
40
+ Every published version of `motely-wasm` is mirrored to a public CDN:
41
+
42
+ ```
43
+ https://cdn.seedfinder.app/motely-wasm/<version>/index.mjs
44
+ ```
45
+
46
+ Use this when your build can't (or shouldn't) bundle the WASM payload inline — for example:
47
+
48
+ - **MCP Apps** bundled as a single HTML resource: dynamic `import(cdn)` keeps the HTML small and the browser caches the engine across tool invocations.
49
+ - **Vercel Functions / Cloudflare Workers**: dynamic import avoids bundling ~11MB of WASM into every deployment artifact.
50
+ - **CDN-hosted static sites**: one cached copy of the engine per version, shared across all pages.
51
+
52
+ Example — load the engine from CDN inside a Web Worker:
53
+
54
+ ```ts
55
+ // searchWorker.ts
56
+ const mod = await import(/* @vite-ignore */
57
+ `https://cdn.seedfinder.app/motely-wasm/12.4.1/index.mjs`);
58
+ await mod.default.boot();
59
+ const { MotelyWasm, MotelyWasmEvents } = mod;
60
+ ```
61
+
62
+ Version must be pinned explicitly — the CDN serves immutable, versioned paths for long-term caching (`Cache-Control: max-age=31536000`).
63
+
64
+ ### Content Security Policy
65
+
66
+ When embedding in a sandboxed iframe (MCP Apps), allow both script loading and fetch/import:
67
+
68
+ ```
69
+ script-src https://cdn.seedfinder.app
70
+ connect-src https://cdn.seedfinder.app
71
+ ```
72
+
73
+ For MCP App servers using `@modelcontextprotocol/ext-apps`:
74
+
75
+ ```ts
76
+ {
77
+ ui: {
78
+ csp: {
79
+ resourceDomains: ["https://cdn.seedfinder.app"],
80
+ connectDomains: ["https://cdn.seedfinder.app"],
81
+ },
82
+ },
83
+ }
84
+ ```
85
+
86
+ ## Build
87
+
88
+ NativeAOT-LLVM + SIMD. Verify "LLVM compilation to IR finished" in build output.
89
+
90
+ ```xml
91
+ <BootsharpLlvm>true</BootsharpLlvm>
92
+ <WasmEnableSIMD>true</WasmEnableSIMD>
93
+ <EmccFlags>-msimd128</EmccFlags>
94
+ ```
95
+
96
+ The `MONO_WASM:` prefix in console logs is Bootsharp's glue log string — this is **not** a Mono runtime build. Motely is NativeAOT-LLVM.
97
+
98
+ ## License
99
+
100
+ MIT