Files
IRC-kosmi-relay/docs/MISSING_OPERATIONS.md

145 lines
3.5 KiB
Markdown
Raw Permalink Normal View History

2025-11-01 21:00:16 -04:00
# Missing GraphQL Operations
## Analysis of Browser HAR vs Our Implementation
After parsing `loggedin_full_stack_1.har.txt`, we found the browser's actual sequence:
### What We're Currently Doing
1. connection_init ✅
2. ExtendedCurrentUserQuery ✅
3. JoinRoom ✅
4. RoomDisconnect subscription ✅
5. NewMessageSubscription ✅
### What the Browser Actually Does (Simplified)
1. connection_init
2. ExtendedCurrentUserQuery
3. **JoinRoom** ← We do this
4. [12-21] Various global subscriptions (notifications, private messages, etc.)
5. [22] **GetRunningApp** query
6. [23] **RoomRootQuery** query
7. [24] **WithGetMembers** query
8. [25] **GetSpacesState** query
9. [26] **RoomChatQuery****CRITICAL - Gets chat history!**
10. [27] **LinkedMembers** query
11. [28-33] Media/player queries
12. [34] **RoomDisconnect** subscription ← We do this
13. [35] **MemberJoins** subscription ← **MISSING!**
14. [36] **MemberLeaves** subscription ← **MISSING!**
15. [37] **SetRole2** subscription
16. [38] **NewMessageSubscription** ← We do this
## Critical Missing Operations
### 1. RoomChatQuery (MOST IMPORTANT)
**Variables**: `{roomId: "@hyperspaceout", channelId: "general", cursor: null}`
**Returns**: Chat history (✅ GOT DATA)
**Why it matters**: This query likely registers the bot as "present" in the chat and loads message history.
```graphql
query RoomChatQuery($roomId: String!, $channelId: String!, $cursor: String) {
chatArchive(roomId: $roomId, channelId: $channelId, cursor: $cursor) {
forwardCursor
backCursor
results {
id
user {
id
isAnonymous
isSubscribed
username
displayName
avatarUrl
__typename
}
member {
id
role
__typename
}
body
time
editedAt
originalBody
reactions {
emoji
userObjects {
id
displayName
avatarUrl
__typename
}
__typename
}
__typename
}
room {
id
state {
members {
id
__typename
}
__typename
}
__typename
}
__typename
}
}
```
### 2. MemberJoins Subscription
**Variables**: `{roomId: "@hyperspaceout"}`
**Why it matters**: Notifies when members join the room.
```graphql
subscription MemberJoins($roomId: String!) {
memberJoins(roomId: $roomId) {
id
role
user {
id
username
displayName
avatarUrl
isAnonymous
__typename
}
__typename
}
}
```
### 3. MemberLeaves Subscription
**Variables**: `{roomId: "@hyperspaceout"}`
**Why it matters**: Notifies when members leave the room.
```graphql
subscription MemberLeaves($roomId: String!) {
memberLeaves(roomId: $roomId) {
id
__typename
}
}
```
## Implementation Priority
1. **HIGH**: Add `RoomChatQuery` BEFORE `NewMessageSubscription`
- This is likely why the bot isn't visible - it never "announces" its presence by loading the chat
2. **MEDIUM**: Add `MemberJoins` and `MemberLeaves` subscriptions
- These help the bot track room membership
3. **LOW**: Add other room queries (GetRunningApp, RoomRootQuery, etc.)
- These are nice-to-have but probably not critical for basic chat functionality
## Next Steps
1. Add `RoomChatQuery` after `JoinRoom` and before `NewMessageSubscription`
2. Add `MemberJoins` and `MemberLeaves` subscriptions
3. Test to see if bot becomes visible in chat
4. If still not working, add more of the room queries