Commit Graph

5 Commits

Author SHA1 Message Date
Pheby 6be1601ccd Anchor generated attachments to assistant messages
Deliverables now inherit the active assistant draft message ID so clients can render them beside the reply that produced them.
2026-09-09 06:54:56 +00:00
Pheby 5725d635b2 fix: bind server/adapter contextvars per WS task; fix session pre-create call
Two live-deployment bugs found during end-to-end verification:

1. server.py: ContextVars set in adapter.connect() do not propagate into
   aiohttp handler tasks, so hermes_bridge._current_server()/_current_adapter()
   resolved to None inside message handlers (conversation.list returned empty
   snapshots, broadcast fan-out and notification paths silently no-oped).
   Bind both contextvars at the top of _handle_ws — the per-connection task
   owns the context for all its handler dispatch and agent-thread bridges.

2. hermes_bridge.py: create_conversation passed two extra positional args to
   SessionStore.get_or_create_session() (source, False, False) — the actual
   signature is (source, force_new=False). TypeError was swallowed by the
   guard, so pre-creating an empty Hermes session at conversation.create
   always failed; sessions were only created on first message.

Verified live against the running gateway: full 11-point E2E (auth 401,
hello/ready, conversation list/create/delete with persistence, chat.send
round-trip through the agent, run lifecycle events, models.current,
reasoning.current). 46/46 unit tests pass.
2026-09-02 23:30:01 +00:00
Codex 5130152335 Fix Hermes adapter integration and recovery 2026-09-02 13:59:00 -07:00
Pheby 53ffdb8aa2 feat: Pheby platform adapter/plugin for Hermes (protocol v1)
Third-party Hermes platform plugin serving the Pheby WebSocket+HTTPS
protocol for the native Android client, behind Caddy:

- Platform adapter (BasePlatformAdapter subclass) registered via the
  documented plugin system (plugins.platforms pattern, kind: platform)
- Multiple conversations mapped to Hermes sessions (authoritative state)
- Streaming chat via GatewayStreamConsumer edit path (message.delta)
- Structured tool events (never fake tool text in chat), incl.
  post_tool_call hook relay with Hermes tool_call_ids
- Native approval + clarification round-trips via tools.approval /
  tools.clarify_gateway primitives
- Attachment delivery: adapter-owned copies, opaque IDs, persistent
  metadata, 7-day retention + safe cleanup, authenticated HTTPS download
- Model + reasoning-effort query/change via Hermes picker data and
  session/global overrides
- Shared-secret auth (constant-time, lockout), size limits, path-
  traversal-proof attachment resolution, minimal health endpoint
- Protocol v1 spec with JSON examples (docs/PROTOCOL.md)
- Install/config/Caddy/security docs + discovered Hermes limitations
- 37 passing tests (auth, conversations, protocol, attachments incl.
  expiry/traversal, tool events, approvals, clarifications, cancel,
  reconnect re-sync, live WS smoke tests) — gateway-free fakes

No Hermes core modifications required.
2026-09-02 19:31:17 +00:00
Pheby 31c16de665 Initial commit 2026-09-02 17:37:21 +00:00