add lexicon codegen: vendored lexicons, lex cli and generation scripts

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-08-03 12:06:59 +03:00
parent a2129885c6
commit a3243820c9
311 changed files with 23342 additions and 14 deletions
+17
View File
@@ -0,0 +1,17 @@
{
"id": "com.atproto.sync.defs",
"defs": {
"hostStatus": {
"type": "string",
"knownValues": [
"active",
"idle",
"offline",
"throttled",
"banned"
]
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
+50
View File
@@ -0,0 +1,50 @@
{
"id": "com.atproto.sync.getBlob",
"defs": {
"main": {
"type": "query",
"errors": [
{
"name": "BlobNotFound"
},
{
"name": "RepoNotFound"
},
{
"name": "RepoTakendown"
},
{
"name": "RepoSuspended"
},
{
"name": "RepoDeactivated"
}
],
"output": {
"encoding": "*/*"
},
"parameters": {
"type": "params",
"required": [
"did",
"cid"
],
"properties": {
"cid": {
"type": "string",
"format": "cid",
"description": "The CID of the blob to fetch"
},
"did": {
"type": "string",
"format": "did",
"description": "The DID of the account."
}
}
},
"description": "Get a blob associated with a given account. Returns the full blob as originally uploaded. Does not require auth; implemented by PDS."
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
+52
View File
@@ -0,0 +1,52 @@
{
"id": "com.atproto.sync.getBlocks",
"defs": {
"main": {
"type": "query",
"errors": [
{
"name": "BlockNotFound"
},
{
"name": "RepoNotFound"
},
{
"name": "RepoTakendown"
},
{
"name": "RepoSuspended"
},
{
"name": "RepoDeactivated"
}
],
"output": {
"encoding": "application/vnd.ipld.car"
},
"parameters": {
"type": "params",
"required": [
"did",
"cids"
],
"properties": {
"did": {
"type": "string",
"format": "did",
"description": "The DID of the repo."
},
"cids": {
"type": "array",
"items": {
"type": "string",
"format": "cid"
}
}
}
},
"description": "Get data blocks from a given repo, by CID. For example, intermediate MST nodes, or records. Does not require auth; implemented by PDS."
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
@@ -0,0 +1,27 @@
{
"id": "com.atproto.sync.getCheckout",
"defs": {
"main": {
"type": "query",
"output": {
"encoding": "application/vnd.ipld.car"
},
"parameters": {
"type": "params",
"required": [
"did"
],
"properties": {
"did": {
"type": "string",
"format": "did",
"description": "The DID of the repo."
}
}
},
"description": "DEPRECATED - please use com.atproto.sync.getRepo instead"
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
+44
View File
@@ -0,0 +1,44 @@
{
"id": "com.atproto.sync.getHead",
"defs": {
"main": {
"type": "query",
"errors": [
{
"name": "HeadNotFound"
}
],
"output": {
"schema": {
"type": "object",
"required": [
"root"
],
"properties": {
"root": {
"type": "string",
"format": "cid"
}
}
},
"encoding": "application/json"
},
"parameters": {
"type": "params",
"required": [
"did"
],
"properties": {
"did": {
"type": "string",
"format": "did",
"description": "The DID of the repo."
}
}
},
"description": "DEPRECATED - please use com.atproto.sync.getLatestCommit instead"
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
@@ -0,0 +1,54 @@
{
"id": "com.atproto.sync.getHostStatus",
"defs": {
"main": {
"type": "query",
"errors": [
{
"name": "HostNotFound"
}
],
"output": {
"schema": {
"type": "object",
"required": [
"hostname"
],
"properties": {
"seq": {
"type": "integer",
"description": "Recent repo stream event sequence number. May be delayed from actual stream processing (eg, persisted cursor not in-memory cursor)."
},
"status": {
"ref": "com.atproto.sync.defs#hostStatus",
"type": "ref"
},
"hostname": {
"type": "string"
},
"accountCount": {
"type": "integer",
"description": "Number of accounts on the server which are associated with the upstream host. Note that the upstream may actually have more accounts."
}
}
},
"encoding": "application/json"
},
"parameters": {
"type": "params",
"required": [
"hostname"
],
"properties": {
"hostname": {
"type": "string",
"description": "Hostname of the host (eg, PDS or relay) being queried."
}
}
},
"description": "Returns information about a specified upstream host, as consumed by the server. Implemented by relays."
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
@@ -0,0 +1,58 @@
{
"id": "com.atproto.sync.getLatestCommit",
"defs": {
"main": {
"type": "query",
"errors": [
{
"name": "RepoNotFound"
},
{
"name": "RepoTakendown"
},
{
"name": "RepoSuspended"
},
{
"name": "RepoDeactivated"
}
],
"output": {
"schema": {
"type": "object",
"required": [
"cid",
"rev"
],
"properties": {
"cid": {
"type": "string",
"format": "cid"
},
"rev": {
"type": "string",
"format": "tid"
}
}
},
"encoding": "application/json"
},
"parameters": {
"type": "params",
"required": [
"did"
],
"properties": {
"did": {
"type": "string",
"format": "did",
"description": "The DID of the repo."
}
}
},
"description": "Get the current commit CID & revision of the specified repo. Does not require auth."
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
+55
View File
@@ -0,0 +1,55 @@
{
"id": "com.atproto.sync.getRecord",
"defs": {
"main": {
"type": "query",
"errors": [
{
"name": "RecordNotFound"
},
{
"name": "RepoNotFound"
},
{
"name": "RepoTakendown"
},
{
"name": "RepoSuspended"
},
{
"name": "RepoDeactivated"
}
],
"output": {
"encoding": "application/vnd.ipld.car"
},
"parameters": {
"type": "params",
"required": [
"did",
"collection",
"rkey"
],
"properties": {
"did": {
"type": "string",
"format": "did",
"description": "The DID of the repo."
},
"rkey": {
"type": "string",
"format": "record-key",
"description": "Record Key"
},
"collection": {
"type": "string",
"format": "nsid"
}
}
},
"description": "Get data blocks needed to prove the existence or non-existence of record in the current version of repo. Does not require auth."
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
+46
View File
@@ -0,0 +1,46 @@
{
"id": "com.atproto.sync.getRepo",
"defs": {
"main": {
"type": "query",
"errors": [
{
"name": "RepoNotFound"
},
{
"name": "RepoTakendown"
},
{
"name": "RepoSuspended"
},
{
"name": "RepoDeactivated"
}
],
"output": {
"encoding": "application/vnd.ipld.car"
},
"parameters": {
"type": "params",
"required": [
"did"
],
"properties": {
"did": {
"type": "string",
"format": "did",
"description": "The DID of the repo."
},
"since": {
"type": "string",
"format": "tid",
"description": "The revision ('rev') of the repo to create a diff from."
}
}
},
"description": "Download a repository export as CAR file. Optionally only a 'diff' since a previous revision. Does not require auth; implemented by PDS."
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
@@ -0,0 +1,65 @@
{
"id": "com.atproto.sync.getRepoStatus",
"defs": {
"main": {
"type": "query",
"errors": [
{
"name": "RepoNotFound"
}
],
"output": {
"schema": {
"type": "object",
"required": [
"did",
"active"
],
"properties": {
"did": {
"type": "string",
"format": "did"
},
"rev": {
"type": "string",
"format": "tid",
"description": "Optional field, the current rev of the repo, if active=true"
},
"active": {
"type": "boolean"
},
"status": {
"type": "string",
"description": "If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted.",
"knownValues": [
"takendown",
"suspended",
"deleted",
"deactivated",
"desynchronized",
"throttled"
]
}
}
},
"encoding": "application/json"
},
"parameters": {
"type": "params",
"required": [
"did"
],
"properties": {
"did": {
"type": "string",
"format": "did",
"description": "The DID of the repo."
}
}
},
"description": "Get the hosting status for a repository, on this server. Expected to be implemented by PDS and Relay."
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
+73
View File
@@ -0,0 +1,73 @@
{
"id": "com.atproto.sync.listBlobs",
"defs": {
"main": {
"type": "query",
"errors": [
{
"name": "RepoNotFound"
},
{
"name": "RepoTakendown"
},
{
"name": "RepoSuspended"
},
{
"name": "RepoDeactivated"
}
],
"output": {
"schema": {
"type": "object",
"required": [
"cids"
],
"properties": {
"cids": {
"type": "array",
"items": {
"type": "string",
"format": "cid"
}
},
"cursor": {
"type": "string"
}
}
},
"encoding": "application/json"
},
"parameters": {
"type": "params",
"required": [
"did"
],
"properties": {
"did": {
"type": "string",
"format": "did",
"description": "The DID of the repo."
},
"limit": {
"type": "integer",
"default": 500,
"maximum": 1000,
"minimum": 1
},
"since": {
"type": "string",
"format": "tid",
"description": "Optional revision of the repo to list blobs since."
},
"cursor": {
"type": "string"
}
}
},
"description": "List blob CIDs for an account, since some repo revision. Does not require auth; implemented by PDS."
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
+70
View File
@@ -0,0 +1,70 @@
{
"id": "com.atproto.sync.listHosts",
"defs": {
"host": {
"type": "object",
"required": [
"hostname"
],
"properties": {
"seq": {
"type": "integer",
"description": "Recent repo stream event sequence number. May be delayed from actual stream processing (eg, persisted cursor not in-memory cursor)."
},
"status": {
"ref": "com.atproto.sync.defs#hostStatus",
"type": "ref"
},
"hostname": {
"type": "string",
"description": "hostname of server; not a URL (no scheme)"
},
"accountCount": {
"type": "integer"
}
}
},
"main": {
"type": "query",
"output": {
"schema": {
"type": "object",
"required": [
"hosts"
],
"properties": {
"hosts": {
"type": "array",
"items": {
"ref": "#host",
"type": "ref"
},
"description": "Sort order is not formally specified. Recommended order is by time host was first seen by the server, with oldest first."
},
"cursor": {
"type": "string"
}
}
},
"encoding": "application/json"
},
"parameters": {
"type": "params",
"properties": {
"limit": {
"type": "integer",
"default": 200,
"maximum": 1000,
"minimum": 1
},
"cursor": {
"type": "string"
}
}
},
"description": "Enumerates upstream hosts (eg, PDS or relay instances) that this service consumes from. Implemented by relays."
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
+84
View File
@@ -0,0 +1,84 @@
{
"id": "com.atproto.sync.listRepos",
"defs": {
"main": {
"type": "query",
"output": {
"schema": {
"type": "object",
"required": [
"repos"
],
"properties": {
"repos": {
"type": "array",
"items": {
"ref": "#repo",
"type": "ref"
}
},
"cursor": {
"type": "string"
}
}
},
"encoding": "application/json"
},
"parameters": {
"type": "params",
"properties": {
"limit": {
"type": "integer",
"default": 500,
"maximum": 1000,
"minimum": 1
},
"cursor": {
"type": "string"
}
}
},
"description": "Enumerates all the DID, rev, and commit CID for all repos hosted by this service. Does not require auth; implemented by PDS and Relay."
},
"repo": {
"type": "object",
"required": [
"did",
"head",
"rev"
],
"properties": {
"did": {
"type": "string",
"format": "did"
},
"rev": {
"type": "string",
"format": "tid"
},
"head": {
"type": "string",
"format": "cid",
"description": "Current repo commit CID"
},
"active": {
"type": "boolean"
},
"status": {
"type": "string",
"description": "If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted.",
"knownValues": [
"takendown",
"suspended",
"deleted",
"deactivated",
"desynchronized",
"throttled"
]
}
}
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
@@ -0,0 +1,66 @@
{
"id": "com.atproto.sync.listReposByCollection",
"defs": {
"main": {
"type": "query",
"output": {
"schema": {
"type": "object",
"required": [
"repos"
],
"properties": {
"repos": {
"type": "array",
"items": {
"ref": "#repo",
"type": "ref"
}
},
"cursor": {
"type": "string"
}
}
},
"encoding": "application/json"
},
"parameters": {
"type": "params",
"required": [
"collection"
],
"properties": {
"limit": {
"type": "integer",
"default": 500,
"maximum": 2000,
"minimum": 1,
"description": "Maximum size of response set. Recommend setting a large maximum (1000+) when enumerating large DID lists."
},
"cursor": {
"type": "string"
},
"collection": {
"type": "string",
"format": "nsid"
}
}
},
"description": "Enumerates all the DIDs which have records with the given collection NSID."
},
"repo": {
"type": "object",
"required": [
"did"
],
"properties": {
"did": {
"type": "string",
"format": "did"
}
}
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
@@ -0,0 +1,26 @@
{
"id": "com.atproto.sync.notifyOfUpdate",
"defs": {
"main": {
"type": "procedure",
"input": {
"schema": {
"type": "object",
"required": [
"hostname"
],
"properties": {
"hostname": {
"type": "string",
"description": "Hostname of the current service (usually a PDS) that is notifying of update."
}
}
},
"encoding": "application/json"
},
"description": "Notify a crawling service of a recent update, and that crawling should resume. Intended use is after a gap between repo stream events caused the crawling service to disconnect. Does not require auth; implemented by Relay. DEPRECATED: just use com.atproto.sync.requestCrawl"
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
@@ -0,0 +1,31 @@
{
"id": "com.atproto.sync.requestCrawl",
"defs": {
"main": {
"type": "procedure",
"input": {
"schema": {
"type": "object",
"required": [
"hostname"
],
"properties": {
"hostname": {
"type": "string",
"description": "Hostname of the current service (eg, PDS) that is requesting to be crawled."
}
}
},
"encoding": "application/json"
},
"errors": [
{
"name": "HostBanned"
}
],
"description": "Request a service to persistently crawl hosted repos. Expected use is new PDS instances declaring their existence to Relays. Does not require auth."
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}
@@ -0,0 +1,276 @@
{
"id": "com.atproto.sync.subscribeRepos",
"defs": {
"info": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"knownValues": [
"OutdatedCursor"
]
},
"message": {
"type": "string"
}
}
},
"main": {
"type": "subscription",
"errors": [
{
"name": "FutureCursor"
},
{
"name": "ConsumerTooSlow",
"description": "If the consumer of the stream can not keep up with events, and a backlog gets too large, the server will drop the connection."
}
],
"message": {
"schema": {
"refs": [
"#commit",
"#sync",
"#identity",
"#account",
"#info"
],
"type": "union"
}
},
"parameters": {
"type": "params",
"properties": {
"cursor": {
"type": "integer",
"description": "The last known event seq number to backfill from."
}
}
},
"description": "Repository event stream, aka Firehose endpoint. Outputs repo commits with diff data, and identity update events, for all repositories on the current server. See the atproto specifications for details around stream sequencing, repo versioning, CAR diff format, and more. Public and does not require auth; implemented by PDS and Relay."
},
"sync": {
"type": "object",
"required": [
"seq",
"did",
"blocks",
"rev",
"time"
],
"properties": {
"did": {
"type": "string",
"format": "did",
"description": "The account this repo event corresponds to. Must match that in the commit object."
},
"rev": {
"type": "string",
"description": "The rev of the commit. This value must match that in the commit object."
},
"seq": {
"type": "integer",
"description": "The stream sequence number of this message."
},
"time": {
"type": "string",
"format": "datetime",
"description": "Timestamp of when this message was originally broadcast."
},
"blocks": {
"type": "bytes",
"maxLength": 10000,
"description": "CAR file containing the commit, as a block. The CAR header must include the commit block CID as the first 'root'."
}
},
"description": "Updates the repo to a new state, without necessarily including that state on the firehose. Used to recover from broken commit streams, data loss incidents, or in situations where upstream host does not know recent state of the repository."
},
"commit": {
"type": "object",
"nullable": [
"since"
],
"required": [
"seq",
"rebase",
"tooBig",
"repo",
"commit",
"rev",
"since",
"blocks",
"ops",
"blobs",
"time"
],
"properties": {
"ops": {
"type": "array",
"items": {
"ref": "#repoOp",
"type": "ref",
"description": "List of repo mutation operations in this commit (eg, records created, updated, or deleted)."
},
"maxLength": 200
},
"rev": {
"type": "string",
"format": "tid",
"description": "The rev of the emitted commit. Note that this information is also in the commit object included in blocks, unless this is a tooBig event."
},
"seq": {
"type": "integer",
"description": "The stream sequence number of this message."
},
"repo": {
"type": "string",
"format": "did",
"description": "The repo this event comes from. Note that all other message types name this field 'did'."
},
"time": {
"type": "string",
"format": "datetime",
"description": "Timestamp of when this message was originally broadcast."
},
"blobs": {
"type": "array",
"items": {
"type": "cid-link",
"description": "DEPRECATED -- will soon always be empty. List of new blobs (by CID) referenced by records in this commit."
}
},
"since": {
"type": "string",
"format": "tid",
"description": "The rev of the last emitted commit from this repo (if any)."
},
"blocks": {
"type": "bytes",
"maxLength": 2000000,
"description": "CAR file containing relevant blocks, as a diff since the previous repo state. The commit must be included as a block, and the commit block CID must be the first entry in the CAR header 'roots' list."
},
"commit": {
"type": "cid-link",
"description": "Repo commit object CID."
},
"rebase": {
"type": "boolean",
"description": "DEPRECATED -- unused"
},
"tooBig": {
"type": "boolean",
"description": "DEPRECATED -- replaced by #sync event and data limits. Indicates that this commit contained too many ops, or data size was too large. Consumers will need to make a separate request to get missing data."
},
"prevData": {
"type": "cid-link",
"description": "The root CID of the MST tree for the previous commit from this repo (indicated by the 'since' revision field in this message). Corresponds to the 'data' field in the repo commit object. NOTE: this field is effectively required for the 'inductive' version of firehose."
}
},
"description": "Represents an update of repository state. Note that empty commits are allowed, which include no repo data changes, but an update to rev and signature."
},
"repoOp": {
"type": "object",
"nullable": [
"cid"
],
"required": [
"action",
"path",
"cid"
],
"properties": {
"cid": {
"type": "cid-link",
"description": "For creates and updates, the new record CID. For deletions, null."
},
"path": {
"type": "string"
},
"prev": {
"type": "cid-link",
"description": "For updates and deletes, the previous record CID (required for inductive firehose). For creations, field should not be defined."
},
"action": {
"type": "string",
"knownValues": [
"create",
"update",
"delete"
]
}
},
"description": "A repo operation, ie a mutation of a single record."
},
"account": {
"type": "object",
"required": [
"seq",
"did",
"time",
"active"
],
"properties": {
"did": {
"type": "string",
"format": "did"
},
"seq": {
"type": "integer"
},
"time": {
"type": "string",
"format": "datetime"
},
"active": {
"type": "boolean",
"description": "Indicates that the account has a repository which can be fetched from the host that emitted this event."
},
"status": {
"type": "string",
"description": "If active=false, this optional field indicates a reason for why the account is not active.",
"knownValues": [
"takendown",
"suspended",
"deleted",
"deactivated",
"desynchronized",
"throttled"
]
}
},
"description": "Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active."
},
"identity": {
"type": "object",
"required": [
"seq",
"did",
"time"
],
"properties": {
"did": {
"type": "string",
"format": "did"
},
"seq": {
"type": "integer"
},
"time": {
"type": "string",
"format": "datetime"
},
"handle": {
"type": "string",
"format": "handle",
"description": "The current handle for the account, or 'handle.invalid' if validation fails. This field is optional, might have been validated or passed-through from an upstream source. Semantics and behaviors for PDS vs Relay may evolve in the future; see atproto specs for more details."
}
},
"description": "Represents a change to an account's identity. Could be an updated handle, signing key, or pds hosting endpoint. Serves as a prod to all downstream services to refresh their identity cache."
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}