Skip to main content

ScopedEffects

Struct ScopedEffects 

Source
pub struct ScopedEffects<'a> { /* private fields */ }
Expand description

Borrow an existing native state owner and explicit host-held grants for one dispatch scope. Construct only from native admission, never requires text. This small cold authoring profile does not advertise graph, generic invokes, private-key export or unrestricted host delegation. Other Host defaults are unchanged and are not advertised by this profile. The native owner handles authentication, current revocation and keeping this borrow within its admission transaction.

Implementations§

Source§

impl<'a> ScopedEffects<'a>

Source

pub fn new( snapshot: &'a mut PoetSnapshot, grants: &'a [&'a str], ) -> Result<Self, Diagnostic>

Trait Implementations§

Source§

impl Host for ScopedEffects<'_>

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

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 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 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: &str, span: Span, ) -> Result<Value, Diagnostic>

Verify a signature (T-crypto). Returns Bool. Default: E702.
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. Read more
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. Read more
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. Read more
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). Read more
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). Read more
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_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 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.

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for ScopedEffects<'a>

§

impl<'a> Freeze for ScopedEffects<'a>

§

impl<'a> RefUnwindSafe for ScopedEffects<'a>

§

impl<'a> Send for ScopedEffects<'a>

§

impl<'a> Sync for ScopedEffects<'a>

§

impl<'a> Unpin for ScopedEffects<'a>

§

impl<'a> UnsafeUnpin for ScopedEffects<'a>

Blanket Implementations§

§

impl<S, A> Aggregate<Result<S, Error>> for A
where A: Aggregate<S>,

§

fn from_shares<T>(iter: T) -> Result<A, Error>
where T: IntoIterator<Item = Result<S, Error>>,

Aggregate shares in an MPC protocol.
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more