Commit Graph

8032 Commits

Author SHA1 Message Date
Samuel Newman f1411df0a4 flip the preferences and labeler reads to sdk types
`UsePreferencesQueryResponse` now derives from the sdk's `BskyPreferences`
rather than the legacy one, which removes the cast the previous slice put on the
assembled response - the query already returns the sdk action's result, so the
two now type structurally.

`labeler.ts`'s three service reads move to the appview client and return
`app.bsky.labeler.defs` views, because `interpretLabelValueDefinitions` takes
the lexicon-typed view. `moderation-opts.tsx` reads `Client.appLabelers`
instead of `AtpAgent.appLabelers`: the lex static is already branded, so the
fallback labeler list satisfies `ModerationPrefsLabeler` without a cast.

`MutedWords` follows the prefs types: `expiresAt` is a `DatetimeString` now,
built with `toDatetimeString` rather than `Date.toISOString`, and
`sanitizeMutedWordValue` comes from `@bsky.app/sdk/utils`.
2026-08-13 22:13:47 +03:00
Samuel Newman 9aa6b49daf swap the moderation core to the sdk moderation module
Point the moderation primitives - the label definitions, the cause/UI/decision
types and the label-info hooks - at `@bsky.app/sdk/moderation` instead of
`@atproto/api`.

The two implementations are mutually unassignable: the sdk's subject types are
the generated `#/lexicons` views, so their `did`/`uri`/`cid` fields are
branded (`DidString`, `AtUriString`) where the `@atproto/api` views type the
same fields as plain `string`. That rules out a partial swap - a decision made
by one implementation cannot be read by the other - so the whole moderation
layer moves together.

`lib/moderation/subjects.ts` is the transitional seam for the brand mismatch.
Every `moderate*` entry point is re-exported through a wrapper that widens its
subject parameter to accept a view from either world, because many read paths
still emit `@atproto/api` views while the moderation runtime only ever reads
`.did`, `.labels` and `.viewer` - none of which the brand affects. It is
deleted in the `@atproto/api` removal pass.
2026-08-13 22:13:47 +03:00
Samuel Newman 5e9a437f53 fix mute-reposts hook 2026-08-13 22:13:47 +03:00
Samuel Newman 755ce365f6 migrate the age assurance data reads to the session clients
getOtherRequiredData's getPreferences read moves onto the sdk action, which
also unblocks fetchActorDeclarationRecord - its only caller - so the record
read moves to the pds client too.

The prefetch and refetch entry points now take the transport they need
rather than an agent: the appview client for getState and device signals,
the account client for preferences and the declaration record. The session
bundle still carries only an agent, so the three session call sites derive
both clients from it; the full bundle rework is a later slice. The standalone
config read stays on its own unauthenticated agent.
2026-08-13 22:13:47 +03:00
Samuel Newman 17c17b4543 migrate the preference read-modify-writes to sdk actions
The preferences hooks, nuxs, labeler subscriptions, list mute/block, post
interaction settings, interests and live event preferences move onto
@bsky.app/sdk actions. Preference reads and writes route through the pds
client because they live on the account's actor store, not behind the
appview proxy; the list mute writes stay on the appview client, which is
where that graph endpoint lives.

BskyAgent.getPreferences configured the agent's labelers as a side effect,
so a labeler subscription took effect on the next appview read. The sdk
action does not, so the query now calls configureLabelers explicitly.

Exported hook signatures, query keys and the usePreferencesQuery response
shape are unchanged: the sdk's BskyPreferences is field-for-field identical
to the legacy one apart from branded strings, so the response is cast at
that single seam and the muted-word and nux mutation inputs stay
legacy-typed with a cast into the action.
2026-08-13 22:13:46 +03:00
Samuel Newman a40c199523 migrate the signup and onboarding profile writes to sdk actions
The post-signup and onboarding writes (setPersonalDetails, upsertProfile,
overwriteSavedFeeds, setInterestsPref) move onto sdk actions over the pds
client, and the starter-pack and contact-import reads move to the lex
clients. Every upsertProfile call now writes a lex blob directly, so the
toLegacyBlobRef bridge has no remaining callers and is deleted.
2026-08-13 22:13:46 +03:00
Samuel Newman 926abd0566 migrate the record-mint mutations to sdk actions
like/repost/follow/delete and upsertProfile move off the bridge agent's
sugar methods onto @bsky.app/sdk actions over the pds client. The
mute/unmute and thread-mute writes route through the appview client, and
the profile reads move to the appview client behind their existing
legacy-typed hook signatures.
2026-08-13 22:13:46 +03:00
Samuel Newman 8d588518cb replace the age assurance agent clone with a token-scoped client
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 22:13:46 +03:00
Samuel Newman 88bc368991 drop the agent url reads in link meta and push registration
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 22:13:46 +03:00
Samuel Newman 4f669812b9 thread an explicit dispatch url through the video upload service auth
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 22:13:46 +03:00
Samuel Newman 7359700429 migrate the data export dialog and signup queue off raw transport
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 22:13:46 +03:00
Samuel Newman 483e79497b add refreshSession to the session api and migrate its callers
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 22:13:45 +03:00
Samuel Newman 7d8391aeb2 migrate the post pipeline write and reply lookup to the clients
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 22:13:45 +03:00
Samuel Newman 83fdc95237 migrate the blob upload helper to the pds client
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 22:13:45 +03:00
Samuel Newman 28313bb81c extract the post pipeline cid hasher with golden-cid fixtures
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 22:13:45 +03:00
Samuel Newman 89db69ce55 inline the did reads, drop the getDidFromClient util
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 22:13:45 +03:00
Samuel Newman 4c5294a1a2 migrate the status, germ declaration and block records to the pds client
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 22:13:45 +03:00
Samuel Newman 3a970a7104 migrate the starter pack writes to the pds client
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 22:13:45 +03:00
Samuel Newman a86590ad4b migrate the list and listitem records to the pds client
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 22:13:45 +03:00
Samuel Newman 780fccdbbe migrate the chat and notification declaration records to the pds client
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 22:13:45 +03:00
Samuel Newman ed652ad484 migrate the verification and chat declaration records to the pds client
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 22:13:45 +03:00
Samuel Newman 0c8cdba703 migrate the threadgate and postgate records to the pds client
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 22:13:44 +03:00
Samuel Newman a6682ebf1d add a shared getRecord RecordNotFound classifier
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 22:13:44 +03:00
Samuel Newman 74b0001335 migrate getAllListMembers to the appview client
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 22:13:44 +03:00
Samuel Newman ca1efd9514 fix lockfile 2026-08-13 22:12:54 +03:00
Samuel Newman 2beb63fb2d migrate RichText to the SDK and resolve facets via the appview
The two RichText classes are not mutually assignable - `UnicodeString` has a
private field and the SDK brands `did`/`uri` as template literal types - so
every producer and consumer of a RichText instance has to move in one step.

`detectFacets` now takes a lex client instead of the legacy agent, which is
what removes the last hard agent dependency from these files. Handle
resolution is an appview job, so the appview client is threaded in: through
`useAppviewClient` in the hooks and dialogs, and through a new
`appviewClient` option on `apilib.post` (Composer already had the client to
hand). The rest of the post pipeline still writes through the agent.

Facet feature checks move from the `AppBskyRichtextFacet` validators to the
generated `#/lexicons` schemas, matching how the rest of the app narrows
lexicon types.

Display sinks still read facets off `@atproto/api` view types, which are the
same lexicon but typed with plain strings. `asSdkFacets` widens them at those
call sites and goes away once the view types come from the SDK too.
2026-08-13 21:50:54 +03:00
Samuel Newman dbffcce821 add the @bsky.app/sdk preview package
aliased npm install of bsky-sdk-preview - it is where RichText and the
moderation helpers now live. its lex-* deps resolve to the copies the app
already uses, so there is a single @atproto/lex in the tree.
2026-08-13 21:50:54 +03:00
Samuel Newman fbc7c94b59 lint fix 2026-08-13 21:50:54 +03:00
Samuel Newman abf8ba0993 route moderation reports through the appview client with per-call proxying
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 21:50:54 +03:00
Samuel Newman 09ca1307bc migrate the app password and update handle mutations to the pds client
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 21:50:54 +03:00
Samuel Newman 1d5c0ff4af migrate the email request mutations to the pds client
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 21:50:54 +03:00
Samuel Newman a92f28461b migrate the pre-auth service calls to the service client
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 21:50:53 +03:00
Samuel Newman dc90f4ee37 migrate the account lifecycle dialogs to the pds and chat clients
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 21:50:53 +03:00
Samuel Newman cc295497fe add the arbitrary-service pre-auth client factory
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 21:50:53 +03:00
Samuel Newman 88477d0767 migrate the thread mute backfill to the appview client
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 21:50:53 +03:00
Samuel Newman 8f6181495e migrate the notification say-hello action to the chat client
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 21:50:53 +03:00
Samuel Newman 0bf2ada0c6 migrate the activity subscription queries to the appview client
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 21:50:53 +03:00
Samuel Newman f2a1a6ceb9 migrate the notification settings queries to the appview and chat clients
App preferences live on the appview and chat preferences on the chat
service, so the combined update mutation holds both clients.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 21:50:53 +03:00
Samuel Newman c1a318905b migrate the notification feed and unread checker to the appview client
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 21:50:53 +03:00
Samuel Newman c857a534ec migrate the post social queries and feed api construction sites
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 21:50:53 +03:00
Samuel Newman 8b4f284786 migrate the custom, merge and home feed apis to the appview client
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 21:50:53 +03:00
Samuel Newman 234f34f4d5 migrate the single-source feed api classes to the appview client
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 21:50:53 +03:00
Samuel Newman 5e88752fc0 migrate pds detection handle resolution to the public appview client
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 21:50:53 +03:00
Samuel Newman 6e59eeb9a6 migrate the feed source and feed feedback calls to the appview client
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 21:50:52 +03:00
Samuel Newman 1a6bfd8a6a migrate the contact queries and phone verification to the appview client
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 21:50:52 +03:00
Samuel Newman 8a87a5fdea migrate the bookmark and draft queries to the appview client
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 21:50:52 +03:00
Samuel Newman c0aafe4ffd migrate the actor search and autocomplete queries to the appview client
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 21:50:52 +03:00
Samuel Newman 38042dcc02 note why the public chat client skips the network-aware fetch
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 21:50:52 +03:00
Samuel Newman 72162c1544 classify migrated chat group errors with matchXrpcError
The lex client throws XrpcResponseError, which is not an XRPCError
subclass, so the per-method error classes generated by @atproto/api no
longer match. Those instanceof checks compile fine but silently stop
firing, degrading every typed group failure to the generic fallback
message. Narrow against the method schema instead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 21:50:52 +03:00
Samuel Newman 74f4532922 migrate the join link and join request queries to the chat client
The logged-out join link preview path built an ad-hoc AtpAgent pointed at
CHAT_SERVICE. It is now a module-level unauthenticated lex client against
the same service, so the client is built once rather than per call.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 21:50:52 +03:00