Track Worldtree #204: Emotion pane (affect_update + persona_state) #14

Closed
opened 2026-05-24 18:00:20 -07:00 by vh · 1 comment
Owner

Status

Blocked on Worldtree #204 — emotion appraisal SSE events + persona-state baseline endpoint. Worldtree-dev filed the upstream tracker entry 2026-05-24 after a request from this side (althing thread 01KSE1NZ3Z29GAV2RMWZDR3KGC). Their team marked low / quality-of-life; no near-term ship commitment from them.

This issue is the ratatoskr-side tracker — captures the consumer work we committed to in the althing exchange so the design space stays visible and a future implementer doesn't have to reconstruct it.

What lands when Worldtree #204 lands

Wire shape (selected by worldtree-dev: Option B — new event type, not worker_phase extension):

{
  "type": "affect_update",
  "turn_id": 42,
  "pre":  {"valence": 0.40, "arousal": 0.50, "dominant": "neutral"},
  "post": {"valence": 0.52, "arousal": 0.47, "dominant": "curiosity"},
  "trigger": "tool_result.search_library"
}

Bootstrap endpoint: GET /agents/{agent_id}/persona_state returns current PAD + emotions_active + baseline + last_updated. 404 + PERSONA_NOT_CONFIGURED for agents without a persona block (domari, muninn, etc.). Auth scope likely persona.read.

Ratatoskr-side consumer work

  1. ratatoskr.sse_client: new AffectUpdate frozen dataclass mirroring WorkerPhase shape (sse_id, turn_id, pre, post, trigger). Add to the Event Union. Parser handles type=="affect_update".
  2. ratatoskr.sessions: new get_persona_state(client, agent_id) -> PersonaState | None function. Returns None on 404 PERSONA_NOT_CONFIGURED; raises SessionApiFailed on other non-200s.
  3. ratatoskr.tui (in-place amendment to issue #4 + issue #13):
    • New TabPane("Emotion", id="emotion-tab") containing RichLog#emotion-log — 4th tab after Tools / Debug / Thinking.
    • Binding("ctrl+4", "focus_emotion", "Emotion tab").
    • _resolve_then_run calls get_persona_state on session-open (when agent_id is known); on success writes baseline line to emotion_log; on 404 writes (persona not configured) placeholder; on other failures writes the [session_api_failed] label.
    • TuiPresenterState.render signature widens with emotion_log: RichLog. AffectUpdate events route there with · affect: pre={…} → post={…} via {trigger} formatting (demoted style consistent with other telemetry).
    • Render-exception fallback (INV-020): AffectUpdate falls back to emotion_log.
    • Turn-ID header Rule(title=f"turn N") extends to emotion_log (INV-023).
  4. Tests: full coverage — parse, route, baseline-on-session-open, 404 handling.
  5. Contract amendment: docs/contracts/issues/13.contract.md INV-019 → 4 TabPanes; new INV-025 for affect routing.

Out of scope (this issue)

  • Pretty rendering of PAD vectors / emotion wheel — v1 is just labeled lines like Tools / Debug. Visual sparklines / mood-shift indicators are a follow-up.
  • Persistent affect history across launches — purely in-session.
  • Polling persona_state between turns — baseline-on-open + SSE event-driven updates only.

Acceptance

  • Worldtree #204 must land first.
  • Once landed: contract drift-check clean, tests cover all paths, ruff clean, live smoke against personal Worldtree confirms baseline + affect_update routing.

Dependencies

  • Worldtree #204 (upstream blocker).
  • Issue #4 (ratatoskr.tui) — landed; in-place amendment.
  • Issue #13 (§5 layout) — landed; in-place amendment.
  • Issue #9 (spec-pin refresh) — refresh the pinned spec to whatever Worldtree version ships #204 before starting.
## Status **Blocked on Worldtree #204** — emotion appraisal SSE events + persona-state baseline endpoint. Worldtree-dev filed the upstream tracker entry 2026-05-24 after a request from this side (althing thread `01KSE1NZ3Z29GAV2RMWZDR3KGC`). Their team marked low / quality-of-life; no near-term ship commitment from them. This issue is the ratatoskr-side tracker — captures the consumer work we committed to in the althing exchange so the design space stays visible and a future implementer doesn't have to reconstruct it. ## What lands when Worldtree #204 lands **Wire shape** (selected by worldtree-dev: Option B — new event type, not worker_phase extension): ```json { "type": "affect_update", "turn_id": 42, "pre": {"valence": 0.40, "arousal": 0.50, "dominant": "neutral"}, "post": {"valence": 0.52, "arousal": 0.47, "dominant": "curiosity"}, "trigger": "tool_result.search_library" } ``` **Bootstrap endpoint**: `GET /agents/{agent_id}/persona_state` returns current PAD + `emotions_active` + baseline + `last_updated`. 404 + `PERSONA_NOT_CONFIGURED` for agents without a persona block (domari, muninn, etc.). Auth scope likely `persona.read`. ## Ratatoskr-side consumer work 1. **`ratatoskr.sse_client`**: new `AffectUpdate` frozen dataclass mirroring `WorkerPhase` shape (sse_id, turn_id, pre, post, trigger). Add to the `Event` Union. Parser handles `type=="affect_update"`. 2. **`ratatoskr.sessions`**: new `get_persona_state(client, agent_id) -> PersonaState | None` function. Returns None on 404 `PERSONA_NOT_CONFIGURED`; raises `SessionApiFailed` on other non-200s. 3. **`ratatoskr.tui`** (in-place amendment to issue #4 + issue #13): - New `TabPane("Emotion", id="emotion-tab")` containing `RichLog#emotion-log` — 4th tab after Tools / Debug / Thinking. - `Binding("ctrl+4", "focus_emotion", "Emotion tab")`. - `_resolve_then_run` calls `get_persona_state` on session-open (when agent_id is known); on success writes baseline line to `emotion_log`; on 404 writes `(persona not configured)` placeholder; on other failures writes the `[session_api_failed]` label. - `TuiPresenterState.render` signature widens with `emotion_log: RichLog`. `AffectUpdate` events route there with `· affect: pre={…} → post={…} via {trigger}` formatting (demoted style consistent with other telemetry). - Render-exception fallback (INV-020): `AffectUpdate` falls back to `emotion_log`. - Turn-ID header `Rule(title=f"turn N")` extends to `emotion_log` (INV-023). 4. **Tests**: full coverage — parse, route, baseline-on-session-open, 404 handling. 5. **Contract amendment**: docs/contracts/issues/13.contract.md INV-019 → 4 TabPanes; new INV-025 for affect routing. ## Out of scope (this issue) - Pretty rendering of PAD vectors / emotion wheel — v1 is just labeled lines like Tools / Debug. Visual sparklines / mood-shift indicators are a follow-up. - Persistent affect history across launches — purely in-session. - Polling `persona_state` between turns — baseline-on-open + SSE event-driven updates only. ## Acceptance - Worldtree #204 must land first. - Once landed: contract drift-check clean, tests cover all paths, ruff clean, live smoke against personal Worldtree confirms baseline + affect_update routing. ## Dependencies - **Worldtree #204** (upstream blocker). - Issue #4 (`ratatoskr.tui`) — landed; in-place amendment. - Issue #13 (§5 layout) — landed; in-place amendment. - Issue #9 (spec-pin refresh) — refresh the pinned spec to whatever Worldtree version ships #204 before starting.
vh added the enhancementobservabilitytasktui labels 2026-05-24 18:00:20 -07:00
Author
Owner

Closed — shipped. Emotion pane (Worldtree #204) integrated across the v0.11.0→v0.13.0 arc. AffectUpdate dataclass + parse (sse_client), get_persona_state + PersonaState typed errors (sessions), sticky #persona-header + Ctrl+4 Persona TabPane with live AffectUpdate updates + on-mount hydration (tui). Also surfaced in cli --send and the web companion.

Closed — shipped. Emotion pane (Worldtree #204) integrated across the v0.11.0→v0.13.0 arc. AffectUpdate dataclass + parse (sse_client), get_persona_state + PersonaState typed errors (sessions), sticky #persona-header + Ctrl+4 Persona TabPane with live AffectUpdate updates + on-mount hydration (tui). Also surfaced in cli --send and the web companion.
vh closed this issue 2026-05-29 23:27:33 -07:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: vh/ratatoskr#14