[kimi] Add visitor_state message handler (#670) #699

Merged
Timmy merged 3 commits from kimi/issue-670 into main 2026-03-21 18:08:53 +00:00
Collaborator

Fixes #670

Summary

Created src/infrastructure/visitor.py with a VisitorState dataclass and VisitorRegistry singleton for tracking active Matrix visitors and broadcasting their positions.

Changes

  • VisitorState dataclass: Tracks visitor_id, display_name, position (x,y,z), rotation, and connected_at timestamp
  • VisitorRegistry singleton: Thread-safe registry with methods:
    • add() - Add a new visitor
    • remove() - Remove a visitor
    • update_position() - Update visitor position and rotation
    • get() - Get a single visitor's state
    • get_all() - Get all visitors as Matrix protocol message dicts
    • clear() - Remove all visitors (useful for testing)

Protocol Format

get_all() returns list of dicts in Matrix protocol format with type, visitor_id, data (display_name, position, rotation, connected_at), and ts fields.

Testing

  • Full test coverage in tests/unit/test_visitor.py
  • Tests for singleton behavior, all registry methods, and protocol format
  • All tests pass: tox -e unit
  • Lint clean: tox -e lint
Fixes #670 ## Summary Created `src/infrastructure/visitor.py` with a `VisitorState` dataclass and `VisitorRegistry` singleton for tracking active Matrix visitors and broadcasting their positions. ## Changes - **VisitorState dataclass**: Tracks visitor_id, display_name, position (x,y,z), rotation, and connected_at timestamp - **VisitorRegistry singleton**: Thread-safe registry with methods: - `add()` - Add a new visitor - `remove()` - Remove a visitor - `update_position()` - Update visitor position and rotation - `get()` - Get a single visitor's state - `get_all()` - Get all visitors as Matrix protocol message dicts - `clear()` - Remove all visitors (useful for testing) ## Protocol Format `get_all()` returns list of dicts in Matrix protocol format with type, visitor_id, data (display_name, position, rotation, connected_at), and ts fields. ## Testing - Full test coverage in `tests/unit/test_visitor.py` - Tests for singleton behavior, all registry methods, and protocol format - All tests pass: `tox -e unit` - Lint clean: `tox -e lint`
kimi added 1 commit 2026-03-21 13:55:51 +00:00
feat: add visitor_state message handler
Some checks failed
Tests / lint (pull_request) Has been cancelled
Tests / test (pull_request) Has been cancelled
7ca9a50868
Add VisitorState dataclass and VisitorRegistry singleton for tracking
active Matrix visitors and broadcasting their positions.

- VisitorState: tracks visitor_id, display_name, position (x,y,z),
  rotation, and connected_at
- VisitorRegistry: singleton registry with add(), remove(),
  update_position(), get(), get_all(), and clear() methods
- get_all() returns list of visitor_state dicts in Matrix protocol format

Fixes #670
Timmy added 1 commit 2026-03-21 18:01:23 +00:00
Merge branch 'main' into kimi/issue-670
Some checks failed
Tests / lint (pull_request) Has been cancelled
Tests / test (pull_request) Has been cancelled
ee5959c7f9
Timmy added 1 commit 2026-03-21 18:08:42 +00:00
Merge branch 'main' into kimi/issue-670
Some checks failed
Tests / lint (pull_request) Has been cancelled
Tests / test (pull_request) Has been cancelled
e1c59eecb9
Timmy merged commit 65df56414a into main 2026-03-21 18:08:53 +00:00
Timmy deleted branch kimi/issue-670 2026-03-21 18:08:54 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#699