Replace the old @atproto/lex-cli `lex gen-api` codegen (and its pile of sed
hacks in the Makefile) with Bluesky's newer @atproto/lex `lex build`.
Generator/build:
- Root: drop @atproto/lex-cli, add @atproto/lex; js/streamplace depends on it
at runtime (generated files import `l`, and the agent uses `Client`).
- Rewrite the `js-lexicons` Makefile target to `lex build` against a merged
lexicon dir (upstream atproto + streamplace overrides), with --clear
--index-file. Excludes place.stream.live.subscribeSegments (a raw-bytes
subscription message the typed-union codegen can't express; unused in JS).
- Add scripts/gen-raw-lexicons.mjs to bundle the raw place.stream/games lexicon
docs into `schemas` (the new tool doesn't emit that array, but a couple of
consumers introspect it at runtime).
streamplace package:
- @atproto/lex is ESM-only, so make `streamplace` an ESM package (type: module,
node16 resolution) and regenerate with .js import extensions.
- StreamplaceAgent still extends @atproto/api Agent for OAuth + Bluesky, and now
exposes `agent.client` (a @atproto/lex Client) built from the same session's
did/fetchHandler. Drop the old PlaceNS + Lexicons wiring.
- Re-author useful-types hydrated interfaces against the new .Main/view types.
Consumers:
- Adopt the new client idiom at all call sites: agent.place.stream.X.Y(...) ->
agent.client.call(place.stream.X.Y, ...) (body returned directly, no .data);
record CRUD on place.stream.* -> agent.client.create/get/put/delete/list.
- Rewrite type refs from flat PlaceStreamXxx to the hierarchical place.* / games.*
namespaces (.Record -> .Main), and guards to schema `.isTypeOf`/`.$isTypeOf`.
- Bluesky (app.bsky.*) types and calls stay on @atproto/api.
Tooling:
- js/app tsconfig: moduleResolution bundler (reads @atproto/lex's exports map),
with paths aliases for the exports-restricted packages whose historical deep
imports Metro still resolves at runtime.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>