1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! OPFS-local working copy of the agent's self-recorded lessons.
//!
//! `.lh_lessons.txt` mirrors the on-chain blob stored under
//! `keccak256("localharness.lessons")` (written by the `record_lesson` tool;
//! merge semantics in `crate::lessons`). Session bootstrap reads the local
//! copy without an RPC round-trip; a device that has never recorded here
//! falls back to the on-chain slot for this tenant's tokenId — so lessons
//! survive sessions AND devices.
const LESSONS_FILE: &str = ".lh_lessons.txt";
/// Read the local lessons working copy. `None` when absent/empty.
pub async
/// Persist `content` as the local lessons working copy (atomic swap).
pub async
/// The lessons blob for THIS tenant: the OPFS working copy when present,
/// else the published on-chain `lessons_of` slot (second device / fresh
/// profile). `None` when no lessons exist anywhere (or not on a registered
/// tenant) — best-effort, an RPC failure degrades to no lessons.
pub async