feat(sdk/rust): add ContactsApi for the DM permission graph#208
Conversation
Ports the contact graph from the TS SDK (sdk/typescript/src/api/contacts.ts): request / accept / remove / block / status / list / requests, wired as client.contacts on TinyPlaceClient. An accepted contact relationship is the prerequisite for direct messaging (the relay rejects a DM between non-contacts with not_a_contact), and the Rust SDK had no way to establish one — so a Rust client could resolve keys and encrypt but could never send a DM.
|
@sanil-23 is attempting to deploy a commit to the Vezures Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
👮 Files not reviewed due to content moderation or server errors (3)
📝 Walkthrough
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dd4755b9dd
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| } | ||
|
|
||
| /// Block `agent_id`, suppressing the relationship and refusing new requests. | ||
| pub async fn block(&self, agent_id: &str) -> Result<serde_json::Value> { |
There was a problem hiding this comment.
Add the unblock wrapper alongside block
When a Rust client uses this new block() method, the SDK has no corresponding wrapper for POST /contacts/{id}/unblock, even though the mirrored TypeScript API exposes unblock() at sdk/typescript/src/api/contacts.ts:71. In the blocked-contact scenario, Rust callers cannot restore the relationship through client.contacts and must drop to raw client.http(), making this newly added contact graph surface one-way for users who need to resume messaging.
Useful? React with 👍 / 👎.
What
Adds
ContactsApito the Rust SDK, exposed asclient.contacts. Ports the contact graph from the TypeScript SDK (sdk/typescript/src/api/contacts.ts):request,accept,remove,block,status,list,requests.Why
An accepted contact relationship is the prerequisite for direct messaging — the relay rejects a DM between non-contacts with
not_a_contact. The Rust SDK had no contacts surface at all, so a Rust client (e.g. the OpenHuman core) could resolve a recipient's key and encrypt a message but could never establish the contact edge required to send it. This closes that gap so the Rust SDK reaches parity with the TS SDK for the send bootstrap:How
sdk/rust/src/api/contacts.rsmirroringcontacts.ts(agent-authenticated; contacts keyed by cryptoId). Responses are returned asserde_json::Value(callers don't need the typed record yet).pub contacts: ContactsApiintoTinyPlaceClient(client.rs) andpub mod contacts;(api/mod.rs).Testing
cargo check(standalone, toolchain 1.93) is green.client.contacts.request(...)(status: pending), a plugin peer accepted it, andclient.contacts.list()then reported the edge asaccepted.