trotsky package
This package provides a comprehensive suite of TypeScript classes and utilities designed to facilitate interaction with the AT Protocol (ATProto) and Bluesky's social networking services.
It offers a structured approach to building and executing sequences of operations—referred to as "steps"—that interact with various aspects of the protocol, such as reading user profiles, posts, likes, follows, and more.
By leveraging the schema definitions outlined in the ATProto lexicons,this package ensures type safety and consistency when interfacing with ATProto's decentralized social networking ecosystem.
Remarks
Although all classes and methods are documented and public, the package is intended for use mainly throught the Trotsky class, which serves as the main entry point using a builder pattern to create and execute sequences of steps.
Example
import { AtpAgent } from "@atproto/api"
import { Trotsky } from "trotsky"
async function main() {
const agent = new AtpAgent({ service: "https://bsky.social" })
await agent.login({ identifier: 'trotsky.pirhoo.com', password: 'p4ssw0rd' })
await Trotsky.init(agent)
.searchPosts({ q: "pizza" })
.take(3)
.each()
.reply({ text: "🍕 Pizza party! 🍕" })
.wait(1000)
.run()
}
main()Classes
Class | Description |
|---|---|
Represents a step for retrieving and handling an actor's profile using the Bluesky API. | |
Represents a step that performs an actor block operation using the Bluesky API. | |
Represents a step for retrieving the authenticated user's blocked actors using the Bluesky API. Supports paginated retrieval of blocked accounts. | |
Represents a step that performs an actor follow operation using the agent. | |
Represents a step for retrieving an actor's followers using the Bluesky API. Supports paginated retrieval of followers. | |
Represents a step for retrieving an actor's followings using the Bluesky API. Supports paginated retrieval of followings. | |
Represents a step for retrieving an actor's known followers (mutual connections) using the Bluesky API. Supports paginated retrieval of known followers. | |
Represents a step for retrieving an actor's likes using the Bluesky API. Supports paginated retrieval of likes. | |
Represents step for retrieving the lists associated with a specific actor, extending the StepLists functionality. | |
Represents a step that performs an actor mute operation using the Bluesky API. | |
Represents a step for retrieving the authenticated user's muted actors using the Bluesky API. Supports paginated retrieval of muted accounts. | |
Represents a step for retrieving an actor's posts using the Bluesky API. Supports paginated retrieval of posts. | |
An abstract class that extends StepBuilderList to handle a list of actor profiles. It defines a collection of steps dealing with actor entries ( | |
Represents a single entry step for processing actor information. Extends ActorMixins to provide common actor-related methods. | |
Represents a step for retrieving an actor's starter packs using the Bluesky API. Supports paginated retrieval of starter packs. | |
A specialized step that extends StepStreamPosts to stream an actor's posts. It uses a Jetstream-based event emitter filtered by the actor's DID. | |
Represents a step for retrieving suggested actors to follow using the Bluesky API. Supports paginated retrieval of suggestions. | |
Represents step that unblocks the current actor (if blocked). | |
Represents step that unfollows the current actor (if followed). | |
Represents step that unmutes the current actor (if muted). | |
Represents an individual entry step within a StepBuilderList. | |
Represents an individual entry step within a StepBuilderStream. | |
Represents step that creates a new post on Bluesky using the specified record parameters. | |
Represents a step for deleting a specific post. | |
Represents a step for retrieving posts from a custom feed using the Bluesky API. Supports paginated retrieval of posts. | |
Represents a step for retrieving information about a feed generator using the Bluesky API. | |
Represents a step for retrieving a list by its URI. | |
Represents a step that performs a list block operation using the Bluesky API. Blocking a list prevents content from users on that list from appearing. | |
Represents a step for retrieving posts from a list feed using the Bluesky API. Supports paginated retrieval of posts. | |
Represents step for retrieving the members of a specific list, extending the StepActors functionality. | |
Represents a step that performs a list mute operation using the Bluesky API. Muting a list hides content from users on that list without blocking them. | |
Represents an individual entry step within a StepLists list. | |
Represents a step that performs a list unblock operation using the Bluesky API. Unblocking a list allows content from users on that list to appear again. | |
Represents a step that performs a list unmute operation using the Bluesky API. Unmuting a list allows content from users on that list to appear again. | |
Represents a step for retrieving user notifications using the Bluesky API. Supports paginated retrieval of notifications. | |
Represents a step for retrieving the unread notification count using the Bluesky API. | |
Represents a step for marking notifications as seen using the Bluesky API. | |
Represents a step for retrieving a post by its URI. Extends PostMixins for post-related operations. | |
Represents a step for retrieving the profile of the author of a specific post. Extends StepActor to reuse actor-related logic. | |
Represents a step for liking a specific post. | |
Represents a step for retrieving actors who liked a post using the Bluesky API. Supports paginated retrieval of likers. | |
Represents a step for retrieving quote posts of a post using the Bluesky API. Supports paginated retrieval of quote posts. | |
Represents a step for replying to a specific post. | |
Represents a step for reposting a specific post. | |
Represents a step for retrieving actors who reposted a post using the Bluesky API. Supports paginated retrieval of reposters. | |
Abstract class representing a list of posts to process. | |
Represents an individual entry step within a StepPosts list. Extends PostMixins to include common post-related operations. | |
Represents a step for retrieving a full post thread with replies using the Bluesky API. | |
Represents a step for unliking a specific post. | |
Represents a step for unreposting (removing repost) a specific post. | |
A step that saves the current output to a JSON file at the specified path. | |
Represents a step for searching actors on Bluesky, with support for pagination. | |
Represents a step for searching posts on Bluesky, with support for pagination. | |
Represents a step for searching starter packs on Bluesky, with support for pagination. | |
Represents a step for retrieving a starter pack by its URI. | |
Abstract class representing a list of starter packs to process. | |
Represents an individual entry step within a StepStarterPacks list. Provides context for each starter pack in the iteration. | |
Represents a streaming step that processes posts in real-time. | |
Represents a step for retrieving suggested custom feeds using the Bluesky API. Supports paginated retrieval of feed suggestions. | |
Represents a step that allows interception of the current Step instance for custom processing or side effects. | |
Represents a step that performs a thread mute operation using the Bluesky API. Muting a thread hides notifications for that thread. | |
Represents a step that performs a thread unmute operation using the Bluesky API. Unmuting a thread re-enables notifications for that thread. | |
Represents a step for retrieving the authenticated user's timeline using the Bluesky API. Supports paginated retrieval of posts from followed accounts. | |
Represents step that introduces a delay before proceeding to the next step. | |
Represents a conditional step that evaluates a predicate to determine its outcome. | |
Trotsky orchestrates a sequence of steps that interact with an . |
Abstract Classes
Abstract Class | Description |
|---|---|
A mixin class providing reusable actor-related methods to extend step functionality. These methods append specific actor-related steps to the current chain. | |
A mixin class providing reusable list-related methods to extend step functionality. These methods append specific list-related steps to the current chain. | |
A mixin class providing reusable post-related methods to extend step functionality. These methods append specific post-related steps to the current chain. | |
Represents an abstract step in a sequence managed by the Trotsky framework. | |
Represents a builder for a sequence of steps. This class is used internally by the Trotsky framework. | |
Abstract class representing a step that processes paginated lists. | |
Abstract class representing a step for streaming messages using a Jetstream event emitter. | |
Abstract class representing a list of Lists to process. |
Interfaces
Interface | Description |
|---|---|
Represents a reference to a post record, including its URI and CID. | |
Represents the reply structure, containing references to both the parent and root posts. |
Type Aliases
Type Alias | Description |
|---|---|
Type representing the parameters for a post reply, including text and optional additional metadata. | |
Type representing a value that can be resolved into PostReplyParams. | |
Type representing a StepCreatePostParams type that may be resolved dynamically at runtime. | |
Type representing the output of the blocked actors retrieved by StepActorBlocks. | |
Type representing the query parameters for retrieving blocked actors. | |
Type representing the cursor for paginated queries. | |
Type representing the output of the followers retrieved by StepActorFollowers. | |
Type representing the query parameters for retrieving followers. | |
Type representing the cursor for paginated queries. | |
Type representing the output of the followings retrieved by StepActorFollowings. | |
Type representing the query parameters for retrieving followings. | |
Type representing the cursor for paginated queries. | |
Type representing the output of the known followers retrieved by StepActorKnownFollowers. | |
Type representing the query parameters for retrieving known followers. | |
Type representing the cursor for paginated queries. | |
Type representing the output of the likes retrieved by StepActorLikes. | |
Type representing the query parameters for retrieving actor likes. | |
Type representing the cursor for paginated queries. | |
Type representing the output type for the StepActorLists step, which is an array of lists associated with an actor. | |
Type representing the query parameters for retrieving an actor's lists. | |
Type representing the cursor type for paginated queries when retrieving an actor's lists. | |
Type representing the output of the muted actors retrieved by StepActorMutes. | |
Type representing the query parameters for retrieving muted actors. | |
Type representing the cursor for paginated queries. | |
Type for the output of the StepActor class. Matches the schema of the actor profile from the Bluesky API. | |
Type for the parameter passed to the StepActor class. Represents the identifier of an actor (e.g., handle or DID). | |
Type representing the output of the posts retrieved by StepActorPosts. | |
Type representing the query parameters for retrieving actor posts. | |
Type representing the cursor for paginated queries. | |
Type representing the output schema for a list of actors' profiles. | |
Type for the parameter passed to the StepActors class. Represents the identifiers of several actors (e.g., handle or DID). Bluesky currently limit this to 25 actors. | |
Type representing the output of the starter packs retrieved by StepActorStarterPacks. | |
Type representing the query parameters for retrieving actor starter packs. | |
Type representing the cursor for paginated queries. | |
Combines a Jetstream message commit with a partial post record. Typically represents the streamed output of a single post event. | |
Type representing the output of the suggested actors retrieved by StepActorSuggestions. | |
Type representing the query parameters for retrieving suggested actors. | |
Type representing the cursor for paginated queries. | |
Represents the configuration object for a StepBuilder instance. | |
Iterator function to be executed for each item in the list. | |
Represents the output of a list step as an array of items. | |
Defines the output of a create-post operation, containing the post's unique URI and CID. | |
Defines the parameters for creating a new post. Consists of a partial but excludes | |
Type representing the output of the feed generator retrieved by StepFeedGenerator. | |
Type representing the URI of a feed generator. | |
Type representing the output of the feed retrieved by StepFeed. | |
Type representing the query parameters for retrieving a feed. | |
Type representing the cursor for paginated queries. | |
Type representing the URI of a custom feed. | |
Type representing the output of the list feed retrieved by StepListFeed. | |
Type representing the query parameters for retrieving a list feed. | |
Type representing the cursor for paginated queries. | |
Represents the output type for the StepListMembers step, which is an array of actor profiles. | |
Represents the query parameters for retrieving a list's members. | |
Represents the cursor type for paginated queries when retrieving list members. | |
Represents the output of a retrieved list, including its URI and CID | |
Defines the query parameters for retrieving a list. | |
Represents the output of a Lists step, consisting of an array of List views. | |
Represents a list's URI, which can be a string or an . | |
Type representing the output of the notifications retrieved by StepNotifications. | |
Type representing the query parameters for retrieving notifications. | |
Type representing the cursor for paginated queries. | |
Type representing the output of the unread count retrieved by StepNotificationsUnreadCount. | |
Represents the output of the | |
Represents the output of the | |
Type representing the output of the likers retrieved by StepPostLikers. Each entry contains the actor who liked the post. | |
Type representing the query parameters for retrieving post likers. | |
Type representing the cursor for paginated queries. | |
Represents the output of a retrieved post, including its URI, CID, record data, and author profile. | |
Defines the query parameters for retrieving a post. | |
Type representing the output of the quotes retrieved by StepPostQuotes. | |
Type representing the query parameters for retrieving post quotes. | |
Type representing the cursor for paginated queries. | |
Represents the output of a post reply step, including the URI and CID of the reply. | |
Type representing the output of the reposters retrieved by StepPostReposters. | |
Type representing the query parameters for retrieving post reposters. | |
Type representing the cursor for paginated queries. | |
Represents the output of a repost step, including the URI and CID of the reposted content. | |
Represents the output of a posts step, consisting of an array of post views. | |
Type for the parameter passed to the StepPosts class. Represents the URIs of several post. Bluesky currently limit this to 25 posts. | |
Type representing the output of the thread retrieved by StepPostThread. | |
Type representing the query parameters for retrieving a post thread. | |
Represents a post's URI, which can be a string or an . | |
Type representing the path of the JSON file to save the output. | |
Represents the output of a search actors step, consisting of an array of actor profiles. | |
Represents the query parameters for searching actors. | |
Represents the cursor for paginating through search actor results. | |
Represents the output of a search posts step, consisting of an array of posts. | |
Represents the query parameters for searching posts. | |
Represents the cursor for paginating through search post results. | |
Represents the output of a search starter packs step, consisting of an array of starter packs. | |
Represents the query parameters for searching starter packs. | |
Represents the cursor for paginating through search starter pack results. | |
Represents the output of a retrieved starter pack, including its URI, CID, record data, creator, and associated lists/feeds. | |
Defines the query parameters for retrieving a starter pack. | |
Represents the output of a starter packs step, consisting of an array of starter pack views. | |
Defines the query parameters for retrieving multiple starter packs. | |
Type for the parameter passed to the StepStarterPacks class. Represents the URIs of several starter packs. | |
Represents a starter pack's URI, which can be a string or an . | |
Type representing the output of the suggested feeds retrieved by StepSuggestedFeeds. | |
Type representing the query parameters for retrieving suggested feeds. | |
Type representing the cursor for paginated queries. | |
Defines the type for a function that intercepts a Step instance. The interceptor can be synchronous or asynchronous. | |
Type representing the output of the timeline retrieved by StepTimeline. | |
Type representing the query parameters for retrieving the timeline. | |
Type representing the cursor for paginated queries. | |
Boolean values resolved by the StepWhen predicate. |