Composable Atmosphere Tangled#
Composable Atmosphere Tangled is a small Swift package for working with Tangled's AT Protocol records and XRPC APIs.
It keeps the raw Tangled surface separate from product-specific workflows. Packages such as OpenMusicEvent can build semantic review, publishing, and merge flows on top of these typed records and requests without duplicating Tangled lexicon plumbing.
Products#
-
TangledLexicon: Tangled collection NSIDs, repository and pull records, pull state records, open state values, and response models. -
TangledXRPC: XRPC request types andXRPC.Clientconveniences for Tangled bobbin, knot, repository, and authorization APIs.
Installation#
Add the package to Package.swift:
.package(
url: "https://source.woody.fm/composable-atmosphere-tangled",
branch: "main"
)
Then depend on the products you need:
.product(name: "TangledLexicon", package: "composable-atmosphere-tangled"),
.product(name: "TangledXRPC", package: "composable-atmosphere-tangled"),
Usage#
Decode Tangled records with the lexicon models:
import TangledLexicon
let record = try JSONDecoder().decode(TangledPullRecord.self, from: data)
let branch = record.target.branch
Run Tangled XRPC requests through Composable Atmosphere's XRPC.Client:
import ATProto
import TangledLexicon
import TangledXRPC
import XRPCClient
guard let repo = DID("did:plc:repo") else {
return
}
let output = try await XRPC.Client.liveValue.tangledListPulls(
subject: repo,
status: .open,
limit: 25
)
Tangled can add new pull states before this package has modeled them. Pull states and pull-status records use Composable Atmosphere's open-value wrappers so known values are ergonomic and unknown values are still preserved.
Development#
Run the package checks with:
swift build && swift test
The package depends on swift-composable-atmosphere with the TCA26 trait enabled, so CI must provide GITHUB_TOKEN while TCA26 is private.