[EPIC] Gateway: rich message model, adapter lifecycle, session management #626

Closed
opened 2026-10-27 13:37:05 +00:00 by sam · 0 comments
Owner

Foundational gateway infrastructure to match Hermes parity. Three interdependent pieces:

  1. Message model: Replace the 3-field Message struct with a rich MessageEvent (MessageType enum: text/photo/video/audio/voice/document/sticker/command, media_urls, reply_to context, metadata dict, source). This is the wire type every adapter produces.

  2. Adapter lifecycle: Replace the 3-method Gateway interface with a BasePlatformAdapter interface: connect()/disconnect()/send() as required methods, plus optional overrides for typing indicators, edit/delete, image/voice/video/document send, interactive UX (clarify buttons, approval dialogs). Capability flags (supports_code_blocks, splits_long_messages, supports_async_delivery).

  3. Session management: SessionSource struct (platform, chat_id, chat_type, user_id, thread_id, guild_id, profile), AsyncSessionStore for persistent session storage, SessionContext for system prompt injection.

All three blocks together enable adding new platforms as plugins without touching core gateway code.

Ref: docs/prds/hermes-gap-analysis.md sections 1-2

Acceptance Criteria

New adapters can be added by implementing a Go interface with connect/disconnect/send + optional media methods. Messages carry full metadata through the pipeline. Sessions persist across gateway restarts.

Notes

docs/prds/hermes-gap-analysis.md (referenced above) was intentionally deleted in commit 65aa5b4 ('chore: cleanup', 2026-07-28) after it had already spawned this and ~14 sibling beads issues from its 60 identified gaps — it is not a broken link to restore. This issue's description is the surviving record of its slice of that analysis.
Maintainer 2026-09-22: NOT COMPLETE - ongoing polish across all the Telegram work. Evidence: the rich message model and adapter lifecycle exist (internal/domain/messaging/: chat_contract.go, lifecycle.go, inbound.go, chat_stream.go) and the Messaging Service extraction landed. Keep open; the residue is Telegram-side polish rather than the original P0 gaps.

Close reason

Closed on GitHub; syncing bead state


Imported from beads archie-core-1786637492378-100-8edacefc · GitHub #121 · type epic · priority P2 · created 2026-08-08 · closed 2026-09-26

Foundational gateway infrastructure to match Hermes parity. Three interdependent pieces: 1. **Message model**: Replace the 3-field Message struct with a rich MessageEvent (MessageType enum: text/photo/video/audio/voice/document/sticker/command, media_urls, reply_to context, metadata dict, source). This is the wire type every adapter produces. 2. **Adapter lifecycle**: Replace the 3-method Gateway interface with a BasePlatformAdapter interface: connect()/disconnect()/send() as required methods, plus optional overrides for typing indicators, edit/delete, image/voice/video/document send, interactive UX (clarify buttons, approval dialogs). Capability flags (supports_code_blocks, splits_long_messages, supports_async_delivery). 3. **Session management**: SessionSource struct (platform, chat_id, chat_type, user_id, thread_id, guild_id, profile), AsyncSessionStore for persistent session storage, SessionContext for system prompt injection. All three blocks together enable adding new platforms as plugins without touching core gateway code. Ref: docs/prds/hermes-gap-analysis.md sections 1-2 ### Acceptance Criteria New adapters can be added by implementing a Go interface with connect/disconnect/send + optional media methods. Messages carry full metadata through the pipeline. Sessions persist across gateway restarts. ### Notes docs/prds/hermes-gap-analysis.md (referenced above) was intentionally deleted in commit 65aa5b4 ('chore: cleanup', 2026-07-28) after it had already spawned this and ~14 sibling beads issues from its 60 identified gaps — it is not a broken link to restore. This issue's description is the surviving record of its slice of that analysis. Maintainer 2026-09-22: NOT COMPLETE - ongoing polish across all the Telegram work. Evidence: the rich message model and adapter lifecycle exist (internal/domain/messaging/: chat_contract.go, lifecycle.go, inbound.go, chat_stream.go) and the Messaging Service extraction landed. Keep open; the residue is Telegram-side polish rather than the original P0 gaps. ### Close reason Closed on GitHub; syncing bead state --- _Imported from beads `archie-core-1786637492378-100-8edacefc` · GitHub #121 · type epic · priority P2 · created 2026-08-08 · closed 2026-09-26_
sam added the mediumepic labels 2026-10-27 13:37:05 +00:00
sam self-assigned this 2026-10-27 13:37:05 +00:00
sam closed this issue 2026-10-27 13:37:05 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#626