# Beachwave After Action Report ## Summary The initial Beachwave scaffold was added to the repository. It creates the first protocol artifact, a small SDK, a local demonstration client, protocol documentation, and lifecycle tests. This work establishes a baseline for the project, but it is not yet a production-ready live audio application. The largest remaining gaps are real ATProto authentication, a concrete ATProto repository adapter, and LiveKit media integration. ## What was done ### Repository structure Added the initial project layout: * `lexicons/community/beachwave/room.json` for the Room lexicon. * `src/sdk/` for protocol-facing TypeScript helpers. * `src/client/` for a small browser reference client. * `docs/protocol.md` for implementation-independent protocol notes. * `test/sdk.test.js` for lifecycle coverage. * `package.json` and `tsconfig.json` for build and test commands. ### Protocol and lexicon Defined the initial `community.beachwave.room` record with fields for title, optional description, LiveKit room name, lifecycle status, timestamps, and host DIDs. Documented Room semantics in `docs/protocol.md`, including purpose, lifecycle, ownership, storage location, and interoperability expectations. ### SDK Implemented the initial SDK API: * `createRoom()` * `endRoom()` * `getRoom()` * `listRooms()` * `joinRoom()` * `leaveRoom()` The SDK currently targets a generic `RepositoryClient` interface rather than binding directly to a specific ATProto library. This keeps the public API stable while allowing a real ATProto adapter to be added later. ### Reference client Added a small browser client that consumes the SDK and an in-memory repository adapter. The client can create, discover, and end local demo rooms. The client intentionally does not perform raw repository operations. This preserves the separation between reference UI and protocol behavior. ### Tests Added a Node test that exercises the room lifecycle: 1. create a room; 2. list live rooms; 3. join a live room; 4. end the room; 5. verify ended rooms are no longer listed or joinable. ## Validation performed The previous implementation was validated with: * `npm run build` * `npm test` Both commands completed successfully at the time of the initial scaffold. ## Known limitations * The reference client uses `MemoryRepositoryClient`; it is not yet connected to a real ATProto PDS. * There is no ATProto login flow yet. * LiveKit is represented by the `livekitRoom` field, but actual LiveKit token retrieval and audio connection are not implemented yet. * Speaker requests, host controls beyond ending a room, participant records, invitations, recordings, transcripts, and moderation events are not implemented yet. * The SDK update path should eventually preserve unknown fields from fetched records more deliberately and may need compare-and-swap or revision handling depending on the chosen ATProto adapter. * Discovery currently depends on explicitly provided repositories. A production client will need a broader discovery strategy. ## Notes for a future agent 1. Preserve the separation between protocol, SDK, and reference UI. The client should continue to consume the SDK like any third-party app. 2. Add a real ATProto adapter behind `RepositoryClient` before expanding UI complexity. 3. Do not make the Room lexicon reference-client-specific. Any new fields should be justified by interoperability needs. 4. Before adding future lexicons, document their purpose, lifecycle, ownership, storage location, and interoperability expectations. 5. Add LiveKit through a narrow boundary that returns credentials or connection metadata from a resolved Room record. Avoid storing secrets in ATProto records. 6. Keep tests focused on protocol behavior. UI tests can be added later, but SDK lifecycle tests should remain fast and deterministic. 7. If package dependencies are introduced, update the development docs and commit the lockfile generated by the chosen package manager. ## Recommended next steps 1. Implement an ATProto-backed `RepositoryClient` adapter. 2. Add ATProto login to the reference client. 3. Add LiveKit token service documentation and client connection flow. 4. Expand discovery beyond explicitly listed repositories. 5. Draft Participant and Speaker lexicons once room lifecycle behavior is stable. --- # Milestone 2 — ATProto OAuth and real PDS integration ## Summary Authentication was the stated blocker. This milestone adds modern ATProto OAuth, a real PDS-backed repository adapter, and the media-transport boundary, then wires the reference client through the full sign-in → room flow. ## What was done ### ATProto OAuth (from scratch, no dependencies) Added `src/sdk/atproto/`, a browser-native implementation of the public-client authorization-code flow using only Web Platform crypto: * `encoding.ts`, `jwk.ts`, `pkce.ts` — base64url/SHA-256 helpers, RFC 7638 JWK thumbprints, and PKCE. * `dpop.ts`, `transport.ts` — non-extractable P-256 DPoP keys, signed proof JWTs, and a DPoP-aware fetch that handles the `use_dpop_nonce` challenge. * `identity.ts`, `metadata.ts` — handle/DID → PDS resolution and authorization-server discovery. * `oauth-client.ts`, `oauth-session.ts`, `store.ts` — PAR + token exchange, an authenticated session with token refresh, and persistence (IndexedDB for the key, localStorage for state). The client is scope-agnostic and defaults to `atproto transition:generic`, so granular scopes can be adopted by changing one configuration string. ### Real repository adapter and dev fallback * `repository.ts` implements `RepositoryClient` against `com.atproto.repo.*`: authenticated DPoP writes to the owner's PDS, and public reads against any repository (resolving each DID's PDS). * `app-password.ts` provides an optional, clearly-scoped development fallback. ### Media boundary `src/sdk/media/` defines `MediaController`/`MediaTokenProvider`/`MediaSession` and a LiveKit adapter. Token minting is delegated to a deployer-operated endpoint because it requires a server-side secret. Media transport stays fully decoupled from room metadata. ### Reference client Rewrote `src/client/` for OAuth sign-in (primary), app-password and offline fallbacks (dev), redirect-callback handling, and the signed-in room flow (create, discover, share link, join, end) against the real PDS. Added `client-metadata.json` and loopback dev configuration. ## Validation performed * `npm run build` and `npm test` pass (added `test/oauth.test.js`, including a real ES256 DPoP sign/verify round-trip and PKCE/JWK/AT-URI/identity coverage). * Browser smoke test (Chromium): sign-in renders, offline create/join/end/sign-out work with zero console errors. * The OAuth pre-redirect pipeline was driven against live Bluesky infrastructure: handle resolution, auth-server discovery, DPoP, and a PAR that exercised the `use_dpop_nonce` retry and returned a real `request_uri`. ## Known limitations / next steps * The token-exchange callback and authenticated writes require a real interactive login to validate end to end; they reuse the DPoP transport already exercised by PAR. * In-app audio requires a LiveKit token service (documented in `deployment.md`). * Speaker request/approval and moderation remain future milestones pending the Participant/Speaker/Invitation/Moderation lexicons. --- # Milestone 3 — Working rooms: audio, presence, chat, and Bluesky sharing ## Summary After the first interactive sign-in (via the app-password fallback) it became clear the room "worked" but didn't *feel* like one: no audio was actually audible, and there was no sense of who was present. This milestone makes the room real and chooses the product direction — live rooms shared into the Bluesky feed. ## What was done ### Real audio The LiveKit adapter previously connected and published the local microphone but never attached *remote* audio tracks, so participants could not hear each other. The adapter now attaches subscribed audio tracks to hidden `