Skip to main content

Host

Trait Host 

Source
pub trait Host {
Show 47 methods // Required methods fn graph_query( &mut self, args: &[Value], take: u64, span: Span, ) -> Result<Value, Diagnostic>; fn graph_stage( &mut self, term: &Value, span: Span, ) -> Result<Value, Diagnostic>; fn graph_commit(&mut self, span: Span) -> Result<Value, Diagnostic>; fn aura_validate( &mut self, node: &Value, shape: &Value, span: Span, ) -> Result<Value, Diagnostic>; fn pulse_publish( &mut self, topic: &str, payload: &Value, span: Span, ) -> Result<Value, Diagnostic>; // Provided methods fn graph_begin(&mut self, _span: Span) -> Result<(), Diagnostic> { ... } fn graph_abort(&mut self, _span: Span) -> Result<(), Diagnostic> { ... } fn graph_end(&mut self, span: Span) -> Result<(), Diagnostic> { ... } fn time_unix(&mut self, span: Span) -> Result<Value, Diagnostic> { ... } fn time_now(&mut self, span: Span) -> Result<Value, Diagnostic> { ... } fn time_unix_nanos(&mut self, span: Span) -> Result<Value, Diagnostic> { ... } fn time_monotonic_nanos(&mut self, _span: Span) -> Result<Value, Diagnostic> { ... } fn quin_seal( &mut self, subject: u64, predicate: u64, object: u64, context: u64, span: Span, ) -> Result<Value, Diagnostic> { ... } fn hash_iri(&self, iri: &str) -> u64 { ... } fn graph_snapshot(&mut self, _span: Span) -> Result<Value, Diagnostic> { ... } fn capability_resolve( &mut self, id: &str, _span: Span, ) -> Result<Value, Diagnostic> { ... } fn capability_invoke( &mut self, id: &str, _args: &Value, span: Span, ) -> Result<Value, Diagnostic> { ... } fn host_version(&self) -> &str { ... } fn environment(&self) -> HostEnvironment { ... } fn acceleration_tier(&self) -> AccelerationTier { ... } fn available_acceleration(&self) -> AccelerationTier { ... } fn time_proper_time( &mut self, _worldline_id: u64, span: Span, ) -> Result<Value, Diagnostic> { ... } fn receipt_clock(&mut self, span: Span) -> Result<Value, Diagnostic> { ... } fn field_sample( &mut self, _field_ref: u64, _pose: &Value, span: Span, ) -> Result<Value, Diagnostic> { ... } fn law_apply( &mut self, _law_ref: u64, _args: &[Value], span: Span, ) -> Result<Value, Diagnostic> { ... } fn supports_isolation(&self) -> bool { ... } fn conservation_check( &mut self, _quantity: &ConservationQuantity, _before: &Value, _after: &Value, _tolerance: f64, span: Span, ) -> Result<Value, Diagnostic> { ... } fn causal_relation( &mut self, _event_a: &Value, _event_b: &Value, span: Span, ) -> Result<Value, Diagnostic> { ... } fn dag_execute( &mut self, _pipeline: &Value, _blackboard: &Value, span: Span, ) -> Result<Value, Diagnostic> { ... } fn dag_validate( &mut self, _pipeline: &Value, span: Span, ) -> Result<Value, Diagnostic> { ... } fn deontic_check( &mut self, _capability: &str, _phase: &str, span: Span, ) -> Result<Value, Diagnostic> { ... } fn hid_poll(&mut self, span: Span) -> Result<Value, Diagnostic> { ... } fn hid_wait( &mut self, _timeout_ns: u64, span: Span, ) -> Result<Value, Diagnostic> { ... } fn cue_post( &mut self, _cue_id: &str, _payload: &Value, span: Span, ) -> Result<Value, Diagnostic> { ... } fn crypto_hash( &mut self, _algorithm: &str, _data: &str, span: Span, ) -> Result<Value, Diagnostic> { ... } fn crypto_hkdf( &mut self, _ikm: &str, _info: &str, _length: u64, span: Span, ) -> Result<Value, Diagnostic> { ... } fn crypto_aead_encrypt( &mut self, _algorithm: &str, _key_hex: &str, _nonce_hex: &str, _plaintext: &str, _aad: &str, span: Span, ) -> Result<Value, Diagnostic> { ... } fn crypto_aead_decrypt( &mut self, _algorithm: &str, _key_hex: &str, _nonce_hex: &str, _ciphertext_hex: &str, _tag_hex: &str, _aad: &str, span: Span, ) -> Result<Value, Diagnostic> { ... } fn crypto_sign( &mut self, _key_id: &str, _data: &str, span: Span, ) -> Result<Value, Diagnostic> { ... } fn crypto_verify( &mut self, _key_id: &str, _data: &str, _signature_hex: &str, span: Span, ) -> Result<Value, Diagnostic> { ... } fn crypto_generate_key( &mut self, _algorithm: &str, span: Span, ) -> Result<Value, Diagnostic> { ... } fn zk_prove_threshold( &mut self, _value: u64, _threshold: u64, span: Span, ) -> Result<Value, Diagnostic> { ... } fn zk_verify_threshold( &mut self, _proof_hex: &str, _vk_hex: &str, _threshold: u64, span: Span, ) -> Result<Value, Diagnostic> { ... } fn zk_prove_range( &mut self, _value: u64, _lo: u64, _hi: u64, span: Span, ) -> Result<Value, Diagnostic> { ... } fn zk_verify_range( &mut self, _proof_hex: &str, _vk_hex: &str, _lo: u64, _hi: u64, span: Span, ) -> Result<Value, Diagnostic> { ... } fn zk_prove_matmul( &mut self, _m: u64, _k: u64, _n: u64, _a: &[i128], _b: &[i128], span: Span, ) -> Result<Value, Diagnostic> { ... } fn zk_list_circuits(&mut self, span: Span) -> Result<Value, Diagnostic> { ... }
}
Expand description

Host supplied by Qualia / tests.

Required Methods§

Source

fn graph_query( &mut self, args: &[Value], take: u64, span: Span, ) -> Result<Value, Diagnostic>

Source

fn graph_stage(&mut self, term: &Value, span: Span) -> Result<Value, Diagnostic>

Source

fn graph_commit(&mut self, span: Span) -> Result<Value, Diagnostic>

Source

fn aura_validate( &mut self, node: &Value, shape: &Value, span: Span, ) -> Result<Value, Diagnostic>

Source

fn pulse_publish( &mut self, topic: &str, payload: &Value, span: Span, ) -> Result<Value, Diagnostic>

Provided Methods§

Source

fn graph_begin(&mut self, _span: Span) -> Result<(), Diagnostic>

Open a transaction. Default is a no-op.

Source

fn graph_abort(&mut self, _span: Span) -> Result<(), Diagnostic>

Drop uncommitted staged work. Default is a no-op.

Source

fn graph_end(&mut self, span: Span) -> Result<(), Diagnostic>

Complete a transaction { ... } block on normal exit.

Hosts that stage writes inside a transaction override this to commit uncommitted work; the default delegates to graph_abort for backwards compatibility with external mock hosts.

Source

fn time_unix(&mut self, span: Span) -> Result<Value, Diagnostic>

Wall clock as seconds since Unix epoch. External (core §11): forbidden in Pure cells. Default fails closed with E702 (WASM / hosts without a clock); native hosts override with SystemTime::now. Replay uses the receipt clock, not this binding.

DEPRECATED (X6, 2026-08-20): Use time_now instead. Integer seconds cannot support sub-frame animation, physics dt, or deterministic WASM replay. Kept as a projection helper for display/logging only.

Source

fn time_now(&mut self, span: Span) -> Result<Value, Diagnostic>

The primary time primitive (X6): returns Value::Instant with nanosecond resolution, explicit TimeScale, and optional seal. Default fails closed with E702. Native hosts override with SystemTime::now → Instant::unix(secs, nanos).

Source

fn time_unix_nanos(&mut self, span: Span) -> Result<Value, Diagnostic>

Structured Unix time: { secs: I64, nanos: U64 } (T19). Default calls time_unix and wraps it into a Record.

Source

fn time_monotonic_nanos(&mut self, _span: Span) -> Result<Value, Diagnostic>

Monotonic nanos for frame timing and physics dt (T20). Default returns 0 (WASM has no monotonic clock until W12 replay Instant).

Source

fn quin_seal( &mut self, subject: u64, predicate: u64, object: u64, context: u64, span: Span, ) -> Result<Value, Diagnostic>

Source

fn hash_iri(&self, iri: &str) -> u64

Source

fn graph_snapshot(&mut self, _span: Span) -> Result<Value, Diagnostic>

Source

fn capability_resolve( &mut self, id: &str, _span: Span, ) -> Result<Value, Diagnostic>

Source

fn capability_invoke( &mut self, id: &str, _args: &Value, span: Span, ) -> Result<Value, Diagnostic>

Reach an engine capability by id. Default fails closed.

LocalHost() answers from in-process catalog kernels (animation, HID). Poet and other hosts override this to reach the engine.

Source

fn host_version(&self) -> &str

Host ABI version. Returns “vibe-host-0.1” for the current trait surface. Hosts that add methods beyond 0.1 should return “vibe-host-0.2” or higher.

Source

fn environment(&self) -> HostEnvironment

Source

fn acceleration_tier(&self) -> AccelerationTier

Source

fn available_acceleration(&self) -> AccelerationTier

What the machine could run. Default equals this pass (acceleration_tier).

Source

fn time_proper_time( &mut self, _worldline_id: u64, span: Span, ) -> Result<Value, Diagnostic>

Proper time along a worldline, in seconds. Default: not available (E702). Hosts with a manifold metric implementation override this.

Source

fn receipt_clock(&mut self, span: Span) -> Result<Value, Diagnostic>

Deterministic replay clock for WASM. Returns None when no replay clock is configured. When Some, the returned { secs, nanos } is used instead of wall-clock time.

Source

fn field_sample( &mut self, _field_ref: u64, _pose: &Value, span: Span, ) -> Result<Value, Diagnostic>

Sample a field at a pose. Returns a Quantity. Default: E702.

Source

fn law_apply( &mut self, _law_ref: u64, _args: &[Value], span: Span, ) -> Result<Value, Diagnostic>

Apply a law to arguments. Returns a Receipt. Default: E702.

Source

fn supports_isolation(&self) -> bool

Whether this host supports isolation snapshots for dry-run evaluation. Default: false. Hosts that can create an isolated snapshot (e.g. PoetSnapshot::fork) override this to return true.

Source

fn conservation_check( &mut self, _quantity: &ConservationQuantity, _before: &Value, _after: &Value, _tolerance: f64, span: Span, ) -> Result<Value, Diagnostic>

Check whether a transformation preserves a conserved quantity (T34).

Given the before and after states (as Mixtures or Records with mass/energy/charge fields), verify that the specified conserved quantity is preserved within tolerance. Default: E702 (no conservation checker available).

Source

fn causal_relation( &mut self, _event_a: &Value, _event_b: &Value, span: Span, ) -> Result<Value, Diagnostic>

Determine the causal relation between two events (T35).

Given two events (each an Instant + Pose, or a Record with time and position fields), determine whether they are timelike, lightlike, or spacelike separated. Default: E702 (no spacetime metric available).

Source

fn dag_execute( &mut self, _pipeline: &Value, _blackboard: &Value, span: Span, ) -> Result<Value, Diagnostic>

Execute a DAG pipeline (T24). The pipeline definition is passed as a Record value (from JSON or VibeScript construction). The host executes the DAG nodes in topological order, invoking capabilities for each node. Default: E702 (no DAG executor available on this host).

Source

fn dag_validate( &mut self, _pipeline: &Value, span: Span, ) -> Result<Value, Diagnostic>

Validate a DAG pipeline definition (T24). Returns Ok(Null) if valid, Err with diagnostic if invalid (cycle, missing budget, missing capability). Default: E702.

Source

fn deontic_check( &mut self, _capability: &str, _phase: &str, span: Span, ) -> Result<Value, Diagnostic>

Check a deontic prohibition (T25). Given a capability ID and the current phase, verify that the capability is allowed. If forbidden, returns a sealed DeonticInterrupt receipt. Default: E702 (no deontic checker available).

Source

fn hid_poll(&mut self, span: Span) -> Result<Value, Diagnostic>

Poll for the next inbound HID event (T42). Returns the next event from the host’s HID loop, or Null if no event is available (non-blocking). Default: E702 (no HID loop on this host).

Source

fn hid_wait( &mut self, _timeout_ns: u64, span: Span, ) -> Result<Value, Diagnostic>

Wait for the next inbound HID event with a timeout (T42). Returns the next event, or Null if the timeout expired. Default: E702.

Source

fn cue_post( &mut self, _cue_id: &str, _payload: &Value, span: Span, ) -> Result<Value, Diagnostic>

Post an outbound cue (T45) — haptic, audio, visual, or accessibility. The cue ID identifies the output channel and the payload carries the cue data. Default: E702.

Source

fn crypto_hash( &mut self, _algorithm: &str, _data: &str, span: Span, ) -> Result<Value, Diagnostic>

Compute a cryptographic hash (T-crypto). The algorithm is one of “SHA-256”, “SHA-512”, “BLAKE3”. The data is a String (UTF-8) or hex-encoded String. Returns a Record { algorithm, hex, bytes }. Default: E702 (no crypto provider on this host).

Source

fn crypto_hkdf( &mut self, _ikm: &str, _info: &str, _length: u64, span: Span, ) -> Result<Value, Diagnostic>

Derive a key using HKDF-SHA256 (T-crypto). Returns the derived key as a hex-encoded String. Default: E702.

Source

fn crypto_aead_encrypt( &mut self, _algorithm: &str, _key_hex: &str, _nonce_hex: &str, _plaintext: &str, _aad: &str, span: Span, ) -> Result<Value, Diagnostic>

AEAD encrypt (T-crypto). Returns a Record { algorithm, ciphertext_hex, tag_hex, nonce_hex }. Default: E702.

Source

fn crypto_aead_decrypt( &mut self, _algorithm: &str, _key_hex: &str, _nonce_hex: &str, _ciphertext_hex: &str, _tag_hex: &str, _aad: &str, span: Span, ) -> Result<Value, Diagnostic>

AEAD decrypt (T-crypto). Returns the plaintext as a String, or an error if decryption fails. Default: E702.

Source

fn crypto_sign( &mut self, _key_id: &str, _data: &str, span: Span, ) -> Result<Value, Diagnostic>

Sign data with a key (T-crypto). The key_id identifies the key in the host’s key vault. Returns a Record { key_id, signature_hex, algorithm }. Default: E702.

Source

fn crypto_verify( &mut self, _key_id: &str, _data: &str, _signature_hex: &str, span: Span, ) -> Result<Value, Diagnostic>

Verify a signature (T-crypto). Returns Bool. Default: E702.

Source

fn crypto_generate_key( &mut self, _algorithm: &str, span: Span, ) -> Result<Value, Diagnostic>

Generate a new key (T-crypto). The algorithm is one of “Ed25519”, “ML-DSA-65”. Returns the key_id String. Default: E702.

Source

fn zk_prove_threshold( &mut self, _value: u64, _threshold: u64, span: Span, ) -> Result<Value, Diagnostic>

Prove, in zero knowledge, that a private value satisfies value >= threshold. Returns a Record { proof_hex, vk_hex, proof_id, circuit_id }. Default: E702 (no ZK proof system on this host).

Source

fn zk_verify_threshold( &mut self, _proof_hex: &str, _vk_hex: &str, _threshold: u64, span: Span, ) -> Result<Value, Diagnostic>

Verify a ZK threshold proof against a public threshold. Returns Bool. Default: E702.

Source

fn zk_prove_range( &mut self, _value: u64, _lo: u64, _hi: u64, span: Span, ) -> Result<Value, Diagnostic>

Prove, in zero knowledge, that a private value satisfies lo <= value <= hi. Returns a Record { proof_hex, vk_hex, proof_id, circuit_id }. Default: E702.

Source

fn zk_verify_range( &mut self, _proof_hex: &str, _vk_hex: &str, _lo: u64, _hi: u64, span: Span, ) -> Result<Value, Diagnostic>

Verify a ZK range proof against public bounds lo and hi. Returns Bool. Default: E702.

Source

fn zk_prove_matmul( &mut self, _m: u64, _k: u64, _n: u64, _a: &[i128], _b: &[i128], span: Span, ) -> Result<Value, Diagnostic>

Prove a matrix multiplication: given public A, B, and claimed C = A·B, prove the multiplication is correct without revealing the witness. Returns a Record { valid, result }. Default: E702.

Source

fn zk_list_circuits(&mut self, span: Span) -> Result<Value, Diagnostic>

List all registered ZK circuits. Returns a List of circuit IDs. Default: E702.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§