VibeScript Execution Profiles & Host Native Bridge
vibe-host is the execution and capability adapter boundary for VibeScript (vibe-0.1 and vibe-0.03).
Poet is a creative user interface that consumes that host boundary; it is not the host ABI itself.
Every capability invocation declares its execution route, numerical exactness contract (ExactnessProfile),
and failure semantics up front—never silently substituting a synthetic mock when a paired native capability is required.
1. Execution Modes & The vibe-host Boundary
You do not need a local native installation to explore VibeScript or Q42: the
RDF → Q42 → Vibe browser demo,
the Live Playground, and the
Interactive Showcase run their standalone WASM surfaces
directly in the browser via LocalHost. The native bridge exists only when a program deliberately invokes a paired native capability
(such as persistent SLG graph mutations, hardware GPU/QPU dispatch, or local daemon storage).
The local QualiaDB daemon exposes GET /vibe/capabilities. Its versioned JSON response uses the
qualia-vibe-bridge/1 protocol and makes the execution route explicit for each of the 105 capability families.
The endpoint is open without a token only in daemon development mode; production requests require an
X-Qualia-Token accepted by the local hardware-backed key vault.
| Execution Mode | Capability Route | Semantics & Guarantee |
|---|---|---|
standalone-wasm / exact |
In-process WASM (LocalHost) |
The loaded WebAssembly module performs the complete calculation locally inside the browser or WASI sandbox (e.g. Cosmic.* astrometry, LinearAlgebra.* small tensors, pure CompiledCell evaluation, and vibe::diagnose). |
standalone-snapshot / isolated-snapshot |
In-memory .q42 / NQuin snapshot |
The WASM host evaluates queries and SHACL/deontic checks against an isolated in-memory graph snapshot loaded into the tab. Results are deterministic and parity-checked, but do not mutate a persistent native graph transaction log. |
native-bridge |
Paired local daemon (qualia-vibe-bridge/1) |
The operation requires a paired local native daemon (persistent 42 MiB SLG Arena transactions, wgpu/Vulkan compute shaders, or hardware sensor buses). If the daemon is absent, the call fails closed with diagnostic E300 rather than substituting a silent mock calculation. |
Authenticated Browser-to-Daemon IPC
The primary browser transport is authenticated loopback HTTP (/query, /update, and /vibe/capabilities).
A browser client probes only after an explicit user gesture, presents the X-Qualia-Token pairing header, and handles requests asynchronously via an async suspend/resume execution surface rather than blocking the synchronous Host trait.
Local CLI & Edge Runners
WASI transports form a distinct adapter family from browser WASM. A local WASI runner or embedded edge node communicates over framed stdio or a Unix-domain socket (UDS), whereas browser WASM strictly uses the authenticated loopback service.
Zero Silent Substitution
When a capability family requires native-bridge authority or leased hardware access that is not present in the current host profile, vibe-host returns a structured E300 capability-unavailable diagnostic with the exact Family.method ID.
2. ExactnessProfile (ADR 0003 Numerical & Replay Contract)
Across scientific computing, geometric predicates, cryptographic parity, and interactive 3D rendering, different workloads require fundamentally different numerical guarantees.
Defined in ADR 0003 and enforced across the QualiaDB capability registry (`capability_manifests.rs`) and VibeScript host dispatch,
ExactnessProfile classifies every kernel into one of four explicit tiers so callers and proof verifiers know whether an output is bit-identical, interval-certified, bounded-deterministic, or interactive-approximate:
ExactnessProfile Tier |
Mathematical & Bit-Level Contract | Representative QualiaDB & VibeScript Workloads |
|---|---|---|
Exact |
Bit-identical, zero-rounding-error arithmetic across all platforms (CPU, WASM, GPU). Uses rational/integer representations, Shewchuk adaptive expansion predicates, or the 256-bit 4-prime CRT cascade so signs, orientations, and modular reductions are mathematically exact. | 2D/3D robust geometric orientation & in-circle/in-sphere predicates, BFV homomorphic encryption modular rings, NQuin XOR parity & Merkle roots, deontic/epistemic logic verdicts, and compile-time IDF-04 firewall checks. |
CertifiedBand |
Guaranteed error enclosure $[v - \epsilon, v + \epsilon]$ or proven truncation tolerance. Adaptive quadrature or interval/ball arithmetic tracks error bounds and fails closed if the requested tolerance band cannot be certified within the iteration budget. | Cosmic.comoving_distance_mpc (flat $\Lambda\text{CDM}$ 15-point Gauss–Kronrod $G_7/K_{15}$ quadrature with explicit error estimate), IAU 2006/2000B astrometric transforms, and certified PDE/ODE solvers. |
DeterministicBounded |
Fixed reduction order, fixed iteration ceiling, and deterministic IEEE-754 floating-point schedule (no non-associative thread-race reductions). Replaying the same input snapshot and seed yields deterministic trajectories within bounded memory. | 64 Hz etalon-sim XPBD continuum physics, EcoPunk 26.5 km watershed hydrology & FvCB photosynthesis, Hartree-Fock / DFT SCF convergence ($10^{-8}\text{ E}_{\text{h}}$), and CompiledCell reactive DAG evaluation. |
InteractiveApproximate |
Throughput-prioritized real-time approximation for visual presentation, HUD overlays, and speculative preview passes. Never permitted to author authoritative graph truth, deontic permissions, or topological sign predicates. | 10D volumetric raymarching preview shaders, bloom/depth post-processing, real-time audio wavefield spatialization, and interactive camera spring smoothing. |
3. The 256-Bit 4-Prime CRT (Chinese Remainder Theorem) Cascade
Standard 64-bit IEEE-754 floats (`f64`) lose precision beyond 53bits of mantissa, causing catastrophic cancellation in determinant signs, high-degree polynomial evaluations, and lattice cryptography when coordinates span astronomical or sub-Planck ranges. Meanwhile, arbitrary-precision heap bigints (`BigInt`) violate QualiaDB's Tier-1 Zero-Heap rule and cannot coalesce on GPU workgroups or inside the 42 MiB Sentinel arena.
QualiaDB solves this across the native and WASM boundary with a stack-allocated, zero-heap 256-bit 4-Prime Chinese Remainder Theorem (CRT) Cascade:
Four Pairwise-Coprime 63-Bit NTT-Friendly Primes
Large integer and polynomial ring computations are projected into four independent 64-bit prime moduli $(p_0, p_1, p_2, p_3)$ whose product $M = p_0 p_1 p_2 p_3 > 2^{252}$ spans the full 256-bit dynamic range. Every addition, subtraction, and multiplication executes in parallel across the four lanes without inter-word carry propagation.
Deterministic 4-Word Reconstruction
When an exact sign, magnitude comparison, or canonical 256-bit digest is required, the 4-stage Garner mixed-radix CRT cascade reconstructs the unique signed integer in $(-M/2, M/2)$ using precomputed multiplicative inverses $c_{ij} = p_i^{-1} \bmod p_j$ in fixed `[u64; 4]` stack registers—zero heap allocations, constant branchless control flow.
Unified Native, WASM & WGSL Verification
Because each RNS lane uses exact integer modular arithmetic and the Garner cascade follows a fixed 4-step sequence, `standalone-wasm` in the browser and `native-bridge` on x86_64/ARM64/WGSL produce bit-for-bit identical 256-bit outputs under ExactnessProfile::Exact.
// Conceptual layout of the zero-heap 256-bit 4-Prime CRT Cascade (ExactnessProfile::Exact)
// Moduli: 4 pairwise-coprime primes near 2^63 -> dynamic range M = p0 * p1 * p2 * p3 > 2^252
#[repr(C)]
#[derive(Clone, Copy, PartialEq, Eq)]
pub struct Crt256Residue {
pub r: [u64; 4], // Residue lanes (x mod p0, x mod p1, x mod p2, x mod p3)
}
// 1. Parallel carry-free ring ops in RNS basis:
// z.r[i] = (x.r[i] * y.r[i]) mod p[i] for i in 0..4
// 2. Deterministic 4-step Garner mixed-radix cascade -> signed [u64; 4] & exact signum {-1, 0, +1}4. qualia-vibe-bridge/1 Capability Handshake Example
When inspecting a host via GET /vibe/capabilities (or querying LocalHost in the browser), the bridge reports the protocol version, active execution mode, supported ExactnessProfile tiers, and family availability:
{
"protocol": "qualia-vibe-bridge/1",
"engineVersion": "0.0.41",
"dialect": "vibe-0.1",
"sentinelCeilingBytes": 44040192,
"modes": {
"Cosmic.geodetic_to_ecef": {
"mode": "standalone-wasm",
"exactness": "CertifiedBand",
"allocation": "HotZeroHeap"
},
"Cosmic.apply_lorentz_boost": {
"mode": "standalone-wasm",
"exactness": "CertifiedBand",
"allocation": "HotZeroHeap"
},
"LinearAlgebra.crt256_det_sign": {
"mode": "standalone-wasm",
"exactness": "Exact",
"crtCascade": "4-prime-256bit",
"allocation": "HotZeroHeap"
},
"GraphDatabase.commit_slg_transaction": {
"mode": "native-bridge",
"exactness": "Exact",
"requiresAuth": "X-Qualia-Token"
}
}
}VibeScript ABI (vibescript-abi), Capabilities & Deterministic .hmc
The canonical language engine in crates/vibe pairs with crates/vibescript-abi (src/sdk.rs) and C:\github\vibe-script tooling. Scripts declare explicit host capabilities via requires [capability("...")] and compile deterministically into SHA-256 verified .hmc containers.
Provider Descriptors & Lifecycle
Host providers register typed FuncDescriptor, OntologicalContract, and AdmissionTicket contracts with explicit memory/lamport bounds.
Explicit Capability Gates
requires [capability("capability.invoke")] gates every privileged host or Hypermedia morphism call at admission time.
Deterministic .hmc Compilation
Identical VibeScript sources produce bit-identical SHA-256 .hmc containers across native and WASM profiles.