motely-node 2.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 +114 -0
- package/_framework/Motely.187ix5j7r4.wasm +0 -0
- package/_framework/Motely.187ix5j7r4.wasm.br +0 -0
- package/_framework/Motely.187ix5j7r4.wasm.gz +0 -0
- package/_framework/Motely.SingleThread.8ilcic7m8e.wasm +0 -0
- package/_framework/Motely.SingleThread.8ilcic7m8e.wasm.br +0 -0
- package/_framework/Motely.SingleThread.8ilcic7m8e.wasm.gz +0 -0
- package/_framework/Motely.SingleThread.i44l86ij06.wasm +0 -0
- package/_framework/Motely.SingleThread.i44l86ij06.wasm.br +0 -0
- package/_framework/Motely.SingleThread.i44l86ij06.wasm.gz +0 -0
- package/_framework/Motely.dlgz5zvozg.wasm +0 -0
- package/_framework/Motely.dlgz5zvozg.wasm.br +0 -0
- package/_framework/Motely.dlgz5zvozg.wasm.gz +0 -0
- package/_framework/System.Collections.Concurrent.ayp51emk7f.wasm +0 -0
- package/_framework/System.Collections.Concurrent.ayp51emk7f.wasm.br +0 -0
- package/_framework/System.Collections.Concurrent.ayp51emk7f.wasm.gz +0 -0
- package/_framework/System.Collections.tt425i6ify.wasm +0 -0
- package/_framework/System.Collections.tt425i6ify.wasm.br +0 -0
- package/_framework/System.Collections.tt425i6ify.wasm.gz +0 -0
- package/_framework/System.ComponentModel.Primitives.fjv77ljto2.wasm +0 -0
- package/_framework/System.ComponentModel.Primitives.fjv77ljto2.wasm.br +0 -0
- package/_framework/System.ComponentModel.Primitives.fjv77ljto2.wasm.gz +0 -0
- package/_framework/System.Console.a5h4vm85mj.wasm +0 -0
- package/_framework/System.Console.a5h4vm85mj.wasm.br +0 -0
- package/_framework/System.Console.a5h4vm85mj.wasm.gz +0 -0
- package/_framework/System.IO.Pipelines.dvb53mk2zg.wasm +0 -0
- package/_framework/System.IO.Pipelines.dvb53mk2zg.wasm.br +0 -0
- package/_framework/System.IO.Pipelines.dvb53mk2zg.wasm.gz +0 -0
- package/_framework/System.Linq.x3bjseuxl8.wasm +0 -0
- package/_framework/System.Linq.x3bjseuxl8.wasm.br +0 -0
- package/_framework/System.Linq.x3bjseuxl8.wasm.gz +0 -0
- package/_framework/System.Memory.tf17uamb4m.wasm +0 -0
- package/_framework/System.Memory.tf17uamb4m.wasm.br +0 -0
- package/_framework/System.Memory.tf17uamb4m.wasm.gz +0 -0
- package/_framework/System.ObjectModel.8ksm30ll2f.wasm +0 -0
- package/_framework/System.ObjectModel.8ksm30ll2f.wasm.br +0 -0
- package/_framework/System.ObjectModel.8ksm30ll2f.wasm.gz +0 -0
- package/_framework/System.Private.CoreLib.e4xpgjmfzj.wasm +0 -0
- package/_framework/System.Private.CoreLib.e4xpgjmfzj.wasm.br +0 -0
- package/_framework/System.Private.CoreLib.e4xpgjmfzj.wasm.gz +0 -0
- package/_framework/System.Private.Uri.vf3uyjlk4r.wasm +0 -0
- package/_framework/System.Private.Uri.vf3uyjlk4r.wasm.br +0 -0
- package/_framework/System.Private.Uri.vf3uyjlk4r.wasm.gz +0 -0
- package/_framework/System.Runtime.InteropServices.JavaScript.60uq0t1ywb.wasm +0 -0
- package/_framework/System.Runtime.InteropServices.JavaScript.60uq0t1ywb.wasm.br +0 -0
- package/_framework/System.Runtime.InteropServices.JavaScript.60uq0t1ywb.wasm.gz +0 -0
- package/_framework/System.Text.Encodings.Web.ha1lyoz09i.wasm +0 -0
- package/_framework/System.Text.Encodings.Web.ha1lyoz09i.wasm.br +0 -0
- package/_framework/System.Text.Encodings.Web.ha1lyoz09i.wasm.gz +0 -0
- package/_framework/System.Text.Json.ad1y3qs7i4.wasm +0 -0
- package/_framework/System.Text.Json.ad1y3qs7i4.wasm.br +0 -0
- package/_framework/System.Text.Json.ad1y3qs7i4.wasm.gz +0 -0
- package/_framework/System.Text.RegularExpressions.n5mf3b24ec.wasm +0 -0
- package/_framework/System.Text.RegularExpressions.n5mf3b24ec.wasm.br +0 -0
- package/_framework/System.Text.RegularExpressions.n5mf3b24ec.wasm.gz +0 -0
- package/_framework/System.Threading.8wct646wp9.wasm +0 -0
- package/_framework/System.Threading.8wct646wp9.wasm.br +0 -0
- package/_framework/System.Threading.8wct646wp9.wasm.gz +0 -0
- package/_framework/YamlDotNet.b2a7su70z1.wasm +0 -0
- package/_framework/YamlDotNet.b2a7su70z1.wasm.br +0 -0
- package/_framework/YamlDotNet.b2a7su70z1.wasm.gz +0 -0
- package/_framework/dotnet.js +176 -0
- package/_framework/dotnet.js.br +0 -0
- package/_framework/dotnet.js.gz +0 -0
- package/_framework/dotnet.native.2rnmjvcnrv.js +5504 -0
- package/_framework/dotnet.native.2rnmjvcnrv.js.br +0 -0
- package/_framework/dotnet.native.2rnmjvcnrv.js.gz +0 -0
- package/_framework/dotnet.native.btc209xsl2.wasm +0 -0
- package/_framework/dotnet.native.btc209xsl2.wasm.br +0 -0
- package/_framework/dotnet.native.btc209xsl2.wasm.gz +0 -0
- package/_framework/dotnet.native.px7soob3pq.wasm +0 -0
- package/_framework/dotnet.native.px7soob3pq.wasm.br +0 -0
- package/_framework/dotnet.native.px7soob3pq.wasm.gz +0 -0
- package/_framework/dotnet.runtime.q5rqv3xrhm.js +4 -0
- package/_framework/dotnet.runtime.q5rqv3xrhm.js.br +0 -0
- package/_framework/dotnet.runtime.q5rqv3xrhm.js.gz +0 -0
- package/index.d.ts +102 -0
- package/index.js +72 -0
- package/package.json +57 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
export interface VersionInfo {
|
|
2
|
+
version: string;
|
|
3
|
+
runtime: string;
|
|
4
|
+
features: string[];
|
|
5
|
+
}
|
|
6
|
+
export interface CapabilitiesInfo {
|
|
7
|
+
simd: boolean;
|
|
8
|
+
threads: boolean;
|
|
9
|
+
processorCount: number;
|
|
10
|
+
runtime: string;
|
|
11
|
+
version: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ShopItemInfo {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
}
|
|
17
|
+
export interface PackInfo {
|
|
18
|
+
type: string;
|
|
19
|
+
items: string[];
|
|
20
|
+
}
|
|
21
|
+
export interface AnteAnalysisInfo {
|
|
22
|
+
ante: number;
|
|
23
|
+
boss: string;
|
|
24
|
+
voucher: string;
|
|
25
|
+
smallBlindTag: string;
|
|
26
|
+
bigBlindTag: string;
|
|
27
|
+
shopQueue: ShopItemInfo[];
|
|
28
|
+
packs: PackInfo[];
|
|
29
|
+
}
|
|
30
|
+
export interface SeedAnalysisInfo {
|
|
31
|
+
seed: string;
|
|
32
|
+
deck: string;
|
|
33
|
+
stake: string;
|
|
34
|
+
error?: string | null;
|
|
35
|
+
antes: AnteAnalysisInfo[];
|
|
36
|
+
}
|
|
37
|
+
export interface SearchResultInfo {
|
|
38
|
+
seed: string;
|
|
39
|
+
score: number;
|
|
40
|
+
}
|
|
41
|
+
export interface SearchProgressInfo {
|
|
42
|
+
type: 'progress';
|
|
43
|
+
seedsSearched: number;
|
|
44
|
+
matchingSeeds: number;
|
|
45
|
+
elapsedMs: number;
|
|
46
|
+
resultCount: number;
|
|
47
|
+
}
|
|
48
|
+
export interface SearchCompleteInfo {
|
|
49
|
+
type: 'done';
|
|
50
|
+
searchId: string;
|
|
51
|
+
}
|
|
52
|
+
export interface ValidateResult {
|
|
53
|
+
valid: boolean;
|
|
54
|
+
error?: string | null;
|
|
55
|
+
name?: string | null;
|
|
56
|
+
deck?: string | null;
|
|
57
|
+
stake?: string | null;
|
|
58
|
+
}
|
|
59
|
+
export interface SearchOptions {
|
|
60
|
+
/** Thread count (default 1 — Node.js WASM is single-threaded) */
|
|
61
|
+
threadCount?: number;
|
|
62
|
+
/** Batch character count 1-7 (default 4) */
|
|
63
|
+
batchCharCount?: number;
|
|
64
|
+
randomSeeds?: number;
|
|
65
|
+
cutoff?: string;
|
|
66
|
+
startBatch?: number;
|
|
67
|
+
endBatch?: number;
|
|
68
|
+
specificSeed?: string;
|
|
69
|
+
palindrome?: boolean;
|
|
70
|
+
onProgress?: (seedsSearched: number, matchingSeeds: number, elapsedMs: number, resultCount: number) => void;
|
|
71
|
+
onResult?: (seed: string, score: number) => void;
|
|
72
|
+
}
|
|
73
|
+
export interface ErrorResult {
|
|
74
|
+
error: string;
|
|
75
|
+
}
|
|
76
|
+
export interface MotelyNodeApi {
|
|
77
|
+
/** Get runtime capabilities (SIMD, threads, etc.) */
|
|
78
|
+
getCapabilities(): Promise<CapabilitiesInfo>;
|
|
79
|
+
/** Analyze a single seed. Returns full ante-by-ante breakdown. */
|
|
80
|
+
analyzeSeed(seed: string, deck: string, stake: string): Promise<SeedAnalysisInfo>;
|
|
81
|
+
/** Validate a JAML filter string. */
|
|
82
|
+
validateJaml(jamlContent: string): Promise<ValidateResult>;
|
|
83
|
+
/**
|
|
84
|
+
* Start a JAML search. Returns a Promise that resolves when search completes.
|
|
85
|
+
* Progress is pushed to onProgress/onResult callbacks.
|
|
86
|
+
*/
|
|
87
|
+
startJamlSearch(jamlContent: string, options?: SearchOptions): Promise<void>;
|
|
88
|
+
/** Dispose and cleanup */
|
|
89
|
+
dispose(): void;
|
|
90
|
+
}
|
|
91
|
+
declare global {
|
|
92
|
+
var __motelyOnProgress: (totalSeedsSearched: number, matchingSeeds: number, elapsedMs: number, resultCount: number) => void;
|
|
93
|
+
var __motelyOnResult: (seed: string, score: number) => void;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Load the Motely WASM runtime for Node.js and return the API.
|
|
97
|
+
* Uses the browser WASM build with Node.js runtime adapter.
|
|
98
|
+
* Call once at app startup; the returned object is reusable.
|
|
99
|
+
*/
|
|
100
|
+
export declare function loadMotely(options?: {
|
|
101
|
+
frameworkPath?: string;
|
|
102
|
+
}): Promise<MotelyNodeApi>;
|
package/index.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Motely Node.js Package Entry Point
|
|
2
|
+
// Uses the browser WASM build with Node.js runtime adapter
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
|
+
import { pathToFileURL } from 'node:url';
|
|
6
|
+
/**
|
|
7
|
+
* Load the Motely WASM runtime for Node.js and return the API.
|
|
8
|
+
* Uses the browser WASM build with Node.js runtime adapter.
|
|
9
|
+
* Call once at app startup; the returned object is reusable.
|
|
10
|
+
*/
|
|
11
|
+
export async function loadMotely(options) {
|
|
12
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
13
|
+
const __dirname = dirname(__filename);
|
|
14
|
+
const defaultFrameworkPath = join(__dirname, '_framework');
|
|
15
|
+
const frameworkPath = options?.frameworkPath || defaultFrameworkPath;
|
|
16
|
+
const dotnetJsPath = join(frameworkPath, 'dotnet.js');
|
|
17
|
+
// Install no-op callbacks before runtime boots
|
|
18
|
+
globalThis.__motelyOnProgress = () => { };
|
|
19
|
+
globalThis.__motelyOnResult = () => { };
|
|
20
|
+
// Convert to file:// URL for dynamic import
|
|
21
|
+
const dotnetUrl = pathToFileURL(dotnetJsPath).href;
|
|
22
|
+
// Dynamic import of .NET WASM entry point
|
|
23
|
+
const { dotnet } = await import(dotnetUrl);
|
|
24
|
+
const runtime = await dotnet.create();
|
|
25
|
+
const config = runtime.getConfig();
|
|
26
|
+
const allExports = await runtime.getAssemblyExports(config.mainAssemblyName);
|
|
27
|
+
const raw = allExports.Motely.BrowserWasm.MotelyWasmExports;
|
|
28
|
+
runtime.runMain().catch(err => console.error('[motely-node] runMain failed:', err));
|
|
29
|
+
const [versionJson, capabilitiesJson] = await Promise.all([
|
|
30
|
+
raw.GetVersionAsync(),
|
|
31
|
+
raw.GetCapabilitiesAsync(),
|
|
32
|
+
]);
|
|
33
|
+
const cachedCapabilities = JSON.parse(capabilitiesJson);
|
|
34
|
+
const api = {
|
|
35
|
+
async getCapabilities() {
|
|
36
|
+
return cachedCapabilities;
|
|
37
|
+
},
|
|
38
|
+
async analyzeSeed(seed, deck, stake) {
|
|
39
|
+
const json = await raw.AnalyzeSeedAsync(seed, deck, stake);
|
|
40
|
+
const result = JSON.parse(json);
|
|
41
|
+
if (result.error && !result.seed)
|
|
42
|
+
throw new Error(result.error);
|
|
43
|
+
return result;
|
|
44
|
+
},
|
|
45
|
+
async validateJaml(jaml) {
|
|
46
|
+
const json = await raw.ValidateJamlAsync(jaml);
|
|
47
|
+
return JSON.parse(json);
|
|
48
|
+
},
|
|
49
|
+
async startJamlSearch(jamlContent, options) {
|
|
50
|
+
const { onProgress, onResult, ...searchParams } = options ?? {};
|
|
51
|
+
globalThis.__motelyOnProgress = onProgress ?? (() => { });
|
|
52
|
+
globalThis.__motelyOnResult = onResult ?? (() => { });
|
|
53
|
+
// Default threadCount=1 and batchCharCount=4 for Node.js single-threaded WASM
|
|
54
|
+
const withDefaults = {
|
|
55
|
+
threadCount: 1,
|
|
56
|
+
batchCharCount: 4,
|
|
57
|
+
...searchParams,
|
|
58
|
+
};
|
|
59
|
+
const optionsJson = JSON.stringify(withDefaults);
|
|
60
|
+
const resultJson = await raw.StartJamlSearch(jamlContent, optionsJson);
|
|
61
|
+
globalThis.__motelyOnProgress = () => { };
|
|
62
|
+
globalThis.__motelyOnResult = () => { };
|
|
63
|
+
const result = JSON.parse(resultJson);
|
|
64
|
+
if (result.error)
|
|
65
|
+
throw new Error(result.error);
|
|
66
|
+
},
|
|
67
|
+
dispose: () => {
|
|
68
|
+
raw.DisposeSearch();
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
return api;
|
|
72
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "motely-node",
|
|
3
|
+
"version": "2.2.0",
|
|
4
|
+
"description": "MotelyJAML for Node.js/V8 - Balatro seed analyzer and JAML filter engine using .NET WASM",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"types": "index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./index.js",
|
|
11
|
+
"require": "./index.cjs",
|
|
12
|
+
"types": "./index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./jaml.schema.json": "./jaml.schema.json"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"_framework/",
|
|
18
|
+
"index.js",
|
|
19
|
+
"index.cjs",
|
|
20
|
+
"index.d.ts",
|
|
21
|
+
"README.md",
|
|
22
|
+
"jaml.schema.json"
|
|
23
|
+
],
|
|
24
|
+
"keywords": [
|
|
25
|
+
"balatro",
|
|
26
|
+
"seed",
|
|
27
|
+
"wasm",
|
|
28
|
+
"webassembly",
|
|
29
|
+
"dotnet",
|
|
30
|
+
"node",
|
|
31
|
+
"v8",
|
|
32
|
+
"jaml",
|
|
33
|
+
"filter",
|
|
34
|
+
"finder",
|
|
35
|
+
"search"
|
|
36
|
+
],
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/OptimusPi/MotelyJAML.git",
|
|
40
|
+
"directory": "Motely.node"
|
|
41
|
+
},
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=18.0.0"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"typescript": "^5.0.0",
|
|
49
|
+
"@types/node": "^20.0.0"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "tsc",
|
|
53
|
+
"copy-framework": "node copy-framework.js",
|
|
54
|
+
"prepare": "npm run build && npm run copy-framework",
|
|
55
|
+
"prepublishOnly": "npm run build"
|
|
56
|
+
}
|
|
57
|
+
}
|