Sfoglia il codice sorgente

feat(chatto): handle message_retracted, thread_created, user_typing live

Small event handlers moved out of the 'not yet implemented' log:

- message_retracted — currently logs only; interactive prompts are keyed
  by their own message IDs (not the original event_id), so no cleanup needed
- thread_created — logs only; threads seed on first message anyway
- user_typing — logs only; ephemeral presence signal for UI cursors, not
  something a bot needs to surface to an agent
Paul Klumpp 1 settimana fa
parent
commit
83e5a4ff0e
1 ha cambiato i file con 28 aggiunte e 0 eliminazioni
  1. 28 0
      adapter.py

+ 28 - 0
adapter.py

@@ -2515,6 +2515,34 @@ class ChattoAdapter(BasePlatformAdapter):
             # the next turn that needs room groups refetches once.
             logger.debug("Chatto: room_groups_updated — discarding cached group state")
 
+        elif event.kind == "message_retracted":
+            # A message was retracted — no-op for now.  Interactive prompts
+            # are keyed by their own message IDs (not the original event_id),
+            # and the prompt timeout handles stale cards anyway.
+            payload = event.payload
+            logger.debug(
+                "Chatto: message retracted: %s in %s",
+                getattr(payload, "message_event_id", None),
+                getattr(payload, "room_id", None),
+            )
+
+        elif event.kind == "thread_created":
+            # A human created a thread — no adapter action needed.  The thread
+            # will be seeded on first message because _seeded_threads starts
+            # empty and seeds on first turn into an unknown root.
+            payload = event.payload
+            logger.debug(
+                "Chatto: thread created: room=%s root=%s",
+                getattr(payload, "room_id", None),
+                getattr(payload, "thread_root_event_id", None),
+            )
+
+        elif event.kind == "user_typing":
+            # Presence-like ephemeral signal: a user is typing in a room.
+            # The adapter never surfaces this to the agent — it is only useful
+            # for a client UI cursor, which is not what a bot does.
+            logger.debug("Chatto: user_typing event received")
+
         # confirmed:
         # NOTE: "projection_event" (and "caught_up") belong to realtime protocol
         # v2 on unreleased Chatto main — chattolib speaks v1 and can never