paul
запушил(а) feat/roster-presence-cache в paul/hermes-chatto-plugin
3fc158ab91 Correct stale docs: no resume cursor, no home-channel fallback
Two README claims had outlived their truth:
- 'Resume cursor support' - protocol v1 reserves resume_cursor and the
adapter carries no such state; reconnects rely on duplicate-event
suppression, and events missed during downtime are simply gone.
- 'First joined room' as the CHATTO_HOME_CHANNEL default (env table,
Home Channel section, after-install.md step 2 and the plugin.yaml
wizard prompt) - nothing implements that fallback. Unset means
context-less cron/notification deliveries have no Chatto target and
are not sent.
025aa1d63f Deliver the room roster on every channel turn, cap it at 20 members
The per-room dedup kept the roster out of follow-up dispatches once a
room was announced, but threads hold isolated sessions: a thread opened
after the announcement never saw an audience at all. Cache and delivery
had different scopes - the cache is room-scoped (one directory fetch,
presence patched live), but the consumer is turn-scoped.
Fix it by dropping dedup entirely: every channel turn now carries the
rendered roster line from the cached projection. Repetition is free of
API calls; membership events, /leave, stale-room pruning and reconnects
still evict a room so its next turn refetches once. ROSTER_MEMBER_LIMIT
drops from 100 to 20 to keep the prompt block small now that it rides
on every message.
99990384aa Render the room roster from a cached projection, presence patched live
The previous approach re-fetched the member directory whenever a
presence_changed event marked an announced room stale — with real-world
presence churn that meant one list_room_members call per inbound message
after any flip, and every room was invalidated regardless of who moved.
Rework it as a miniature projection of server state, modelled on how the
Chatto web frontend handles presence (per-user cache patched in place,
member lists never re-fetched): each announced room keeps member IDs
plus its users in the existing _user_cache and the last rendered line.
presence_changed patches the cached user; the next turn in the room
re-renders from cache and re-delivers only when the line actually
changed. Membership events (user_joined_room/user_left_room), /leave,
stale-room pruning and reconnects discard a room's projection so its
next turn refetches once - protocol v1 has no presence snapshot on
subscribe, so discarding is the bootstrap.
Also corrects the event router: projection_event belongs to realtime
protocol v2 on unreleased Chatto main and can never arrive over
chattolib v1; noted where to revisit it.
AGENTS.md gains two guidance entries born from this thread: check
existing state fields before adding new ones (_user_cache instead of a
second user store), and treat the Chatto web frontend as the
architecture reference for client-side behaviour.
8081f459df Drop getattr masking of the base-class _reaction_handler
The attribute is declared on BasePlatformAdapter (base.py:3017) with a
None default, so it is always present. Direct access is typed and matches
the AGENTS.md typed-access rule; the getattr fallback only hid that.
fa18c2b2c1 Refresh room roster on presence change instead of freezing at thread start
The member roster was announced exactly once per thread and then
never updated, so presence moves (away/offline) inside a long-lived
room never reached the agent. Make the roster room-scoped: the first
turn in a room carries it, and a presence_changed event marks the room
stale so the next inbound turn re-fetches and re-delivers it. The bot's
own 60s presence refresh is filtered out so it never churns announced
rooms; a failed lookup leaves the room unannounced for a retry.
Delete the stale PLAN.md (edit-dispatch feature is already shipped) and
update README/AGENTS docs. Also fix an undefined-name bug in the
_make_edited_event test helper.
- Просмотр сравнение для этих 11 коммитов »
1 неделя назад