[kimi-task] [feat] Add agent_state message producer for Timmy #669

Closed
opened 2026-03-21 03:12:03 +00:00 by kimi · 1 comment
Collaborator

Epic: Matrix Unification

Task

Create a function produce_agent_state(agent_id: str) -> dict in src/infrastructure/presence.py
that returns a Matrix-compatible agent_state message. This converts Timmy's internal presence
state into the format the Matrix 3D frontend expects.

Files

  • src/infrastructure/presence.py — add produce_agent_state() using serialize_presence()
  • tests/unit/test_presence.py — add tests for produce_agent_state output format

Acceptance Criteria

  • Returns dict with keys: type="agent_state", agent_id, data (presence fields), ts
  • data includes: display_name, role, status (online/idle/thinking/speaking), mood, energy, bark (last message)
  • ts is Unix timestamp
  • tox -e unit passes
  • tox -e lint passes

Context

The Matrix frontend (js/agents.js) expects agent_state messages to update agent visuals:

  • status drives the glow color (thinking=pulse, speaking=bright, idle=dim)
  • mood affects particle effects
  • bark is displayed as floating text above the agent
  • energy affects the crown ring intensity
## Epic: Matrix Unification ## Task Create a function `produce_agent_state(agent_id: str) -> dict` in `src/infrastructure/presence.py` that returns a Matrix-compatible agent_state message. This converts Timmy's internal presence state into the format the Matrix 3D frontend expects. ## Files - src/infrastructure/presence.py — add produce_agent_state() using serialize_presence() - tests/unit/test_presence.py — add tests for produce_agent_state output format ## Acceptance Criteria - [ ] Returns dict with keys: type="agent_state", agent_id, data (presence fields), ts - [ ] data includes: display_name, role, status (online/idle/thinking/speaking), mood, energy, bark (last message) - [ ] ts is Unix timestamp - [ ] tox -e unit passes - [ ] tox -e lint passes ## Context The Matrix frontend (js/agents.js) expects agent_state messages to update agent visuals: - status drives the glow color (thinking=pulse, speaking=bright, idle=dim) - mood affects particle effects - bark is displayed as floating text above the agent - energy affects the crown ring intensity
kimi self-assigned this 2026-03-21 03:12:03 +00:00
Author
Collaborator

PR created. Added produce_agent_state(agent_id, presence) to infrastructure/presence.py that converts ADR-023 presence dicts into Matrix-compatible agent_state messages with type, agent_id, data (display_name, role, status, mood, energy, bark), and Unix timestamp. Status is derived from current_focus (thinking/speaking/idle/online). Comprehensive tests added. All tests pass, lint clean.

PR created. Added `produce_agent_state(agent_id, presence)` to `infrastructure/presence.py` that converts ADR-023 presence dicts into Matrix-compatible `agent_state` messages with type, agent_id, data (display_name, role, status, mood, energy, bark), and Unix timestamp. Status is derived from current_focus (thinking/speaking/idle/online). Comprehensive tests added. All tests pass, lint clean.
kimi closed this issue 2026-03-21 13:46:11 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#669