OpenPay (1 crate, 3751 LOC, 83 tests)
op-crypto-extra Extended crypto rails. Stablecoin catalog (USDC, USDT,
PYUSD, DAI, RLUSD, EURC, FDUSD — 26 deployments). L2
catalog (12 chains incl. Optimism, Arbitrum, Base,
zkSync Era, Polygon zkEVM, Linea, Scroll, Starknet).
CCTP v2 BurnMessage encode/decode + domain ids +
attestation. ERC-4337 UserOperation v0.7 +
PackedUserOperation. EIP-7702 set-EOA-code with RLP
signing preimage. Uniswap Permit2 single + batch
transfer EIP-712 hashes. EIP-2612 ERC-20 permit.
BOLT-11 bech32 invoices + LNURL decode. Bitcoin
PSBT v2 (BIP-370). Atomic-swap HTLC. Solana SPL /
Aleo / Aztec confidential-transfer sketches.
Smart Byte (1 crate, 2304 LOC, 30 tests)
smart-byte-acdc Authentic Chained Data Containers (KERI ecosystem).
Acdc + AcdcBuilder (targeted + untargeted) with SAID
derivation. JSON Schema 2020-12 validator with
oneOf partial-disclosure. TEL (RIP/VRT/ISS/REV)
with hash-chained verification. IPEX (apply/offer/
agree/grant/admit/spurn) chained by SAID. Edge
records (I2I/NI2I/DI2I) + EdgeGraph BFS traversal
with cycle detection. Selective disclosure with
full/none/subset plans + compact packing.
CredentialRegistry trait + InMemoryRegistry over
TEL. Composes with smart-byte-core + smart-byte-keri-witness.
EOC (1 crate, 1764 LOC, 16 tests)
eoc-memory Long-term memory primitives. Memory trait + MemoryKind +
EpisodeId. Episodic event log with TimeIndex range
queries. RDF-style Triple store with S/P/O indices.
Bounded attention-budget Scratchpad with
salience-weighted eviction. Rolling SummaryBuffer +
FIFO SlidingWindow. Dream-cycle consolidate()
(episodic → semantic). Ebbinghaus forgetting curve
with reinforcement. Retriever blending cosine
similarity + recency + saturating frequency.
MemGpt three-tier shape (Main/Recall/Archival).
Co-Authored-By: Claude Opus 4.7 <[email protected]>
68 lines
2.3 KiB
Rust
68 lines
2.3 KiB
Rust
//! Dream-cycle consolidation tests.
|
|
|
|
use eoc_memory::consolidate::{ConsolidateConfig, consolidate};
|
|
use eoc_memory::episodic::{Episode, EpisodicLog};
|
|
use eoc_memory::memory::Memory;
|
|
use eoc_memory::semantic::{SemanticGraph, Triple};
|
|
|
|
#[test]
|
|
fn consolidates_episodes_to_triples_and_skips_dupes() {
|
|
let mut log = EpisodicLog::new();
|
|
log.append(Episode::new(100, "user", "alice knows bob"))
|
|
.expect("ep1");
|
|
log.append(Episode::new(200, "user", "bob knows carol"))
|
|
.expect("ep2");
|
|
log.append(Episode::new(300, "user", "alice knows bob"))
|
|
.expect("ep3 dup payload");
|
|
|
|
let mut graph = SemanticGraph::new();
|
|
let cfg = ConsolidateConfig::new((0, 1_000), 64).expect("cfg");
|
|
|
|
// Extractor: parse "X knows Y" into a triple.
|
|
let extractor = |ep: &Episode| -> Vec<Triple> {
|
|
let parts: Vec<&str> = ep.payload.split_whitespace().collect();
|
|
if parts.len() == 3 && parts[1] == "knows" {
|
|
vec![Triple::new(parts[0], "knows", parts[2], ep.timestamp_ms)]
|
|
} else {
|
|
Vec::new()
|
|
}
|
|
};
|
|
|
|
let report = consolidate(&log, &mut graph, &cfg, extractor).expect("consolidate");
|
|
assert_eq!(report.episodes_scanned, 3);
|
|
assert_eq!(report.triples_asserted, 2);
|
|
assert_eq!(report.triples_duplicate, 1);
|
|
assert_eq!(graph.len(), 2);
|
|
}
|
|
|
|
#[test]
|
|
fn max_triples_caps_output() {
|
|
let mut log = EpisodicLog::new();
|
|
for i in 0..10 {
|
|
log.append(Episode::new(
|
|
1_000 + i,
|
|
"u",
|
|
format!("a{i} knows b{i}"),
|
|
))
|
|
.expect("ep");
|
|
}
|
|
let mut graph = SemanticGraph::new();
|
|
let cfg = ConsolidateConfig::new((0, 100_000), 3).expect("cfg");
|
|
let report = consolidate(&log, &mut graph, &cfg, |ep| {
|
|
let parts: Vec<&str> = ep.payload.split_whitespace().collect();
|
|
vec![Triple::new(parts[0], "knows", parts[2], ep.timestamp_ms)]
|
|
})
|
|
.expect("consolidate");
|
|
assert_eq!(report.triples_asserted, 3);
|
|
assert!(graph.len() <= 3);
|
|
}
|
|
|
|
#[test]
|
|
fn empty_window_yields_empty_report() {
|
|
let log = EpisodicLog::new();
|
|
let mut graph = SemanticGraph::new();
|
|
let cfg = ConsolidateConfig::new((0, 1_000), 16).expect("cfg");
|
|
let report = consolidate(&log, &mut graph, &cfg, |_| Vec::new()).expect("ok");
|
|
assert_eq!(report.episodes_scanned, 0);
|
|
assert_eq!(report.triples_asserted, 0);
|
|
}
|