Commit the WAI standard source: a content + capability-dispatch standard
whose thesis is "carries whatever it can reconstruct, verifies whatever
it carries." Source only — large vendored/model assets and build output
are gitignored.
Reconstruct classes (each: spec + conformance corpus + in-tab browser
sink that re-derives the corpus hash, one wai.det.fixed64 fixed-point
floor, one *-equivalence apiece):
- interactive worlds (replay-equivalence) + 3 sim registrants,
multiplayer over a relay, session receipts, glTF + real SPZ assets
- spatial audio (mixdown-equivalence)
- haptics (sample-equivalence)
- state-feeds (replay-equivalence, non-physics sim)
- avatars / digital humans (pose-equivalence) + telepresence over the relay
- volumetric / 4D splats (frame-state-equivalence) + WebGPU EWA render,
real-SPZ-derived clip
Verify half (lever 4):
- asset provenance: a signed, energy-accounted lineage for opaque
captured content WAI does not reconstruct; tamper-evident, in-tab.
Cross-cutting: JWP receipt profiles per class; a native energy meter
(IOReport via macmon, no sudo) emitting receipts with REAL measured
joules; the learned-image/neural codec family and JPEG AI entropy port
from earlier work.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
177 lines
7.3 KiB
TOML
177 lines
7.3 KiB
TOML
[package]
|
|
name = "wai"
|
|
version = "0.3.0"
|
|
edition = "2024"
|
|
rust-version = "1.96"
|
|
license = "Apache-2.0"
|
|
description = "WAI — Web AI media transport + execution. Capability-as-requirement envelope + neural shared-prior regenerate-at-sink path + always-available zeroth-condition wrappers around SOTA standard codecs (AVIF / JPEG-XL / PNG / Opus / FLAC / AV1 / zstd / LZMA)."
|
|
|
|
[lib]
|
|
name = "wai"
|
|
crate-type = ["lib", "cdylib", "staticlib"] # cdylib + staticlib for FFI/SDK
|
|
|
|
[dependencies]
|
|
# Container manifest. preserve_order so JSON round-trips byte-identical.
|
|
serde = { version = "1", features = ["derive"] }
|
|
serde_json = { version = "1", features = ["preserve_order"] }
|
|
|
|
# ---- zeroth codec wrappers: lossy + lossless across all media ----
|
|
# All optional behind the (default-on) `codecs` feature: native sinks get
|
|
# the full menu; a wasm32 world sink builds with --no-default-features
|
|
# --features world and none of the C codec chain. Registration (the
|
|
# capability strings in codecs/mod.rs) is NOT gated — only the decoders.
|
|
# Image
|
|
image = { version = "0.25", default-features = false,
|
|
features = ["png", "jpeg", "webp", "avif"], optional = true } # PNG, JPEG decode, AVIF encode (via ravif)
|
|
jpeg-encoder = { version = "0.7", optional = true } # pure-Rust JPEG with optimized Huffman tables
|
|
libavif-image = { version = "0.14", optional = true } # AVIF decode via system libavif (fixes silent-empty decode bug)
|
|
jpegxl-rs = { version = "0.14", optional = true } # libjxl bindings (links system libjxl 0.11.x)
|
|
# Audio
|
|
opus = { version = "0.3", optional = true } # libopus bindings (lossy)
|
|
ogg = { version = "0.9", optional = true } # Ogg container for standard .opus interop
|
|
claxon = { version = "0.4", optional = true } # FLAC decode (pure Rust)
|
|
flac-bound = { version = "0.5", optional = true } # FLAC encode (libFLAC)
|
|
# Video
|
|
rav1e = { version = "0.8", default-features = false, features = ["threading"], optional = true }
|
|
dav1d = { version = "0.11", optional = true } # AV1 decode (libdav1d)
|
|
# Text
|
|
zstd = { version = "0.13", optional = true } # zstd bindings
|
|
xz2 = { version = "0.1", optional = true } # liblzma bindings (XZ/LZMA)
|
|
|
|
# Bytestream framing for video container (we wrap rav1e packets into a
|
|
# minimal IVF-like sequence for self-contained .wai video payloads).
|
|
byteorder = { version = "1", optional = true }
|
|
|
|
# ---- neural runtime (optional, behind the `neural` feature) ----
|
|
# `ort` wraps Microsoft's onnxruntime — same ORT version (1.26) the
|
|
# browser-side wai-web demo uses, so models built with our exporters
|
|
# load identically here. The `download-binaries` feature fetches the
|
|
# right libonnxruntime build at compile time; no manual brew install.
|
|
ort = { version = "2.0.0-rc.12", default-features = false,
|
|
features = ["std", "download-binaries", "ndarray", "tls-rustls"],
|
|
optional = true }
|
|
ndarray = { version = "0.17", optional = true }
|
|
zstd-safe = { version = "7", optional = true } # for bmshj2018 latent unpack
|
|
sha2 = { version = "0.10", optional = true } # verify a pinned neural prior against the registered model artifact
|
|
|
|
# ---- interactive worlds (optional, behind the `world` feature) ----
|
|
# extensions/interactive-worlds: WWLD container, signed CausalOps,
|
|
# deterministic fixed-point simulation, replay-equivalence conformance.
|
|
blake3 = { version = "1", optional = true } # state hashes, node minting, op/seal commitments
|
|
ed25519-dalek = { version = "2", optional = true } # op + seal signatures
|
|
|
|
[features]
|
|
default = ["codecs"]
|
|
# The zeroth-condition codec wrappers (image/audio/video/text) + the C
|
|
# FFI surface built on them. Default-on: a native sink is a full sink.
|
|
# Disable for targets where the C codec chain can't follow (wasm32) —
|
|
# the envelope, manifest, and `world` engine build without it.
|
|
codecs = [
|
|
"dep:image", "dep:jpeg-encoder", "dep:libavif-image", "dep:jpegxl-rs",
|
|
"dep:opus", "dep:ogg", "dep:claxon", "dep:flac-bound",
|
|
"dep:rav1e", "dep:dav1d",
|
|
"dep:zstd", "dep:xz2", "dep:byteorder",
|
|
]
|
|
# Pulls in the ONNX runtime + zstd unpack so the native sink can
|
|
# decode `wai.neural.<...>` envelopes. Off by default — the bare
|
|
# container + zeroth codecs build with no ML dep chain.
|
|
neural = ["codecs", "dep:ort", "dep:ndarray", "dep:zstd-safe", "dep:sha2"]
|
|
# The perceptual / generative-semantic path: CLIP-similarity conformance,
|
|
# regenerate-at-sink. Reuses the ONNX runtime for the reference CLIP embedder;
|
|
# the generator is always sink-supplied. Off by default like `neural`.
|
|
semantic = ["codecs", "dep:ort", "dep:ndarray"]
|
|
# Interactive worlds (extensions/interactive-worlds): media that consumes
|
|
# input. Pure-Rust, no ML dep chain — the sim is closed-form fixed-point.
|
|
world = ["dep:blake3", "dep:ed25519-dalek"]
|
|
# Object-based spatial audio (extensions/spatial-audio): the deterministic
|
|
# Fx mixdown engine. Reuses the world `Fx` floor + blake3; no codec/ML deps
|
|
# (sources arrive as decoded mono PCM — decoding the wai.audio.* assets is
|
|
# the sink's job, exactly as glb/spz decode is).
|
|
audio_scene = ["world"]
|
|
# Haptics (extensions/haptics): touch as a tiny keyframed envelope,
|
|
# reconstructed in the Fx floor. Sample-equivalence; no codec/ML deps.
|
|
haptic = ["world"]
|
|
# Volumetric / 4D temporal Gaussian splats (extensions/volumetric): each
|
|
# Gaussian's keyframed tracks reconstructed at frame N in the Fx floor.
|
|
# Frame-state-equivalence; no codec/ML deps (the render is the sink's).
|
|
splat4d = ["world"]
|
|
# Asset provenance (extensions/provenance): a signed, energy-accounted
|
|
# lineage receipt for opaque captured content WAI does not reconstruct.
|
|
# Reuses the JWP Merkle + Ed25519; no codec/ML deps.
|
|
provenance = ["world"]
|
|
|
|
[[bin]]
|
|
name = "wai"
|
|
path = "src/bin/wai.rs"
|
|
required-features = ["codecs"]
|
|
|
|
[[bin]]
|
|
name = "wai_world_vectors"
|
|
path = "src/bin/wai_world_vectors.rs"
|
|
required-features = ["world"]
|
|
|
|
[[bin]]
|
|
name = "wai_world_meter"
|
|
path = "src/bin/wai_world_meter.rs"
|
|
required-features = ["world"]
|
|
|
|
[[bin]]
|
|
name = "wai_audio_vectors"
|
|
path = "src/bin/wai_audio_vectors.rs"
|
|
required-features = ["audio_scene"]
|
|
|
|
[[bin]]
|
|
name = "wai_haptic_vectors"
|
|
path = "src/bin/wai_haptic_vectors.rs"
|
|
required-features = ["haptic"]
|
|
|
|
[[bin]]
|
|
name = "wai_feed_vectors"
|
|
path = "src/bin/wai_feed_vectors.rs"
|
|
required-features = ["world"]
|
|
|
|
[[bin]]
|
|
name = "wai_avatar_vectors"
|
|
path = "src/bin/wai_avatar_vectors.rs"
|
|
required-features = ["world"]
|
|
|
|
[[bin]]
|
|
name = "wai_splat4d_vectors"
|
|
path = "src/bin/wai_splat4d_vectors.rs"
|
|
required-features = ["splat4d"]
|
|
|
|
[[bin]]
|
|
name = "wai_meter"
|
|
path = "src/bin/wai_meter.rs"
|
|
required-features = ["haptic", "splat4d"]
|
|
|
|
[[bin]]
|
|
name = "wai_prov"
|
|
path = "src/bin/wai_prov.rs"
|
|
required-features = ["provenance", "codecs"]
|
|
|
|
[[bin]]
|
|
name = "wai_bench"
|
|
path = "src/bin/wai_bench.rs"
|
|
required-features = ["codecs"]
|
|
|
|
[[bin]]
|
|
name = "wai_bench_diff"
|
|
path = "src/bin/wai_bench_diff.rs"
|
|
required-features = ["codecs"]
|
|
|
|
[dev-dependencies]
|
|
serde_json = { version = "1", features = ["preserve_order"] } # construct manifests in tests
|
|
|
|
[build-dependencies]
|
|
pkg-config = "0.3" # locate system libflac (cross-platform; replaces
|
|
# the macOS-hardcoded .cargo/config.toml rustflags)
|
|
cbindgen = { version = "0.29", default-features = false }
|
|
# generate include/wai.h from the FFI surface so
|
|
# SDK consumers get a typed C header instead of
|
|
# hand-writing extern decls
|
|
|
|
[profile.release]
|
|
opt-level = 3
|
|
lto = true
|
|
codegen-units = 1
|