open-standards/wai/wai-rs/Cargo.toml
Transaction Science bdfddb5e01 msrv: raise the rust-version floor to 1.97 across the workspaces
The declared MSRV had drifted into three tiers — 1.85, 1.96, and one
1.96.0 — none of them the compiler the code is actually built and pinned
against (now 1.97.1, rust-toolchain.toml). Raising the floor to 1.97
makes the support commitment honest: it states the oldest compiler these
standards are actually verified on, rather than a floor no CI ever
exercises.

This is the deliberate MSRV bump that the 1.97.1 toolchain PR explicitly
left out, because raising a library's floor is a support-policy decision,
not an automatic consequence of moving a build box. Done here as its own
change, on request. 26 workspace manifests, minor-version precision to
match the repo's dominant style. sandbox-rs (was 1.85) and eoc-rs (was
1.96) build + test clean under the pin.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-07-23 00:17:08 -04:00

277 lines
12 KiB
TOML

[package]
name = "wai"
version = "0.3.0"
edition = "2024"
rust-version = "1.97"
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, features = ["std"] } # for bmshj2018 latent unpack (std → WriteBuf for Vec)
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.
# The integer-exact synthesis decoder (`wai.neural.int_synth`). Pure i64
# arithmetic — no ONNX, no float, bit-identical on every machine by
# construction — so it sits behind its own light feature, checkable in a CI
# matrix with no ONNX Runtime present. `neural` pulls it in. blake3 is for the
# conformance corpus's content hash (the same hash the other classes freeze).
neural_int = ["dep:blake3"]
# Deterministic integer generative synthesis (`wai.generate.*`): byte-exact
# generation pinned to (model, prompt, seed, steps) — the create-side of the
# integer contract. Pure i64, no ONNX/float (serde_json is already a base dep),
# so it builds and is bit-checkable with no ML dep chain, and compiles to wasm32.
generate = []
# Deterministic integer inter-frame VIDEO (`wai.video.int_motion`): byte-exact
# frame-by-frame decode — integer block motion compensation + integer-quantized
# residual over the rANS coder. Frame-state-equivalence (per-frame hash); the
# temporal extension of the integer contract. Reuses the pure-i64 rANS (neural_int).
video_int = ["neural_int"]
# Integer-exact LEARNED audio codec (`wai.audio.int_codec`): a learned 1-D transform
# codec, integer transposed-conv synthesis → byte-exact int16 PCM (sample-equivalence,
# a portable PCM hash). The audio analog of int_hyper. Reuses pure-i64 rANS + IGDN.
audio_int = ["neural_int"]
# Integer-exact INTERACTIVE WORLD MODEL (the byte-exact renderer for wai.world.model):
# action-conditioned next-frame model, transition + synthesis both int_hyper IntModels.
# Reuses int_hyper_synth (neural_int).
world_int = ["neural_int"]
# Integer-exact LEARNED Gaussian-splat ATTRIBUTE codec ("the int_hyper of 3D"):
# learned transform over the [14,S,S] attribute image → byte-exact attribute tensor
# (splat-equivalence, a portable cloud hash). Reuses int_hyper_synth (neural_int).
splat_int = ["neural_int"]
neural = ["neural_int", "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"]
# Music as instructions (extensions/score): a note-event score rendered to
# a canonical PCM mixdown by a deterministic trig-free synth in the Fx
# floor. Mixdown-equivalence; no codec/ML deps (the instrument is the sink's).
score = ["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"]
# wai.world.model — generative-world transport: a signed, replay-equivalent action
# trace (reuses the world CausalOp log) + per-frame provenance. The neural sibling
# of wai.world.replay; the renderer is a declared world model (sink-supplied, or the
# int_* family for byte-exact frames).
world_model = ["world", "provenance"]
# Linear film (extensions/linear-film): a film is a sealed camera-on-rails
# world — the world replay (replay-equivalence) + a keyframed camera track
# (Fx floor) + a frame schedule, verified frame-by-frame (film-equivalence).
# Composes the world engine; pulls `score` so a reel can embed a soundtrack
# (one envelope = movie + sound). No codec/ML deps (the render is the sink's).
film = ["world", "score"]
# Codec-chain examples gate on `codecs` (they call the C codec wrappers), so
# a `--no-default-features --features neural` build doesn't try to compile them.
[[example]]
name = "gen_preview"
path = "examples/gen_preview.rs"
required-features = ["generate"]
[[example]]
name = "int_hyper_decode_frame"
path = "examples/int_hyper_decode_frame.rs"
required-features = ["neural_int"]
[[example]]
name = "int_audio_decode"
path = "examples/int_audio_decode.rs"
required-features = ["audio_int"]
[[example]]
name = "int_world_decode"
path = "examples/int_world_decode.rs"
required-features = ["world_int"]
[[example]]
name = "int_splat_decode"
path = "examples/int_splat_decode.rs"
required-features = ["splat_int"]
[[example]]
name = "opus_check"
path = "examples/opus_check.rs"
required-features = ["codecs"]
[[example]]
name = "dl_check"
path = "examples/dl_check.rs"
required-features = ["codecs"]
[[example]]
name = "jpeg_test"
path = "examples/jpeg_test.rs"
required-features = ["codecs"]
[[bin]]
name = "wai"
path = "src/bin/wai.rs"
required-features = ["codecs"]
[[bin]]
name = "wai_int_synth_vectors"
path = "src/bin/wai_int_synth_vectors.rs"
required-features = ["neural_int"]
[[bin]]
name = "wai_film_vectors"
path = "src/bin/wai_film_vectors.rs"
required-features = ["film"]
[[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", "score", "film"]
[[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
[[bin]]
name = "wai_score_vectors"
path = "src/bin/wai_score_vectors.rs"
required-features = ["score"]