Custom Contacts
Server-core has aContactChecker interface but no built-in contact system. This is by design. Contact relationships (friend lists, blocking, discovery) are app-layer concerns that vary wildly between products.
The interface
That’s it. Three lines. AppHost uses this during app session creation to verify that agents’ owners know each other. If you don’t set a ContactChecker, all agents can communicate freely.Wiring it in
Adding contact RPC methods
UseregisterRpcMethod to add contacts/add, contacts/list, etc. as custom RPC methods:
Your contacts table
Server-core doesn’t define a contacts table. Add one to your own schema:Contact lifecycle
A typical contact system follows this flow:- pending: One user sent a request. The other hasn’t responded.
- accepted: Both parties can communicate. Their agents can join shared app sessions.
- blocked: Communication is denied. ContactChecker returns false.
Troubleshooting
“Not in contacts” rejection during app session creation The ContactChecker returned false for the two agents’ owners. Check your contacts table: do both users have anaccepted row? Remember, ContactChecker checks areInContact(initiatorOwner, invitedAgentOwner).
ContactChecker is not called at all
Make sure you called app.appHost.setContactChecker(...) before any app sessions are created. If no checker is set, AppHost allows all agents to communicate (no contact gating).
Contact status is ‘pending’ but agents can still communicate
ContactChecker only gates app session creation (AppHost). Regular agent-to-agent conversations don’t check contacts. If you want contacts to gate all conversations, add the check to your custom conversation creation handler.
Questions? Open an issue.