faf-wasm-core
v1.0.0
Published
The kernel router for FAF WASM engines. Routes to faf-wasm-sdk (Rust) today, Zig Cascade tomorrow. One interface, any engine.
Maintainers
Readme
faf-wasm-core
The kernel router for FAF WASM engines. One interface, any kernel, same score.
Scores .faf files (IANA-registered AI-context format) via embedded WASM. Routes to faf-wasm-sdk (Rust Mk4) today.
Install
npm install faf-wasm-coreUsage
import { init } from "faf-wasm-core";
const kernel = await init("rust"); // or "zig" when Cascade ships
const result = kernel.score(yaml);
// result.score = 100
// result.populated = 11
// result.ignored = 10
// result.active = 11The Interface
Every kernel implements FafKernel:
interface FafKernel {
score(yaml: string): ScoreResult;
scoreEnterprise(yaml: string): ScoreResult;
validate(yaml: string): boolean;
compile(yaml: string): Uint8Array;
decompile(bytes: Uint8Array): FafbInfo;
scoreBinary(bytes: Uint8Array): ScoreBinaryResult;
binaryInfo(bytes: Uint8Array): FafbInfo;
version(): string;
readonly engine: "rust" | "zig";
readonly engineVersion: string;
}Capabilities
Not every kernel supports every method:
| Method | Rust | Zig (future) | |--------|------|-------------| | score | Yes | Yes | | scoreEnterprise | Yes | No | | validate | Yes | Yes | | compile | Yes | No | | decompile | Yes | No | | scoreBinary | Yes | No | | binaryInfo | Yes | No |
Unsupported methods throw KernelCapabilityError.
What's Inside
- 322KB embedded Rust WASM binary (Mk4 engine)
- 284μs per score
- Zero dependencies
- 36 tests passing
Consumers
- bun-sticky — Bun CLI (embeds core)
- builder.faf.one — Browser scorer
Part of the FAF Ecosystem
FAF (Foundational AI-context Format) — IANA-registered (application/vnd.faf+yaml). 36,000+ downloads across npm, PyPI, and crates.io.
License
MIT
