Skip to main content

Crate skybouncer

Crate skybouncer 

Source
Expand description

§Skybouncer

Sovereign, rule-driven automated moderation and bouncer service for the AT Protocol (ATProto) and Bluesky.

skybouncer continuously monitors incoming interactions (mentions, replies, quotes) targeting protected users, evaluates candidate interactions against user-defined rule rubrics via low-latency System-1 classifiers (Jev), and automatically mutates ATProto Moderation Lists (app.bsky.graph.listitem) to shield users from harassment, bad-faith sea-lioning, and crypto spam.

Re-exports§

pub use crypto::SessionCipher;
pub use tenant::Tenant;
pub use tenant::TenantRegistry;
pub use tenant::DEFAULT_HANDLE_TTL;
pub use tenant::DEFAULT_REAUTH_REMINDER_INTERVAL;
pub use tenant::MAX_REAUTH_NOTIFICATIONS;
pub use bot::account_label;
pub use bot::account_label_with_url;
pub use bot::bsky_post_or_web_url;
pub use bot::bsky_post_url;
pub use bot::bsky_post_url_from_at_uri;
pub use bot::bsky_profile_url;
pub use bot::command_target;
pub use bot::format_bounce_alert;
pub use bot::format_reauth_alert;
pub use bot::format_reauth_alert_with_count;
pub use bot::run_bot_poller;
pub use bot::run_bounce_alert_dispatcher;
pub use bot::run_reauth_alert_dispatcher;
pub use bot::BotCommandHandler;
pub use bot::BSKY_WEB_ORIGIN;
pub use bot::DEFAULT_BOT_POLL_INTERVAL;
pub use enricher::AppViewContextEnricher;
pub use enricher::AuthorContext;
pub use enricher::ContextEnricher;
pub use enricher::ContextImageRef;
pub use enricher::EnrichedContext;
pub use enricher::MockContextEnricher;
pub use enricher::NoopContextEnricher;
pub use enricher::ParentPostContext;
pub use enricher::PostEmbedSummary;
pub use enricher::QuotedAncestor;
pub use enricher::ThreadPost;
pub use enricher::DEFAULT_APPVIEW_ENDPOINT;
pub use enricher::DEFAULT_ENRICHER_TIMEOUT_MS;
pub use enricher::MAX_CONTEXT_IMAGES;
pub use enricher::MAX_POST_IMAGES;
pub use enricher::MAX_RENDERED_THREAD_ANCESTORS;
pub use enricher::THREAD_ANCESTOR_CHAR_CAP;
pub use limiter::EvaluationRateLimiter;
pub use limiter::RateLimiterConfig;
pub use limiter::DEFAULT_MAX_EVALUATIONS_PER_WINDOW;
pub use limiter::DEFAULT_RATE_LIMIT_WINDOW;
pub use stream::run_jetstream_streamer;
pub use stream::StreamConfig;
pub use web::create_web_router;
pub use web::get_prometheus_metrics;
pub use web::run_web_server;
pub use web::AddAllowlistRequest;
pub use web::AddAllowlistResponse;
pub use web::AllowlistQuery;
pub use web::ApiState;
pub use web::BouncedUserWithHandle;
pub use web::BouncesQuery;
pub use web::EvaluationsQuery;
pub use web::EvaluationsResponse;
pub use web::GuestRateLimitDecision;
pub use web::GuestSandboxLimiter;
pub use web::GuestSimulateRequest;
pub use web::GuestSimulateResponse;
pub use web::LoginQuery;
pub use web::OAuthState;
pub use web::PardonRequest;
pub use web::PardonResponse;
pub use web::RemoveAllowlistResponse;
pub use web::ResolveQuery;
pub use web::ResolveResponse;
pub use web::RulesResponse;
pub use web::SimulateRequest;
pub use web::SimulateResponse;
pub use web::StatusResponse;
pub use web::UpdateRulesRequest;
pub use web::UpgradeBounceRequest;
pub use web::UpgradeBounceResponse;
pub use web::WebServerConfig;
pub use web::DEFAULT_WEB_HOST;
pub use web::DEFAULT_WEB_PORT;
pub use classifier::BounceDuration;
pub use classifier::Classifier;
pub use classifier::DynamicModelPolicy;
pub use classifier::DynamicPrimaryClassifier;
pub use classifier::DynamicPrimaryStats;
pub use classifier::DynamicPrimaryStatsSnapshot;
pub use classifier::HeuristicClassifier;
pub use classifier::HeuristicRule;
pub use classifier::JevClassifier;
pub use classifier::JevConfig;
pub use classifier::MockClassifier;
pub use classifier::OllamaChatOptions;
pub use classifier::RuleRubric;
pub use classifier::Sensitivity;
pub use classifier::Verdict;
pub use classifier::ViolationCategory;
pub use classifier::DEFAULT_MULTIMODAL_PRIMARY_MODEL;
pub use classifier::DEFAULT_OLLAMA_NUM_CTX;
pub use classifier::DEFAULT_TEXT_ONLY_PRIMARY_MODEL;
pub use engine::simulate::SimulateTierStage;
pub use engine::simulate::SimulationInputs;
pub use engine::simulate::SimulationResult;
pub use engine::BounceNotification;
pub use engine::EngineStats;
pub use engine::EngineStatsSnapshot;
pub use engine::InteractionOutcome;
pub use engine::ProcessCommitResult;
pub use engine::ProcessOutcome;
pub use engine::ReauthNotification;
pub use engine::SkybouncerConfig;
pub use engine::SkybouncerEngine;
pub use engine::SkybouncerEngineBuilder;
pub use engine::SovereignConfigSyncEvent;
pub use engine::DEFAULT_ENGINE_CHANNEL_CAPACITY;
pub use engine::DEFAULT_EVALUATION_CACHE_TTL;
pub use engine::DEFAULT_EVALUATION_CONCURRENCY;
pub use engine::DEFAULT_EVALUATION_QUEUE_CAPACITY;
pub use engine::DEFAULT_MAINTENANCE_INTERVAL;
pub use engine::DEFAULT_SHUTDOWN_TIMEOUT;
pub use error::SkybouncerError;
pub use matcher::BypassReason;
pub use matcher::FollowGraph;
pub use matcher::FollowSyncEvent;
pub use matcher::GateDecision;
pub use matcher::Interaction;
pub use matcher::InteractionType;
pub use matcher::NonFollowedGate;
pub use matcher::TargetMatcher;
pub use modlist::extract_rubric_from_list_description;
pub use modlist::fetch_sovereign_config;
pub use modlist::format_list_description_with_rubric;
pub use modlist::publish_sovereign_config;
pub use modlist::AllowlistEntry;
pub use modlist::ArchivedBounce;
pub use modlist::BounceRequest;
pub use modlist::BouncedUser;
pub use modlist::DeduplicationCache;
pub use modlist::ManualBounceOutcome;
pub use modlist::ModListConfig;
pub use modlist::ModListManager;
pub use modlist::SovereignConfigRecord;
pub use modlist::DEFAULT_MOD_LIST_DESCRIPTION;
pub use modlist::DEFAULT_MOD_LIST_NAME;
pub use modlist::SOVEREIGN_CONFIG_COLLECTION;
pub use modlist::SOVEREIGN_CONFIG_RKEY;

Modules§

app
Operational CLI command implementations (status, pardon, simulate).
bot
ATProto Chat (chat.bsky.convo.*) DM Bot Interface.
classifier
Pluggable classifier engine, verdict data models, and rule rubric definitions.
cli
CLI argument parsing, configuration assembly, and report formatting.
crypto
Cryptographic helpers for authenticated encryption at rest.
daemon
Live 24/7 firehose daemon orchestration.
engine
Asynchronous moderation engine coordinating event ingestion, target matching, non-followed account gating, classifier evaluation, and sovereign PDS modlist mutations.
enricher
Context enricher querying author profile metadata and parent post conversation threads.
env
Environment-variable helpers with consistent dual-prefix resolution.
error
Strongly-typed errors for the skybouncer crate.
limiter
Tier-4 evaluation rate limiter protecting against Denial-of-Wallet attacks.
matcher
Target matching, interaction extraction, and non-followed bypass gate.
modlist
Sovereign ATProto moderation list management, PDS mutations, and SQLite deduplication.
stream
Jetstream WebSocket streaming client for live firehose ingestion.
tenant
Multi-tenant hosted service registry managing dynamic user enrollment and DPoP sessions.
time
Clock-warp-safe time helpers shared across persistence and engine layers.
types
ATProto Lexicon data models for skybouncer.
util
Small internal utilities shared across modules.
web
Sovereign Web Dashboard and ATProto OAuth 2.0 PKCE server.

Structs§

AcceptConvoRequest
Request body for chat.bsky.convo.acceptConvo.
AcceptConvoResponse
Response payload from chat.bsky.convo.acceptConvo.
ByteSlice
UTF-8 byte slice range for rich text facets (app.bsky.richtext.facet#byteSlice).
ChatClient
Asynchronous HTTP client for interacting with the ATProto Chat service.
ConvoMember
Member within an ATProto Chat conversation.
ConvoView
Conversation representation in chat.bsky.convo.defs#convoView.
Facet
Rich text facet annotation associating a byte slice with features (app.bsky.richtext.facet).
FollowRecord
ATProto graph follow record model (app.bsky.graph.follow).
GetMessagesResponse
Response payload from chat.bsky.convo.getMessages.
ListConvoRequestsResponse
Response payload from chat.bsky.convo.listConvoRequests.
ListConvosResponse
Response payload from chat.bsky.convo.listConvos.
ListItemRecord
ATProto list item record model (app.bsky.graph.listitem).
ListRecordsResponse
The response payload from com.atproto.repo.listRecords.
MessageSender
Sender details for an individual chat message.
MessageView
Individual message representation in chat.bsky.convo.defs#messageView.
ModListRecord
ATProto moderation list record model (app.bsky.graph.list).
PostRecord
ATProto post record model (app.bsky.feed.post).
RecordEmbed
Quoted record embed reference (app.bsky.embed.record).
RecordWithMediaEmbed
Quoted record combined with media attachments (app.bsky.embed.recordWithMedia).
ReplyRef
Reply references connecting a post to its thread root and immediate parent (app.bsky.feed.post#replyRef).
RepoRecordItem
A record item returned by com.atproto.repo.listRecords.
SendMessagePayload
Request payload to send a message via chat.bsky.convo.sendMessage.
SendMessageRequest
Request body for chat.bsky.convo.sendMessage.
StrongRef
Strong reference to an ATProto repository record (com.atproto.repo.strongRef).
UpdateReadRequest
Request body for chat.bsky.convo.updateRead.

Enums§

Embed
Embedded content union on a post record (app.bsky.feed.post#embed).
FacetFeature
Feature metadata embedded within rich text facets (app.bsky.richtext.facet#features).

Constants§

DEFAULT_CHAT_ENDPOINT
Default public Bluesky chat service endpoint.
DEFAULT_JETSTREAM_ENDPOINT
Default public Jetstream endpoint.

Functions§

extract_did_for_collection
Extracts the authority DID from an AT-URI if and only if the collection matches expected_collection and the record key (rkey) is non-empty.
extract_did_from_at_uri
Extracts the DID portion from an AT-URI (at://{did}/{collection}/{rkey}).
extract_link_facets
Extracts all HTTP and HTTPS link facets from text with accurate UTF-8 byte slice offsets.
format_system_time_iso8601
Formats a std::time::SystemTime as an ISO-8601 (RFC 3339) UTC timestamp string.
now_iso8601
Convenience function returning the current UTC time as an ISO-8601 string.

Type Aliases§

FacetIndex
Alias for ByteSlice conforming to ATProto rich text byte index terminology.