Skip to main content

Crate areev_loop_adapter

Crate areev_loop_adapter 

Source
Expand description

§areev-loop-adapter

The Areev substrate adapter for the areev_loop engine. It implements areev_loop::OmsSubstrate over areev_cal::AreevFacade, so the governed self-improvement loop runs against real Areev .mg/Turso memory files.

use areev_loop_adapter::{AreevSubstrate, now_ms};
use areev_store::Areev;
use areev_loop::{Engine, RunOptions};

let store = Areev::open("agent.db").unwrap();
let mut sub = AreevSubstrate::new(store, None);
let engine = Engine::with_builtins();
let result = engine.run(&mut sub, &RunOptions::default(), now_ms()).unwrap();
println!("proposed {} recommendation(s)", result.stored);

Structs§

AreevSubstrate
An Areev-backed substrate that owns its facade (CLI path).
BorrowedSubstrate
An Areev-backed substrate that borrows a facade (bindings path). Construct one per areev-loop call over the host object’s existing &AreevFacade.
LoopGovernance
Governance over Engine::with_builtins() plus an optional host policy. LLM backends deliberately have no seam here: RUN LOOP from CAL is the deterministic pass — model-attached runs stay on the host surfaces where credentials live.

Functions§

covers_rec
Whether this session may SEE a recommendation with this scope (#312).
find_recommendation
The one recommendation among recs whose hash starts with prefix — the lookup areev loop show and the bindings’ recommendation(hash) share. Pass the coverage-filtered list (visible_recommendations) on a principal-bindable surface, so a hash the caller cannot see is “no match”, indistinguishable from one that does not exist.
loop_state_of
The loop’s persisted state, read straight off an open store.
now_ms
Wall-clock now in epoch milliseconds — the now_ms the engine’s run, review, apply, and rollback take. Kept out of areev-loop itself so the engine stays deterministic (the caller supplies the clock).
observer_for_principal
The observer type an actor label implies, used where no credential record declares one (the credential map will carry an explicit observer field when the multi-token surfaces land; this prefix heuristic is the interim derivation — a statement must never be able to claim humanity, so the answer always comes from the host-held actor label, not request text).
proposal_fields
The flattened proposal body (proposal kind tag + its fields) — what recommendations({"include": "proposal"}) adds to a listing row.
recommendation_detail
One recommendation as the review surface shows it: areev loop show and the bindings’ recommendation(hash) print exactly this object (#348).
scopes_for
Map a session’s grants onto the loop engine’s scope set — the one translation between Areev’s verb model (areev_core::authz) and areev_loop::Scope, so surfaces stop handing out ScopeSet::all() unconditionally. Loop verbs are checked against the loop’s own namespace (areev_loop::LOOP_NS), which a grant covers by naming it or *. An owner session maps to every scope — the CLI’s local-root-of-trust behavior, unchanged.
scopes_for_rec
The scopes a session holds over ONE recommendation, given the namespaces it was derived from (#312).
visible_recommendations
Every recommendation a session may SEE, filtered by coverage (#312).