Skip to main content

PoetSnapshot

Struct PoetSnapshot 

Source
pub struct PoetSnapshot {
    pub committed: Vec<NQuin>,
    pub revision: u64,
    pub published: Vec<PulseRecord>,
    pub attached: bool,
    pub graph_read_during_eval: bool,
    pub time_read_during_eval: bool,
    pub tick_controller: TickController,
    pub hid_events: HidEventBuffer,
    pub trace_ledger: InstrumentTraceLedger,
    pub last_eval_workspace_left: u64,
    pub admitted_views: Vec<AdmittedQ42View>,
    pub key_vault: HashMap<String, [u8; 32]>,
    /* private fields */
}
Expand description

In-memory graph revision used as the 0.1 live host.

When attached, queries refresh from the native daemon graph and commits extend it. WASM has no daemon_graph — attach is always false there.

Fields§

§committed: Vec<NQuin>§revision: u64§published: Vec<PulseRecord>§attached: bool§graph_read_during_eval: bool

Set to true when graph_query is called during an evaluation. The desktop harness resets this before each eval_cell_src and reads it after to determine whether the cell is graph-dependent (reactive).

§time_read_during_eval: bool

Set to true when time_unix is called during an evaluation. The desktop harness resets this before each eval_cell_src and reads it after to determine whether the cell is time-dependent (reactive on tick).

§tick_controller: TickController

Controller managing tick admission and coalescing under load (T68).

§hid_events: HidEventBuffer

HID event ring buffer (T46). 4096-sample quota — host constant, not a language constant. Fail-closed when full.

§trace_ledger: InstrumentTraceLedger

Instrument trace ledger (R12). Records instrument acts for customer-readable audit. NOT a provider byline (CLAUDE.md §16).

§last_eval_workspace_left: u64

Remaining 42 MB Sentinel budget after the last eval (P16.6).

§admitted_views: Vec<AdmittedQ42View>

Admitted isolated read-only Q42 semantic views (G50).

§key_vault: HashMap<String, [u8; 32]>

Key vault storing Ed25519 signing seeds for crypto operations.

Implementations§

Source§

impl PoetSnapshot

Source

pub fn with_seed(quins: Vec<NQuin>) -> Self

Detached snapshot seeded with quins at revision 1 — no daemon attachment, no published events.

Source

pub fn live() -> Self

Prefer the process daemon graph; fall back to the demo seed.

Source

pub fn from_daemon() -> Self

Snapshot attached to the process daemon graph — reads/delegates go through daemon_graph, committed stays empty.

Source

pub fn honesty(&self) -> &'static str

Evidence-level string: "live" when attached to the daemon graph, "partial" for a detached snapshot.

Source

pub fn visible_count(&self) -> usize

Quins visible to this snapshot — the daemon count when attached, else committed.len().

Source

pub fn with_demo_seed() -> Self

Clinic + catchment seed so the harness query sample is not empty.

Source

pub fn ingest_sealed(&mut self, quin: NQuin)

Ingest an externally sealed quin — into the daemon graph when attached (revision refreshed), else appended to committed.

Source

pub fn bump_revision(&mut self)

Advance the snapshot revision (wrapping) after an out-of-band mutation the commit path didn’t observe.

Source

pub fn fork(&self) -> Self

Fork this snapshot into a detached, isolated copy for dry-run evaluation (reflection Stage 3, JudgeFrame verification, etc.).

The fork inherits the current committed quins (a snapshot of the live graph at this revision) but is never attached — commits to the fork stay in the fork and cannot reach the daemon graph. The staged deltas are cleared (a dry-run starts from the committed baseline, not from in-flight staged changes).

This is the R4 isolation boundary: reflection stage 3 and judge frames evaluate against the fork, not the live host.

Source

pub fn commit_staged(&mut self)

Commit staged deltas into the committed set (used by dry-run forks to simulate a commit without touching the live graph).

Source

pub fn rollback_staged(&mut self)

Discard all staged deltas without committing (rollback).

Source

pub fn admit_q42_slice( &mut self, bytes: &[u8], pack_identity: &str, entry_key: &str, expected_digest: Option<&[u8; 32]>, load_into_committed: bool, ) -> Result<AdmittedQ42ViewReceipt, String>

Admit an in-memory/byte-backed Q42 slice into an isolated read-only semantic view (G50).

Validates:

  1. Entry SHA-256 digest (if expected_digest is provided).
  2. Q42 header bounds and supported format version (v3/v4).
  3. Caller-buffered SuperBlock decompression and Quin parity checks for all Quins.
  4. Embedded Q42LEX lexicon decoding into an isolated term map.

Fail-closed guarantee: any corruption, digest mismatch, or budget error rejects admission immediately WITHOUT altering previously admitted views or resident committed graph.

When load_into_committed is true, also appends admitted Quins to self.committed and bumps revision so queries (GraphDatabase.sparql, SHACL.validate) see them.

Source

pub fn resolve_admitted_lexicon_term(&self, hash: u64) -> Option<&str>

Resolve a hash term against admitted lexicon views.

Source

pub fn staged_count(&self) -> usize

Number of staged (uncommitted) quins.

Source

pub fn trace(&mut self, entry: TraceEntry)

Record an instrument trace entry (R12). This is a customer-readable audit trail, NOT a provider byline.

Source

pub fn trace_invoke( &mut self, invoke_id: &str, success: bool, cost: Option<u64>, )

Convenience: record a simple trace entry for a capability invoke.

Source

pub fn eval_program_src(&mut self, src: &str) -> Result<Value, Diagnostic>

Parse, check, and evaluate a full VibeScript program source — resets the graph/time-read honesty flags first and records the post-eval workspace headroom in last_eval_workspace_left.

Source

pub fn seal_eval_quins_into_arena(&self, arena: &mut SlgArena) -> usize

Write committed + staged quins into the 42 MB Sentinel arena (P16.6).

Source

pub fn eval_cell_src(&mut self, src: &str) -> Result<Value, Diagnostic>

Evaluate one notebook cell source against this snapshot; resets the read flags first (left uncleared on failure — an incomplete cell keeps its flags).

Source

pub fn eval_fn( &mut self, src: &str, name: &str, args: Vec<Value>, ) -> Result<Value, Diagnostic>

Call function name from program source src with args, evaluated against this snapshot.

Source

pub fn dispatch_hook_src( &mut self, src: &str, path: &[String], args: Vec<Value>, ) -> Result<Value, Diagnostic>

Dispatch a hook event (on <path>(…)) on a checked program.

path is the event path segments (e.g. ["pulse", "message"] for on pulse:message(…), or ["tick"] for on tick(…)). args are bound to the hook’s parameters in declaration order. Returns Ok(Value::Null) if no matching hook exists in the program.

Source

pub fn invoke_id(&mut self, id: &str, args: Value) -> Result<Value, Diagnostic>

Direct capability.invoke from a host (desktop renderer, tests).

Source§

impl PoetSnapshot

Convert an InboundEvent to a compact HidEventSlot for the ring buffer (T42). The source_id is hashed to fit in u64. The event kind is stored as u8.

Source

pub fn enqueue_hid_event( &mut self, event: &InboundEvent, ) -> Result<(), &'static str>

Enqueue an InboundEvent into the HID ring buffer (T42). Returns Err if the buffer is full (fail-closed).

Source

pub fn drain_hid_events(&mut self) -> Vec<Value>

Drain all HID events from the ring buffer (T42). Returns a Vec of event Values in FIFO order.

Source

pub fn hid_event_count(&self) -> usize

Number of HID events currently buffered (T42).

Trait Implementations§

Source§

impl Clone for PoetSnapshot

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PoetSnapshot

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PoetSnapshot

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Host for PoetSnapshot

Source§

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

graph.query — match s/p/o patterns (any may be absent) against the live or committed quins, up to take results; sets the graph_read_during_eval honesty flag.

Source§

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

graph.stage — buffer term (triple, reified term, or Quin) into staged for the next commit; E600 when the value encodes no stageable quin.

Source§

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

graph.begin — no-op: staging is implicit, no explicit transaction state to open.

Source§

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

graph.abort — drop every staged quin without committing.

Source§

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

graph.commit — flush staged into the daemon graph (attached) or committed (detached), bump the revision, and return a Receipt. Committing an empty stage is a no-op Receipt.

Source§

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

aura.validate — validate node against a named shape; only the built-in EmergencyAlertShape/ReifierPresent shapes are honest in this build (false otherwise / for unhashable nodes).

Source§

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

pulse.publish — emit payload on topic (E500 unless the topic is on PULSE_ALLOW_PREFIXES); goes through the process pulse transport when attached, and is always journaled into published.

Source§

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

time.now — current instant built on time_unix (E600 if the clock read produced something unexpected).

Source§

fn environment(&self) -> HostEnvironment

Host environment — WasmSandbox on wasm32, NativeDesktop otherwise.

Source§

fn acceleration_tier(&self) -> AccelerationTier

The tier this host will actually use — ScalarCpu.

Source§

fn available_acceleration(&self) -> AccelerationTier

The best acceleration tier hardware-probed on this machine.

Source§

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

time.unix — seconds since epoch; sets time_read_during_eval. WASM has no wall clock and returns 0 (receipt-injected clocks handle replay).

Source§

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

graph.snapshot — the current revision (U64); refreshes from the daemon when attached.

Source§

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

capability.resolve — look up invoke-id id in the catalog, honesty-tagged by attachment state.

Source§

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

capability.invoke — dispatch invoke-id id through invoke::dispatch.

Source§

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

quin.seal — wrap raw s/p/o/c u64s into a QuinRef (metadata 0, parity recomputed); the script never sees the parity field.

Source§

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

hash_iri — the 60-bit token hash of iri (bits 60–63 free for type tags).

Source§

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

crypto.hash — SHA-256/SHA-512/BLAKE3 of data, returned as a hash-result record; E100 for other algorithm names. crypto.hash — SHA-256/SHA-512/BLAKE3 of data, returned as a hash-result record; E100 for other algorithm names.

Source§

fn crypto_hkdf( &mut self, ikm: &str, info: &str, length: u64, span: Span, ) -> Result<Value, Diagnostic>

crypto.hkdf — HKDF-SHA256 expand of ikm/info to length bytes, hex-encoded; E100 on expansion failure.

Source§

fn crypto_aead_encrypt( &mut self, algorithm: &str, key_hex: &str, nonce_hex: &str, plaintext: &str, aad: &str, span: Span, ) -> Result<Value, Diagnostic>

crypto.aead_encrypt — AEAD-encrypt plaintext (AES-256-GCM: 32-byte key, 12-byte nonce, hex input) with aad; E100 on bad hex, wrong sizes, or an unsupported algorithm.

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>

crypto.aead_decrypt — AEAD-decrypt with the same hex contract as crypto_aead_encrypt; E100 on bad input or auth failure.

Source§

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

crypto.sign — signs data with key identified by key_id.

Source§

fn crypto_verify( &mut self, key_id: &str, data: &str, signature_hex: &str, span: Span, ) -> Result<Value, Diagnostic>

crypto.verify — verifies data against signature_hex using key_id or raw public key hex.

Source§

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

crypto.generate_key — generates an Ed25519 keypair and registers it in the key vault.

Source§

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

zk.prove_threshold — prove value >= threshold via crypto::zk_predicates; E702 when zk-culling is off, E100 on prover failure.

Source§

fn zk_verify_threshold( &mut self, proof_hex: &str, vk_hex: &str, threshold: u64, span: Span, ) -> Result<Value, Diagnostic>

zk.verify_threshold — verify a threshold proof (proof_hex, vk_hex) against threshold; E702 when zk-culling is off.

Source§

fn zk_prove_range( &mut self, value: u64, lo: u64, hi: u64, span: Span, ) -> Result<Value, Diagnostic>

zk.prove_range — prove lo <= value <= hi via crypto::zk_predicates::prove_range; E702 when zk-culling is off.

Source§

fn zk_verify_range( &mut self, proof_hex: &str, vk_hex: &str, lo: u64, hi: u64, span: Span, ) -> Result<Value, Diagnostic>

zk.verify_range — verify a range proof against lo/hi; E702 when zk-culling is off.

Source§

fn zk_prove_matmul( &mut self, m: u64, k: u64, n: u64, a: &[i128], b: &[i128], span: Span, ) -> Result<Value, Diagnostic>

zk.prove_matmul — prove a m×k × k×n integer matmul via ZkProofSystem::prove_matrix_multiply; E702 when zk-culling is off.

Source§

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

zk.list_circuits — the registered ZK circuit names; E702 when zk-culling is off.

Source§

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

Poll for the next HID event from the ring buffer (T42). Non-blocking: returns Null if no event is available.

Source§

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

Wait for the next HID event with a timeout (T42). Currently non-blocking (polls once). A blocking implementation would require platform-specific async infrastructure.

Source§

fn supports_isolation(&self) -> bool

R4: PoetSnapshot supports isolation via fork(). A forked snapshot has attached = false, so graph writes stay in the fork’s staged deltas and never reach the daemon graph.

Source§

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

Complete a transaction { ... } block on normal exit. Read more
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 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 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 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 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.

Auto Trait Implementations§

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,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

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> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

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> NoneValue for T
where T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
§

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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