feat(web): "read her mind" — live self-state page
A pull-up-anytime view of Lyra's interiority, so her thoughts aren't buried in a DB blob. Mobile-first, auto-refreshing every 12s (and on tab focus). - GET /self serves the page; GET /self/state returns her self-state + the timestamp it last changed - shows: current mood + feeling meters (valence/energy/confidence/curiosity), her drives as bars, her self-narrative, the relationship line, and the reflections list (newest first), plus cycle/reflection counters and "last cycle Xm ago" - memory.self_state_updated_at(): when her mind last changed - index.html: "🧠 Mind" button opens /self Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -512,6 +512,15 @@ def get_self_state(state_id: str = "lyra") -> dict | None:
|
||||
return json.loads(r["data"]) if r else None
|
||||
|
||||
|
||||
def self_state_updated_at(state_id: str = "lyra") -> str | None:
|
||||
"""ISO timestamp her self-state was last written (None if never)."""
|
||||
conn = _connection()
|
||||
r = conn.execute(
|
||||
"SELECT updated_at FROM self_state WHERE id = ?", (state_id,)
|
||||
).fetchone()
|
||||
return r["updated_at"] if r else None
|
||||
|
||||
|
||||
def set_self_state(state: dict, state_id: str = "lyra") -> None:
|
||||
now = datetime.now(timezone.utc).isoformat()
|
||||
conn = _connection()
|
||||
|
||||
Reference in New Issue
Block a user