@antiphony/shared
Shared types, Zod schemas, and request/response codecs for Antiphony — open infrastructure and an AT Protocol lexicon for audio call-and-response.
This is the contract package: the same Zod schemas that validate the wire format in apps/core-api, mirror the dev.antiphony.* lexicons, and type any client built on the public API. If you're building against Antiphony, this is what you import.
Docs: https://docs.antiphony.dev — start with the lexicons.
Install
npm install @antiphony/shared zod
zod is the only runtime dependency and the peer of every validation schema.
Dual ESM/CJS
Ships both ESM and CommonJS builds with correct type resolution under node16/nodenext and bundlers (verified with @arethetypeswrong/cli). import and require both resolve to the right artifact.
Exports
import { AudioPostRecordSchema, AudioPostViewSchema } from '@antiphony/shared';
The root re-exports the most-used pieces (audio records + views, codecs, NSIDs, errors, utils, observability). Granular subpaths are available too:
| Subpath | What's in it |
|---|---|
@antiphony/shared | The common surface: audio records + views, api-codecs, nsid, errors, utils, observability. |
@antiphony/shared/api-codecs | Request/response Zod codecs for the REST surface. |
@antiphony/shared/nsid | The dev.antiphony.* NSID constants. |
@antiphony/shared/errors | Shared error types and helpers. |
@antiphony/shared/utils | Pure shared utilities (projection/date/sanitization helpers). |
@antiphony/shared/observability | Logging/error-reporting helpers (./observability/report-error for just the reporter). |
@antiphony/shared/types/* | Individual type modules: audio, blob, dids, processing, records, remote-posts, spaces, url. |
The records this models
dev.antiphony.audio.post— the single canonical content record. A post without areplyis a prompt; with areplyit's a reply.dev.antiphony.embed.audio— the audio attachment (stored record + hydrated view with a playback URL through the core's audio proxy).dev.antiphony.audio.transcript— platform-enrichment transcript, lifted into the embed view at read time.dev.antiphony.actor.profile— the portable actor-profile shape. Lexicon-only: the core never stores it; the calling app owns profile data.
A stored post may also carry a space placement (SpacePlacementSchema in types/spaces: space type, space key and author segment), when it lives in an atproto space rather than flat. It is storage-layer, like originAppId: not in the lexicon, not in the record CID, and visible only through the post's at:// URI. See specs/spaces.md.
See the lexicon reference for the full contract.
License
MIT