runtime
Hand-written base module for the AT Protocol Kotlin SDK. Kotlin Multiplatform (JVM + iOS) library that every generated model and service depends on.
What's in here
Typed value classes for every AT Protocol string format:
Did,Handle,AtIdentifier,AtUri,Cid,Datetime,Nsid,RecordKey,Language. Use these instead of raw strings — they're zero-overhead and prevent mixing.AtField<T>— three-state optionality (Missing/Null/Defined) for mutation payloads where "absent" and "null" are distinct wire states (e.g.putPreferences).OpenUnioninfrastructure — base types and serializers for sealed-interface unions with a$typediscriminator and anUnknownfallback for forward compatibility.XrpcClient— Ktor-backed client wrapping a caller-suppliedHttpClient. Exposesquery()for GETs,procedure()for POSTs. Generated*Serviceclasses wrap this; prefer those for lexicon endpoints.AuthProvider— pluggable auth interface.NoAuthfor unauthenticated calls; bearer-token and DPoP implementations live in consumer modules (e.g.oauth).paginate()/paginatePages()— generic Flow builders for cursor-paginated endpoints. Generated*Flow()/*PageFlow()extensions on service classes call these under the hood.Record encode/decode helpers —
encodeRecord()injects$typefor mutation payloads;decodeRecord<T>()extracts typed records fromJsonObjectvalues on the wire.
Typical consumers
models — declares
api(project(":runtime"))so every downstream project transitively picks up the runtime types.oauth — builds on
AuthProviderandXrpcClient.Application code — usually never touches
XrpcClientdirectly; constructs<Namespace>Service(client)frommodels.