[SDK] Add pds and chat clients and the canonical client hooks (#11350)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-08-13 22:26:14 +03:00
committed by GitHub
parent e1ba8fe1b0
commit c52e730112
6 changed files with 565 additions and 40 deletions
+16
View File
@@ -1,5 +1,6 @@
import {type Insets, Platform} from 'react-native'
import {type AppBskyActorDefs, BSKY_LABELER_DID} from '@atproto/api'
import {type Service} from '@atproto/lex'
import {type ProxyHeaderValue} from '#/state/session/agent'
import {BLUESKY_PROXY_DID, CHAT_PROXY_DID, IS_DEV} from '#/env'
@@ -247,6 +248,21 @@ export const BLUESKY_PROXY_HEADER = {
},
}
/**
* The chat service's proxy target, in the `did#service_id` form a lex client's
* `service` option takes. A client constructed with it emits `atproto-proxy:
* <this value>` on every request, which is what routes `chat.bsky.*` calls to
* the chat service.
*
* The DID comes from the env-configurable `CHAT_PROXY_DID` (via
* `EXPO_PUBLIC_CHAT_PROXY_DID`) rather than a hard-coded constant, so the
* target can be retargeted per environment.
*
* This is the client-level equivalent of {@link DM_SERVICE_HEADERS}, which
* carries the same value as a per-call header.
*/
export const CHAT_PROXY_SERVICE: Service = `${CHAT_PROXY_DID}#bsky_chat`
export const DM_SERVICE_HEADERS = {
'atproto-proxy': `${CHAT_PROXY_DID}#bsky_chat`,
}