@noiselang/core 0.1.1
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 +87 -0
- package/dist/index.d.ts +144 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +62 -0
- package/dist/index.js.map +1 -0
- package/package.json +38 -0
package/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# @noiselang/core
|
|
2
|
+
|
|
3
|
+
The [Noise](https://noise-lang.dev) probabilistic-language engine, compiled to WebAssembly and
|
|
4
|
+
wrapped in a small typed API. Parse and run `.noise` programs — including variable introspection —
|
|
5
|
+
from any JavaScript/TypeScript project.
|
|
6
|
+
|
|
7
|
+
The `.wasm` binary ships **inside** this package. The generated glue references it with
|
|
8
|
+
`new URL('noise_bg.wasm', import.meta.url)`, so any bundler that understands that pattern
|
|
9
|
+
(Vite, Rollup, webpack 5, esbuild) fingerprints the binary and emits it as an asset of **your**
|
|
10
|
+
build. No copying files into `public/`, no CDN, no runtime configuration.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npm add @noiselang/core # or: pnpm add / yarn add
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { run } from '@noiselang/core';
|
|
22
|
+
|
|
23
|
+
const result = await run(`
|
|
24
|
+
coin ~ rand::bernoulli(0.5);
|
|
25
|
+
P(coin)
|
|
26
|
+
`);
|
|
27
|
+
|
|
28
|
+
console.log(result.value); // e.g. "0.4997"
|
|
29
|
+
console.log(result.stats); // { forcings, samples, ops, rng_draws }
|
|
30
|
+
console.log(result.elapsedMs);
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`run` never throws — parse/eval failures come back on `result.error` (with a source span).
|
|
34
|
+
|
|
35
|
+
The module instantiates lazily on first use. To warm it up ahead of time (e.g. on app mount):
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { load } from '@noiselang/core';
|
|
39
|
+
await load();
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Variable introspection
|
|
43
|
+
|
|
44
|
+
Run a program and interrogate its retained scope without editing the source — describe a
|
|
45
|
+
variable's distribution, correlate two, or explain what drives one:
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { runWithIntrospection } from '@noiselang/core';
|
|
49
|
+
|
|
50
|
+
const r = await runWithIntrospection(src, [
|
|
51
|
+
{ vars: ['height'] }, // describe(height)
|
|
52
|
+
{ vars: ['weight'], explain: true }, // explain(weight)
|
|
53
|
+
{ vars: ['height', 'weight'] }, // corr(height, weight)
|
|
54
|
+
]);
|
|
55
|
+
|
|
56
|
+
r.bindings; // live top-level variables (for a picker)
|
|
57
|
+
r.introspections; // one tagged result per request, in order
|
|
58
|
+
r.log; // Print lines + plot::* charts, in source order
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Passing `[]` still returns `bindings`, so a plain run can populate a variable picker.
|
|
62
|
+
|
|
63
|
+
## Bundler notes
|
|
64
|
+
|
|
65
|
+
- **Vite** — works out of the box for app builds. If Vite's dependency optimizer trips on the
|
|
66
|
+
`import.meta.url` asset reference in dev, add the package to `optimizeDeps.exclude`:
|
|
67
|
+
```js
|
|
68
|
+
// vite.config.js
|
|
69
|
+
export default { optimizeDeps: { exclude: ['@noiselang/core'] } }
|
|
70
|
+
```
|
|
71
|
+
- **Node.js** — the module targets browsers/bundlers (it uses `fetch` to load the `.wasm`). For a
|
|
72
|
+
server runtime, instantiate the raw `wasm-pack` glue under `@noiselang/core/wasm` yourself.
|
|
73
|
+
|
|
74
|
+
## API
|
|
75
|
+
|
|
76
|
+
| Export | Description |
|
|
77
|
+
| --- | --- |
|
|
78
|
+
| `run(src)` | Parse + evaluate a program → `NoiseResult`. |
|
|
79
|
+
| `runWithIntrospection(src, requests)` | Run + resolve introspection requests → `NoiseIntrospectResult`. |
|
|
80
|
+
| `version()` | The engine (crate) version string. |
|
|
81
|
+
| `load()` | Force one-time WASM instantiation (optional warm-up). |
|
|
82
|
+
|
|
83
|
+
Full types (`NoiseResult`, `NoiseStats`, `Introspection`, `IntrospectRequest`, …) are exported.
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Initialize the WASM module exactly once; subsequent calls await the same promise.
|
|
3
|
+
*
|
|
4
|
+
* Called implicitly by `run` / `runWithIntrospection` / `version`, so most callers never need it.
|
|
5
|
+
* Call it directly to warm the engine (e.g. on app mount) so the first real run doesn't pay the
|
|
6
|
+
* ~one-off instantiation cost.
|
|
7
|
+
*/
|
|
8
|
+
export declare function load(): Promise<void>;
|
|
9
|
+
/** Run-time counters from the engine — what the program actually computed (see Rust `stats`). */
|
|
10
|
+
export interface NoiseStats {
|
|
11
|
+
/** Forcing operations (`P`/`E`/`Var`/`Q`/`sample`) the program ran. */
|
|
12
|
+
forcings: number;
|
|
13
|
+
/** Total Monte-Carlo draws across all forcings. */
|
|
14
|
+
samples: number;
|
|
15
|
+
/** Total per-lane operations executed (Σ draws × cone-node-count). */
|
|
16
|
+
ops: number;
|
|
17
|
+
/** Total random source draws (Σ draws × source-node-count). */
|
|
18
|
+
rng_draws: number;
|
|
19
|
+
}
|
|
20
|
+
export interface NoiseResult {
|
|
21
|
+
ok: boolean;
|
|
22
|
+
/** Display form of the program's final value, or null for `unit` / on error. */
|
|
23
|
+
value: string | null;
|
|
24
|
+
/** Everything `Print` emitted, in order. */
|
|
25
|
+
output: string;
|
|
26
|
+
/** Error message (with a source span) on failure, else null. */
|
|
27
|
+
error: string | null;
|
|
28
|
+
/** Engine run-time counters (zeroed if a program forced no sampling). */
|
|
29
|
+
stats: NoiseStats;
|
|
30
|
+
/** Wall-clock time of the WASM `run` call, in milliseconds (measured here, not in Rust). */
|
|
31
|
+
elapsedMs: number;
|
|
32
|
+
}
|
|
33
|
+
/** Parse + evaluate a Noise program. Never throws — failures come back in `error`. */
|
|
34
|
+
export declare function run(src: string): Promise<NoiseResult>;
|
|
35
|
+
/** The engine (crate) version, e.g. `"0.1.1"`. */
|
|
36
|
+
export declare function version(): Promise<string>;
|
|
37
|
+
/** A live top-level binding of the program — what a variable picker would list. */
|
|
38
|
+
export interface Binding {
|
|
39
|
+
name: string;
|
|
40
|
+
/** Value kind, e.g. `dist<number>` / `dist<bool>` (introspectable) or `number` / `array`. */
|
|
41
|
+
kind: string;
|
|
42
|
+
}
|
|
43
|
+
/** A histogram to draw: equal-width buckets `bins` spanning `[lo, hi]`. */
|
|
44
|
+
export interface Hist {
|
|
45
|
+
lo: number;
|
|
46
|
+
hi: number;
|
|
47
|
+
bins: number[];
|
|
48
|
+
}
|
|
49
|
+
/** One introspection result, tagged by `type` (mirrors the Rust `IntrospectionOut`). */
|
|
50
|
+
export type Introspection = {
|
|
51
|
+
type: 'dist1';
|
|
52
|
+
label: string;
|
|
53
|
+
n: number;
|
|
54
|
+
mean: number;
|
|
55
|
+
sd: number;
|
|
56
|
+
min: number;
|
|
57
|
+
max: number;
|
|
58
|
+
q05: number;
|
|
59
|
+
q25: number;
|
|
60
|
+
q50: number;
|
|
61
|
+
q75: number;
|
|
62
|
+
q95: number;
|
|
63
|
+
boolean: boolean;
|
|
64
|
+
hist: Hist;
|
|
65
|
+
head: number[];
|
|
66
|
+
} | {
|
|
67
|
+
type: 'dist2';
|
|
68
|
+
label: string;
|
|
69
|
+
label_b: string;
|
|
70
|
+
n: number;
|
|
71
|
+
corr: number;
|
|
72
|
+
cov: number;
|
|
73
|
+
mean_a: number;
|
|
74
|
+
mean_b: number;
|
|
75
|
+
sd_a: number;
|
|
76
|
+
sd_b: number;
|
|
77
|
+
points: [number, number][];
|
|
78
|
+
} | {
|
|
79
|
+
type: 'explain';
|
|
80
|
+
label: string;
|
|
81
|
+
sd: number;
|
|
82
|
+
drivers: {
|
|
83
|
+
name: string;
|
|
84
|
+
corr: number;
|
|
85
|
+
share: number;
|
|
86
|
+
}[];
|
|
87
|
+
} | {
|
|
88
|
+
type: 'value';
|
|
89
|
+
label: string;
|
|
90
|
+
val: number;
|
|
91
|
+
se: number;
|
|
92
|
+
} | {
|
|
93
|
+
type: 'grid';
|
|
94
|
+
label: string;
|
|
95
|
+
rows: number;
|
|
96
|
+
cols: number;
|
|
97
|
+
/** true → vector (series view); false → matrix (heatmap view). */
|
|
98
|
+
series: boolean;
|
|
99
|
+
mean: number[];
|
|
100
|
+
sd: number[];
|
|
101
|
+
} | {
|
|
102
|
+
type: 'corrmatrix';
|
|
103
|
+
label: string;
|
|
104
|
+
n: number;
|
|
105
|
+
corr: number[];
|
|
106
|
+
} | {
|
|
107
|
+
type: 'error';
|
|
108
|
+
error: string;
|
|
109
|
+
};
|
|
110
|
+
/** A request: one variable (`describe`/`explain`) or two (`corr`), with an optional condition. */
|
|
111
|
+
export interface IntrospectRequest {
|
|
112
|
+
/** One or two variable *expressions*, evaluated in the program's scope. */
|
|
113
|
+
vars: string[];
|
|
114
|
+
/** Optional condition expression — `describe(v | given)`. */
|
|
115
|
+
given?: string;
|
|
116
|
+
/** When true, the one-variable request becomes `explain(v)` (driver fan-out). */
|
|
117
|
+
explain?: boolean;
|
|
118
|
+
/** When true, a single (array) variable becomes `corr(v)` (element correlation heatmap). */
|
|
119
|
+
correlate?: boolean;
|
|
120
|
+
}
|
|
121
|
+
/** One item in the program's output stream: a `Print` line or a `plot::*` chart, in source order. */
|
|
122
|
+
export type LogItem = {
|
|
123
|
+
kind: 'text';
|
|
124
|
+
text: string;
|
|
125
|
+
} | {
|
|
126
|
+
kind: 'plot';
|
|
127
|
+
plot: Introspection;
|
|
128
|
+
};
|
|
129
|
+
export interface NoiseIntrospectResult extends NoiseResult {
|
|
130
|
+
/** The program's live top-level variables (for a picker). */
|
|
131
|
+
bindings: Binding[];
|
|
132
|
+
/** One result per request, in request order. */
|
|
133
|
+
introspections: Introspection[];
|
|
134
|
+
/** The output stream in source order: `Print` lines and `plot::*` charts, interleaved. */
|
|
135
|
+
log: LogItem[];
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Run a program and, against its retained scope, resolve a list of introspection requests — the
|
|
139
|
+
* sidecar that powers a variable inspector. Passing `[]` requests still returns `bindings`, so a
|
|
140
|
+
* plain run can populate a variable picker. Never throws; failures surface in `error` (and
|
|
141
|
+
* per-request failures as `{ type: 'error' }` entries).
|
|
142
|
+
*/
|
|
143
|
+
export declare function runWithIntrospection(src: string, requests: IntrospectRequest[]): Promise<NoiseIntrospectResult>;
|
|
144
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA;;;;;;GAMG;AACH,wBAAgB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAOpC;AAED,iGAAiG;AACjG,MAAM,WAAW,UAAU;IACzB,uEAAuE;IACvE,QAAQ,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,GAAG,EAAE,MAAM,CAAC;IACZ,+DAA+D;IAC/D,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,OAAO,CAAC;IACZ,gFAAgF;IAChF,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,yEAAyE;IACzE,KAAK,EAAE,UAAU,CAAC;IAClB,4FAA4F;IAC5F,SAAS,EAAE,MAAM,CAAC;CACnB;AAID,sFAAsF;AACtF,wBAAsB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAS3D;AAED,kDAAkD;AAClD,wB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AA6D;IAC7D,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,gDAAgD;IAChD,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,0FAA0F;IAC1F,GAAG,EAAE,OAAO,EAAE,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,iBAAiB,EAAE,GAC5B,OAAO,CAAC,qBAAqB,CAAC,CAchC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Public API for @noiselang/core — the Noise engine compiled to WebAssembly.
|
|
2
|
+
//
|
|
3
|
+
// The .wasm binary ships inside this package (see ./wasm, generated by `wasm-pack build`). The
|
|
4
|
+
// generated glue instantiates it via `new URL('noise_bg.wasm', import.meta.url)`, so any bundler
|
|
5
|
+
// that understands that pattern (Vite, Rollup, webpack 5, esbuild) fingerprints the .wasm and
|
|
6
|
+
// emits it as an asset of the *consuming* app's build — no copying, no CDN, no runtime config.
|
|
7
|
+
import init, { run as wasmRun, run_with_introspection as wasmRunIntrospect, version as wasmVersion, } from '../wasm/noise.js';
|
|
8
|
+
let ready = null;
|
|
9
|
+
/**
|
|
10
|
+
* Initialize the WASM module exactly once; subsequent calls await the same promise.
|
|
11
|
+
*
|
|
12
|
+
* Called implicitly by `run` / `runWithIntrospection` / `version`, so most callers never need it.
|
|
13
|
+
* Call it directly to warm the engine (e.g. on app mount) so the first real run doesn't pay the
|
|
14
|
+
* ~one-off instantiation cost.
|
|
15
|
+
*/
|
|
16
|
+
export function load() {
|
|
17
|
+
if (!ready) {
|
|
18
|
+
// No argument → the glue resolves the .wasm via `new URL('noise_bg.wasm', import.meta.url)`,
|
|
19
|
+
// i.e. the asset the consumer's bundler emitted next to this module.
|
|
20
|
+
ready = init().then(() => undefined);
|
|
21
|
+
}
|
|
22
|
+
return ready;
|
|
23
|
+
}
|
|
24
|
+
const ZERO_STATS = { forcings: 0, samples: 0, ops: 0, rng_draws: 0 };
|
|
25
|
+
/** Parse + evaluate a Noise program. Never throws — failures come back in `error`. */
|
|
26
|
+
export async function run(src) {
|
|
27
|
+
await load();
|
|
28
|
+
// Time only the engine call (module load is excluded — it's a one-off, not per-run cost).
|
|
29
|
+
const t0 = performance.now();
|
|
30
|
+
const raw = wasmRun(src);
|
|
31
|
+
const elapsedMs = performance.now() - t0;
|
|
32
|
+
const parsed = JSON.parse(raw);
|
|
33
|
+
// The defensive serialization-error fallback omits `stats`; default it so callers needn't guard.
|
|
34
|
+
return { ...parsed, stats: parsed.stats ?? ZERO_STATS, elapsedMs };
|
|
35
|
+
}
|
|
36
|
+
/** The engine (crate) version, e.g. `"0.1.1"`. */
|
|
37
|
+
export async function version() {
|
|
38
|
+
await load();
|
|
39
|
+
return wasmVersion();
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Run a program and, against its retained scope, resolve a list of introspection requests — the
|
|
43
|
+
* sidecar that powers a variable inspector. Passing `[]` requests still returns `bindings`, so a
|
|
44
|
+
* plain run can populate a variable picker. Never throws; failures surface in `error` (and
|
|
45
|
+
* per-request failures as `{ type: 'error' }` entries).
|
|
46
|
+
*/
|
|
47
|
+
export async function runWithIntrospection(src, requests) {
|
|
48
|
+
await load();
|
|
49
|
+
const t0 = performance.now();
|
|
50
|
+
const raw = wasmRunIntrospect(src, JSON.stringify(requests));
|
|
51
|
+
const elapsedMs = performance.now() - t0;
|
|
52
|
+
const parsed = JSON.parse(raw);
|
|
53
|
+
return {
|
|
54
|
+
...parsed,
|
|
55
|
+
stats: parsed.stats ?? ZERO_STATS,
|
|
56
|
+
bindings: parsed.bindings ?? [],
|
|
57
|
+
introspections: parsed.introspections ?? [],
|
|
58
|
+
log: parsed.log ?? [],
|
|
59
|
+
elapsedMs,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src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AC;AACvB,CAAC;AA8FD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,GAAW,EACX,QAA6B;IAE7B,MAAM,IAAI,EAAE,CAAC;IACb,MAAM,EAAE,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IAC7B,MAAM,GAAG,GAAG,iBAAiB,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC7D,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;IACzC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAA6C,CAAC;IAC3E,OAAO;QACL,GAAG,MAAM;QACT,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,UAAU;QACjC,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,EAAE;QAC/B,cAAc,EAAE,MAAM,CAAC,cAAc,IAAI,EAAE;QAC3C,GAAG,EAAE,MAAM,CAAC,GAAG,IAAI,EAAE;QACrB,SAAS;KACV,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@noiselang/core",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "The Noise probabilistic language engine, compiled to WebAssembly. Parse and run .noise programs (with variable introspection) from any JS/TS project — the .wasm ships in the package and bundles into your build.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Manu Mtz.-Almeida <manu.valladolid@gmail.com>",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/manucorporat/noise-lang",
|
|
10
|
+
"directory": "packages/core"
|
|
11
|
+
},
|
|
12
|
+
"type": "module",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"module": "./dist/index.js",
|
|
21
|
+
"sideEffects": false,
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"wasm"
|
|
25
|
+
],
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build:wasm": "cd ../.. && PATH=\"$HOME/.cargo/bin:$PATH\" wasm-pack build crates/noise-wasm --target web --out-dir ../../packages/core/wasm --out-name noise --release",
|
|
28
|
+
"build:ts": "tsc -p tsconfig.json",
|
|
29
|
+
"build": "pnpm run build:wasm && pnpm run build:ts",
|
|
30
|
+
"prepublishOnly": "pnpm run build"
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"typescript": "^5.6.0"
|
|
37
|
+
}
|
|
38
|
+
}
|