chadtmiller.com/group-host
atmosphere group host
0
0
The docs read in one plain voice
.claude/skills/docs/SKILL.md+7−0
| @@ -27,6 +27,10 @@ also a site (`docs-site/`); a new page goes in its sidebar. | ||
The docs describe this host as it is. They never compare it with another | ||
implementation or say where an idea came from. | ||
| ||
Every page is written in one voice, set out in voice.md beside this | ||
file: plain sentences, contractions, the reader as "you", and a list of | ||
patterns to search for and remove. Read it before writing anything here. | ||
| ||
## Which job | ||
| ||
- A small change to what a page says (a new method, a changed limit): | ||
| @@ -36,6 +40,9 @@ implementation or say where an idea came from. | ||
- A page to write or rewrite: all four steps. | ||
- An audit (are these pages still true?): steps 1 and 4 for each page, | ||
then fix what is wrong, or file an issue when the code is what's wrong. | ||
- A voice pass (does this page read well?): voice.md's mechanical pass | ||
over the page as it stands, changing wording only, then `just docs`. | ||
Its "What a voice pass must not change" is the check. | ||
| ||
## 1. Facts | ||
| ||
.claude/skills/docs/voice.mdnew+182−0
| @@ -0,0 +1,182 @@ | ||
# The docs' voice | ||
| ||
How a page reads, sentence by sentence. Every page in `docs/` and | ||
`README.md` is written in it, the guides included, and a voice pass | ||
checks a page against it. | ||
| ||
## Who it's for | ||
| ||
Write for someone running a group host, building an app that talks to | ||
one, or changing this one: what the host does, what it costs them, what | ||
to watch for and what to do. The reader is an engineer. Explain the | ||
system the way you'd explain it to a coworker at a whiteboard. | ||
| ||
## What the voice is | ||
| ||
- Plain declarative sentences, one idea each. Most run 12 to 25 words. | ||
No semicolons and no em dashes in prose. | ||
- Conversational connectives. Sentences link up with "So", "Since", | ||
"That means", "In this case", "But", never with punctuation. | ||
- Contractions everywhere: it's, don't, can't, isn't, there's, that's, | ||
won't. | ||
- Person. The reader is "you" ("If you run a host behind a proxy…"). | ||
The system is the subject of mechanism sentences ("The host signs…", | ||
"The console asks…", "A steward's key ranks…"). "We" is fine when | ||
walking through a mechanism step by step. No "I". | ||
- Plain word order. Subject, verb, object. "With only its key on the | ||
document, the host is the only one that can move the group", never | ||
"Left so, only the host could move a group". | ||
- Concrete before abstract. Name the situation first (an admin removes a | ||
steward's key), then the rule. Define a term in one plain sentence | ||
("A steward is someone the group trusts with its identity") and then | ||
give an example. | ||
- Numbers do the arguing. Give the default, the limit and the unit | ||
("the host retries a notice for a day"), and the variable or flag that | ||
sets it. | ||
- Trade-offs said plainly. State the cost, then why it's acceptable. | ||
One qualifier at most. | ||
- Paragraphs of one to four sentences. | ||
- Parentheses for asides: a default, a variable, an example. One fact | ||
per parenthesis. | ||
- "May" states a permission ("a member with `group.configure` may add | ||
keys"). "Can" states an ability. Neither is a hedge, so keep whichever | ||
is true. | ||
- Words the voice uses: so, since, that's, around, plenty, cheap, a bit, | ||
pretty, just (sparingly), keep up with, hold up. | ||
| ||
## Banned patterns | ||
| ||
Search for each of these on every page you touch. | ||
| ||
| Pattern | Looks like | Do instead | | ||
|---|---|---| | ||
| Semicolon splice | "A key is `AlreadyAdded`; a fifth is `TooManyKeys`." | Two sentences, or join with "and", "but" or "so". | | ||
| Em dash or `--` aside | "the group — and only the group — signs" | Parentheses, a comma, or a second sentence. | | ||
| "X, not Y" flourish | "Roles decide who may add keys, not who holds them." | Say X. Say Y in its own sentence only if a reader would assume it. | | ||
| Colon chains | "The rule is simple: one owner: always." | One colon per sentence at most, and only to introduce a list, code or an example. | | ||
| Rule-of-three lists | "fast, cheap and simple" | Keep the items that carry information. Two is fine. One is often better. | | ||
| Abstract nouns for actions | "the handling of", "the revocation of" | The verb: "handles", "revokes". | | ||
| Archaic or inverted phrasing | "Left so", "is apart from", "whatever the key asked about", "as it is now" used for weight | Plain word order and everyday words. | | ||
| Filler | crucially, importantly, in practice, it's worth noting, notably, essentially, effectively, robust, seamless, under the hood, the heart of, first-class, by design, the key insight, the trick is, the catch is, load-bearing | Delete it. If the sentence falls apart, rewrite it. | | ||
| Bold lead-in on bullets | "- **Stewards.** A steward…" | Plain bullets. A list of named things may start each item with the name in `code` and a period. | | ||
| Bold or italics for stress | "the host **never** sees it" | Put what matters first, or last, in the sentence. | | ||
| One-line paragraph for drama | "The host can't undo it." alone | Fold it into the paragraph it concludes. | | ||
| Aphorism endings | "Less to keep, less to lose." | State the consequence plainly, or cut it. | | ||
| Narrating the page | "This page covers…", "In short:", "Below we'll look at…" | Delete. Start with the content. A one-line pointer to another page is fine. | | ||
| Stacked qualifiers | "usually only briefly", "about ~" | One qualifier, or none. | | ||
| Fragments as style | "Nothing else." "By design." | Full sentences. | | ||
| Lead-ins that announce importance | "This matters because…" | Cut the lead-in, keep the reason. | | ||
| History and comparison | "no longer", "used to", "now does", another implementation | Describe the host as it is today. | | ||
| Exclamation marks | | None. | | ||
| ||
## Mechanical pass | ||
| ||
Apply these in order to every paragraph, list item and table cell you | ||
edit. | ||
| ||
1. Replace every semicolon in prose with a period, or with "and", "but" | ||
or "so". A table cell may separate short items with `·`. | ||
2. Replace every em dash or double hyphen used as punctuation. | ||
3. Count colons. More than one in a sentence: split it. A colon that | ||
isn't introducing a list, code or an example: make it a period, or | ||
"because" or "so". | ||
4. Find ", not " and "rather than". Keep one only when it corrects a | ||
real misconception a reader would have. | ||
5. Delete every filler word. Re-read the sentence. | ||
6. Remove bold and italics used for stress. In a guide, bold stays on | ||
words the console shows (below). | ||
7. Use contractions: it is → it's, does not → doesn't, cannot → can't. | ||
8. Split any sentence over about 35 words, or with more than two clauses | ||
joined by commas. | ||
9. Make the actor the subject: "is refused by the host" → "the host | ||
refuses". | ||
10. Untangle inverted and archaic phrasing into subject, verb, object. | ||
11. Delete sentences that describe the page instead of the host. | ||
12. Read the paragraph aloud. If you wouldn't say it to a coworker, | ||
rewrite it. | ||
| ||
A page usually comes out about the same length. If it grows by more than | ||
about 10%, something got explained twice. | ||
| ||
## Before and after | ||
| ||
> Before: Left so, only the host could move a group, and nobody could | ||
> move it without the host. | ||
> | ||
> After: With only that key on the document, the host is the only one | ||
> that can move a group, and nobody can move it without the host. | ||
| ||
> Before: Holding a key is apart from holding a role. The group's roles | ||
> decide who may add or remove keys on the host, not who holds which key. | ||
> | ||
> After: Holding a key has nothing to do with holding a role. The group's | ||
> roles decide who may add or remove keys on the host. They don't decide | ||
> who holds which key. | ||
| ||
> Before: A key already on the document is `AlreadyAdded`; a fifth | ||
> recovery key is `TooManyKeys`. | ||
> | ||
> After: Adding a key that's already on the document fails with | ||
> `AlreadyAdded`, and adding a fifth recovery key fails with | ||
> `TooManyKeys`. | ||
| ||
> Before: When a group's identity has left the host's control, the host | ||
> stops changing it. | ||
> | ||
> After: Once a group's identity is out of the host's control, the host | ||
> stops changing it. | ||
| ||
## What a voice pass must not change | ||
| ||
A voice pass changes wording only. Check each of these before | ||
committing: | ||
| ||
- Facts. Every number, unit, default, limit, variable, flag, method, | ||
permission, error name, record field and path stays exactly as it is. | ||
If a sentence goes, its fact moves to another sentence or was already | ||
on the page. | ||
- Nothing new. Don't add a claim, number or feature that isn't on the | ||
page or in the code. If something reads wrong, flag it rather than | ||
fixing it in prose (or check the code and say so). | ||
- Headings. `just docs` checks every link and anchor, and other pages | ||
link to headings. Leave headings as they are. If one has to change, | ||
update every link to it in the same commit. | ||
- Links. Every link stays and points to the same target. | ||
- Code. Fenced blocks and inline code are untouched. A method is named | ||
in code and the docs site links it, so it stays as written. | ||
- Guides. A word in bold is a word on screen, and `just docs` checks it | ||
against the pictures: keep it, spelled as the console spells it. Never | ||
touch a `<!-- look … -->` line or the image under it. | ||
- Design pages keep their "Details:" lists at the end of a section. | ||
- Tables keep their columns. A reference page's cells get the same pass | ||
as prose, kept short. | ||
| ||
Keep the wrapping the page has (about 72 columns), and run `just docs` | ||
after every page. | ||
| ||
## One home for each fact | ||
| ||
Each fact has one home page. Other pages state it in a clause and link | ||
there. Design pages say why, the reference lists what, a guide shows | ||
how, so the details go to the reference and a design page links them. | ||
| ||
## The README | ||
| ||
`README.md` is the front door, in the voice and in this shape: | ||
| ||
1. What the host is, in a paragraph or two: what it does for a group, | ||
and what it's made of. | ||
2. `## Highlights`: one bullet a part, five to seven. Each starts with a | ||
bold label (the one place a bold lead-in belongs), says what the part | ||
does in two or three sentences, and ends `→ [page](…)` with the | ||
design or reference page that owns it. | ||
3. `## Quickstart`: what you need, then commands runnable as written, | ||
from an empty checkout to something to look at, then how to deploy. | ||
4. `## Docs`: a two-column table of the pages, each with what's in it. | ||
5. `## The pieces`: the crates and directories in a sentence, linking | ||
the table in `docs/design/README.md`, which is their one home. | ||
6. `## Development`: the recipes for testing and checking, commented. | ||
7. `## License`. | ||
| ||
Its facts come from the pages it links, and a change to one of those | ||
parts updates its bullet. | ||
.claude/skills/docs/writer.md+3−11
| @@ -32,19 +32,11 @@ implementation, or say where an idea came from. | ||
exists by the time they meet it. Put the lowest-level details in a | ||
short plain list headed "Details" at the end of their section. | ||
- Define before use. | ||
- Plain technical prose: present tense, active voice, one idea per | ||
sentence, exact names in backticks, short paragraphs. A list only for | ||
truly parallel items, a table only for tabular data. | ||
- A list only for truly parallel items, a table only for tabular data. | ||
- Don't number the problems and refer back to them; let the structure | ||
make the connection. | ||
- Avoid the marks of machine writing: | ||
- inflated significance ("plays a crucial role", "serves as") | ||
- "not just X but Y", and reflexive groups of three | ||
- trailing "-ing" commentary | ||
- bold-headed bullet lists (`- **Thing.** text`) | ||
- bold for emphasis, em dashes, title case in headings | ||
- slogans, and summary sentences that repeat the paragraph above | ||
- the words delve, robust, seamless, leverage, comprehensive, powerful | ||
- The voice is `.claude/skills/docs/voice.md`: read it before writing, | ||
and run its mechanical pass over the page when done. | ||
- No diagrams. | ||
- Links: only the paths the context file lists. | ||
- Length: about [n] lines. Command syntax and flags belong in | ||
.claude/skills/guides/writer.md+5−6
| @@ -47,12 +47,11 @@ what the walk's Odd section lists. | ||
walk's `[cli]` facts, linked to `../reference/cli.md`; then what to do | ||
next, as links to other guides. | ||
- Second person, present tense, the console's own words for everything | ||
on it. Short sentences. Explain a word the reader may not know in a | ||
clause, the first time. | ||
- Avoid the marks of machine writing: inflated significance, "not just | ||
X but Y", reflexive groups of three, colon chains, em dashes, bold for | ||
emphasis (bold is only for words on screen), summary sentences, and | ||
the words delve, robust, seamless, simply, leverage, powerful. | ||
on it. Explain a word the reader may not know in a clause, the first | ||
time. | ||
- The voice is `.claude/skills/docs/voice.md`: read it before writing, | ||
and run its mechanical pass over the page when done. Bold is only for | ||
words on screen. | ||
- Links: only the paths the context file lists. | ||
- Length: about [n] lines. | ||
| ||
docs/design/groups.md+202−183
| @@ -1,10 +1,10 @@ | ||
# Groups | ||
| ||
A group is an atproto account that no one person owns. It has no password | ||
and no one to sign in as it, yet someone has to start it, change its | ||
profile and rules, give it a name, and one day end it. On this host each | ||
of those is decided by the roles its members hold. What a group shows | ||
also depends on who asks: a stranger, a member and an admin each see a | ||
and nobody signs in as it. But someone still has to start it, change its | ||
profile and rules, give it a name, and one day end it. On this host the | ||
roles its members hold decide each of those. What a group shows also | ||
depends on who asks, so a stranger, a member and an admin each see a | ||
different amount. The inputs and errors of every method named here are in | ||
[the API reference](../reference/api.md). | ||
| ||
| @@ -13,10 +13,10 @@ different amount. The inputs and errors of every method named here are in | ||
A group needs a place for what it is and a place for who belongs to it, | ||
and some of that only members should read. So each group is an account of | ||
its own, with its own `did:plc` and public repo, and this host as its PDS. | ||
It also gets two spaces. A space is a private record store: each member | ||
It also gets two spaces. A space is a private record store. Each member | ||
writes in their own repo in it, on their own PDS, and the space's | ||
authority decides who may read and write. The group is the authority of | ||
both of its spaces; [spaces](spaces.md) explains them. | ||
both of its spaces, and [spaces](spaces.md) explains them. | ||
| ||
- `meta` (`at://<group>/space/fyi.opensocial.meta/self`) holds the | ||
profile, the rules and the labeler. | ||
| @@ -25,265 +25,284 @@ both of its spaces; [spaces](spaces.md) explains them. | ||
| ||
Everything a group is lives in records the group writes in its own repos | ||
in those spaces, and the host reads them to answer for it. Something is a | ||
group here only if it is an account on this host and its `members` space | ||
exists here. Outside its records the host keeps the account and its keys, | ||
its address, the stewards kept while it is switched off, join requests, | ||
invites and tokens. | ||
group here only if it's an account on this host and its `members` space | ||
exists here. Outside its records, the host keeps the account and its | ||
keys, its address, the stewards it holds on to while the group is | ||
switched off, join requests, invites and tokens. | ||
| ||
`createGroup` starts a group, and its caller becomes the founder and first | ||
admin. A caller signs in with service auth from their own PDS (a | ||
short-lived token for calling this host as them) or, from the console, by | ||
its session cookie; every signed-in method here takes either. | ||
`GROUP_FOUNDERS` names the people the host starts groups for, or anyone | ||
when empty ([configuration](../reference/config.md)). | ||
short-lived token for calling this host as them) or, from the console, | ||
with its session cookie. Every signed-in method here takes either. | ||
`GROUP_FOUNDERS` names the people the host starts groups for. When it's | ||
empty, the host starts them for anyone | ||
([configuration](../reference/config.md)). | ||
| ||
Starting a group writes its profile (display name, description, join | ||
policy), labeler and access record in `meta`. In `members` it writes an | ||
access record readable by `member`, the roles `admin` and `member`, the | ||
permissions record, index entries for `meta` and `members`, and a | ||
membership with both roles for the founder and each steward, the people | ||
named at the start to run the group beside the founder. If anyone may | ||
read `meta`, it writes a declaration in the public repo. If setup fails | ||
partway, the host deletes the account and ends its DID, so the handle is | ||
free again. Joining and roles are in [membership](membership.md). | ||
permissions record, and index entries for `meta` and `members`. It also | ||
writes a membership with both roles for the founder and for each | ||
steward. Stewards are the people named at the start to run the group | ||
beside the founder. If anyone may read `meta`, the host writes a | ||
declaration in the public repo. If setup fails partway, the host deletes | ||
the account and ends its DID, so the handle is free again. Joining and | ||
roles are in [membership](membership.md). | ||
| ||
Details: | ||
| ||
- The join policy is `open`, `approval` or `invite`; `approval` when not | ||
given. | ||
- The join policy is `open`, `approval` or `invite`. It's `approval` | ||
when not given. | ||
- A membership's record key is the member's DID. | ||
- Text is held to its lexicon's length, here and in every method that | ||
writes it, and refused with `InvalidRequest` past it: a group's display | ||
name 64 graphemes, its description 2,000. | ||
writes it. Past that, the host refuses it with `InvalidRequest`. A | ||
group's display name is 64 graphemes at most, and its description | ||
2,000. | ||
| ||
## Its address | ||
| ||
A group needs a name before it has a domain of its own. The host gives it | ||
a handle of one label under `HANDLE_DOMAIN`, the domain of this host's | ||
handles, and keeps that handle as the group's address, where its site is | ||
A group needs a name before it has a domain of its own. So the host gives | ||
it a handle of one label under `HANDLE_DOMAIN`, the domain of this host's | ||
handles. It keeps that handle as the group's address, where its site is | ||
served ([sites](sites.md)). The address never changes. When the group | ||
takes a handle on its own domain, the address stays reserved for it, and | ||
its site stays there, until the group is deleted. | ||
| ||
`checkAddress` says, without signing in, whether an address is free: not | ||
an account's handle here and not kept as a group's address. | ||
`describeServer` names the domain that follows the label. The console's | ||
new-group form builds the label from the name as typed, asks | ||
`checkAddress` once typing stops, and when the address is taken offers the | ||
first free one of `<label>-2` to `<label>-19`. | ||
`checkAddress` says, without signing in, whether an address is free. A | ||
free address isn't an account's handle here and isn't kept as a group's | ||
address. `describeServer` names the domain that follows the label. The | ||
console's new-group form builds the label from the name as you type it, | ||
and asks `checkAddress` once you stop typing. When the address is taken, | ||
it offers the first free one of `<label>-2` to `<label>-19`. | ||
| ||
## Roles decide what each person may do | ||
| ||
With no owner to ask, "may this person do that?" is answered from the | ||
group's records. | ||
There's no owner to ask, so the group's records answer "may this person | ||
do that?" | ||
| ||
A member's roles are the `roles` list of their membership in `members`. A | ||
space's access record grants each role OAuth scopes in that space | ||
(`grants`, one entry a role), and may make it `public`, which means | ||
anyone signed in. A role granted `read` there reads it, and its members | ||
write there in their own name, unless `writableBy` names who may. A role | ||
granted a space scope naming collections writes those as the group | ||
there. An access record can also name `people`, the chosen people a | ||
space is for, by DID; the roles granted `read` there read it too. | ||
(`grants`, one entry a role). It may also make the space `public`, which | ||
means anyone signed in. A role granted `read` in a space reads it. Its | ||
members write there in their own name, unless `writableBy` names who | ||
may. A role granted a space scope naming collections writes those as the | ||
group there. An access record can also name `people` by DID. They're the | ||
chosen people a space is for, and the roles granted `read` there read it | ||
too. | ||
| ||
The permissions record in `members` grants each role OAuth scopes and the | ||
roles it may assign. Each of the host's eleven actions, such as `invite`, | ||
`eject`, `space.create` or `group.configure`, is answered by one scope. | ||
Roles compose by union: a person may do whatever any of their roles | ||
grants, with no deny, precedence or hierarchy. The same scopes bound an | ||
app or MCP client a member signs in ([signing in](signing-in.md)). | ||
| ||
As made, `admin` holds every action, may write any public-repo collection | ||
as the group, and may assign `admin` and `member`. `member` holds | ||
nothing. A group changes this by writing its permissions record as the | ||
group ([membership](membership.md#writing-roles-grants-and-memberships)). | ||
roles it may assign. One scope answers each of the host's eleven | ||
actions, such as `invite`, `eject`, `space.create` or `group.configure`. | ||
Roles compose by union. A person may do anything any of their roles | ||
grants, and there's no deny, precedence or hierarchy. The same scopes | ||
bound an app or MCP client a member signs in | ||
([signing in](signing-in.md)). | ||
| ||
When a group is made, `admin` holds every action, may write any | ||
public-repo collection as the group, and may assign `admin` and | ||
`member`. `member` holds nothing. A group changes this by writing its | ||
permissions record as the group | ||
([membership](membership.md#writing-roles-grants-and-memberships)). | ||
| ||
The host, as authority, decides every read and write in a group's spaces. | ||
The group itself always may. Anyone else may if their roles fit the | ||
space's access record, or if they hold an explicit grant. Nobody reads or | ||
writes in the spaces of a group that is switched off. | ||
writes in the spaces of a group that's switched off. | ||
| ||
Details: | ||
| ||
- As made, `meta` is public unless `createGroup` names its readers, and | ||
its access record grants `admin` | ||
- When a group is made, `meta` is public unless `createGroup` names its | ||
readers. Its access record grants `admin` | ||
`space:fyi.opensocial.meta?collection=fyi.opensocial.profile&collection=fyi.opensocial.rule`, | ||
so admins write the profile and rules as the group. `members` grants | ||
`member` `space:fyi.opensocial.members?action=read`. | ||
- A grant's scopes are read as a token's are: one naming another type, | ||
key or authority grants nothing in the space; one naming no collection | ||
writes nothing as the group. | ||
- A missing action is refused with `403 Forbidden`, "missing <action>". | ||
- The host reads a grant's scopes the way it reads a token's. A scope | ||
naming another type, key or authority grants nothing in the space. One | ||
naming no collection writes nothing as the group. | ||
- The host refuses a missing action with `403 Forbidden`, "missing | ||
<action>". | ||
| ||
## What each person sees, and finding a group | ||
| ||
Someone not signed in learns of a group only what anyone can already | ||
learn of it from its DID document: its DID and handle. `getGroup` tells | ||
them that and nothing more, whatever the group's access records say, | ||
since `public` means anyone signed in. | ||
| ||
`getGroup` gives more to those allowed more. Everyone signed in gets the | ||
group's DID, handle, address, and the URIs of its two spaces. Whoever may | ||
read `meta` also gets the profile and the rules, in order. A signed-in | ||
caller gets `viewer`: whether they are a member, their roles and | ||
actions, and for a member whether their own repo in `members` holds | ||
anything yet. Whoever may read `members` gets how many members it has | ||
(`listMembers` names them, a page at a time), the roles and what each | ||
may do, and the spaces, with a space's access shown only to | ||
those who may read it. A holder of `admit` also gets the join requests. A | ||
switched-off group shows only the first part and `deactivated: true`, | ||
and to one signed in, `viewer.steward`: whether they may switch it back | ||
on, as nothing else of their standing is read. | ||
| ||
A group that wants to be found says so with its declaration, a | ||
If you aren't signed in, you learn only what anyone can already learn | ||
from the group's DID document, which is its DID and handle. `getGroup` | ||
tells you that and nothing more, whatever the group's access records | ||
say, since `public` means anyone signed in. | ||
| ||
`getGroup` gives more to callers allowed more. Everyone signed in gets | ||
the group's DID, handle, address, and the URIs of its two spaces. A | ||
caller who may read `meta` also gets the profile and the rules, in order. | ||
A signed-in caller gets `viewer`. It says whether they're a member, their | ||
roles and actions, and for a member whether their own repo in `members` | ||
holds anything yet. A caller who may read `members` gets how many | ||
members it has (`listMembers` names them, a page at a time), the roles | ||
and what each may do, and the spaces. A space's access shows only to | ||
callers who may read it. A holder of `admit` also gets the join requests. | ||
A switched-off group shows only the first part and `deactivated: true`. | ||
To a signed-in caller it also shows `viewer.steward`, which says whether | ||
they may switch it back on, since the host reads nothing else of their | ||
standing. | ||
| ||
A group that wants to be found says so with its declaration. That's a | ||
`fyi.opensocial.declaration` record in its public repo pointing at | ||
`meta`. The host writes it when `public` is among `meta`'s readers and | ||
removes it when not. The host keeps no list of its groups for people to | ||
browse: how groups are found across the network is still to be decided, | ||
and the declaration is what such a list would read. | ||
removes it when it isn't. The host keeps no list of its groups for | ||
people to browse. How groups are found across the network is still to | ||
be decided, and the declaration is what such a list would read. | ||
| ||
`getActorGroups` lists the switched-on groups a person is in that the | ||
caller is in too, with each group's member count, and its display name and | ||
avatar when the caller may read `meta`. `getActor` describes a member of | ||
a group here, or someone asking to join one, to a signed-in caller. | ||
caller is in too. It gives each group's member count, and its display | ||
name and avatar when the caller may read `meta`. `getActor` describes a | ||
member of a group here, or someone asking to join one, to a signed-in | ||
caller. | ||
| ||
## Changing its profile, rules and pictures | ||
| ||
A group's profile (`fyi.opensocial.profile`, at `self`) and its rules | ||
(`fyi.opensocial.rule`) are records in `meta`, and an app changes them | ||
by writing them as the group: `com.atproto.space.putRecord`, | ||
`createRecord`, `deleteRecord` and `applyWrites`, with a token for the | ||
group ([signing in](signing-in.md)). The token's scope must cover the | ||
write, and the member who approved it must hold `group.configure` when | ||
it is made. Nothing is written as a switched-off group. | ||
| ||
A put replaces the record whole: what it leaves out goes. Beyond what | ||
the lexicon checks, the host keeps a profile only with a display name | ||
that is more than spaces, a join policy of `open`, `approval` or | ||
`invite`, a location of one of `community.lexicon.location`'s kinds, a | ||
site, and links, on `http` or `https`, and topics and languages each listed once and | ||
none blank. The profile stays at `self` and is never deleted. | ||
(`fyi.opensocial.rule`) are records in `meta`. An app changes them by | ||
writing them as the group, with a token for the group | ||
([signing in](signing-in.md)). It uses `com.atproto.space.putRecord`, | ||
`createRecord`, `deleteRecord` and `applyWrites`. The token's scope must | ||
cover the write, and the member who approved it must hold | ||
`group.configure` when it's made. Nothing is written as a switched-off | ||
group. | ||
| ||
A put replaces the record whole, so anything it leaves out goes. Beyond | ||
what the lexicon checks, the host keeps a profile only if it has a | ||
display name that's more than spaces and a join policy of `open`, | ||
`approval` or `invite`. A location must be one of | ||
`community.lexicon.location`'s kinds. A site and links must be on `http` | ||
or `https`. Topics and languages must each be listed once, and none may | ||
be blank. The profile stays at `self` and is never deleted. | ||
| ||
A picture must be a blob in the group's own repo, because a blob in | ||
another account's repo would not resolve for the group's profile. So the | ||
another account's repo wouldn't resolve for the group's profile. So the | ||
app uploads it as the group (`com.atproto.repo.uploadBlob`, which a | ||
token for `meta` may do for images) and names the blob it gets back in | ||
the profile. A link's `icon`, its site's favicon, is kept the same way: | ||
a PNG of at most 100,000 bytes, so that someone looking at the group asks | ||
the host for it and never the site. The console, the `opensocial` | ||
command and the host's MCP tools each ask the favicon service `FAVICONS` | ||
names for it when they write a new link, and upload it as the group; a | ||
link whose site has none, or answers too slowly, is kept without one, | ||
and a link written again keeps the icon it had. An upload no record takes within a day is swept away, and a | ||
blob goes when its last reference does. | ||
| ||
The host serves images at `/img/{did}/{cid}` to whoever may see a record | ||
holding them: anyone, for the public repo; otherwise whoever may read the | ||
space, signed in to the console, which for `meta` while the group is | ||
declared is anyone signed in. | ||
A switched-off group's images are not served. | ||
| ||
A rule is kept at a TID, so that a label citing it keeps its URI however | ||
the rule changes; a new rule written with no key is given one by the | ||
host's clock. Rules are shown by their `order`, lowest first, then those | ||
with none, as they were written. A label citing a deleted rule keeps its | ||
URI, which no longer resolves ([moderation](moderation.md)). | ||
| ||
The declaration follows who may read `meta`: written as the group in its | ||
public repo, it is kept only at `self`, naming the group's own `meta`, | ||
and only while anyone may read it. Deleting it is always allowed. | ||
the profile. A link's `icon` is its site's favicon, and it's kept the | ||
same way. It's a PNG of at most 100,000 bytes, so someone looking at the | ||
group asks the host for it and never the site. The console, the | ||
`opensocial` command and the host's MCP tools each ask the favicon | ||
service `FAVICONS` names for it when they write a new link, and upload | ||
it as the group. A link whose site has none, or answers too slowly, is | ||
kept without one. A link written again keeps the icon it had. An upload | ||
no record takes within a day is swept away, and a blob goes when its | ||
last reference does. | ||
| ||
The host serves images at `/img/{did}/{cid}` to anyone who may see a | ||
record holding them. For the public repo that's anyone. Otherwise it's | ||
anyone signed in to the console who may read the space. For `meta` while | ||
the group is declared, that's anyone signed in. A switched-off group's | ||
images aren't served. | ||
| ||
A rule is kept at a TID, so a label citing it keeps its URI however the | ||
rule changes. When a new rule is written with no key, the host's clock | ||
gives it one. Rules are shown by their `order`, lowest first, then the | ||
ones with none, in the order they were written. A label citing a deleted | ||
rule keeps its URI, which doesn't resolve | ||
([moderation](moderation.md)). | ||
| ||
The declaration follows who may read `meta`. When it's written as the | ||
group in its public repo, the host keeps it only at `self`, naming the | ||
group's own `meta`, and only while anyone may read it. Deleting it is | ||
always allowed. | ||
| ||
Details: | ||
| ||
- A picture is a PNG, JPEG or WebP of at most 2,000,000 bytes, and its | ||
record names it with the type and size the host kept at upload; one | ||
that says otherwise, or a blob that is not the group's, is refused. | ||
- A rule's title is 64 characters at most and must be more than spaces; | ||
its text, which it must have, is 2,000 at most. | ||
- A picture is a PNG, JPEG or WebP of at most 2,000,000 bytes. Its | ||
record names it with the type and size the host kept at upload. The | ||
host refuses a record that says otherwise, or a blob that isn't the | ||
group's. | ||
- A rule's title is 64 characters at most and must be more than spaces. | ||
Its text is required and is 2,000 characters at most. | ||
- The console's settings write the profile, pictures and rules this way, | ||
with a token `getGroupAuth` gives for `meta`, and set visibility by | ||
making `meta` public or not through `updateSpace`, members granted | ||
`read` there either way. | ||
with a token `getGroupAuth` gives for `meta`. They set visibility by | ||
making `meta` public or not through `updateSpace`, and members are | ||
granted `read` there either way. | ||
- An MCP client changes them with the `profile_set`, `rule_set` and | ||
`rule_delete` tools, and a person with the `opensocial` commands of | ||
the same names, the same writes made as its member | ||
`rule_delete` tools, and you can with the `opensocial` commands of the | ||
same names. Both make the same writes as their member | ||
([MCP](../reference/mcp.md)). | ||
| ||
## More spaces | ||
| ||
A group may want more places, such as one only its admins read. Each | ||
further space has an access record and, unless it is left out, an index | ||
further space has an access record and, unless it's left out, an index | ||
entry in `members` that apps read to find it. `createSpace` (for | ||
`space.create`) makes one from a `type`, its `access` (its grants, | ||
whether it is public, and who writes there in their own name), and | ||
optionally its key, a name for its entry, and `index: false` to leave it | ||
out of the index. It answers the space and strong references to the | ||
access record and the index entry it wrote. A space is made whole or not | ||
at all: if its access record or its index entry cannot be written, the | ||
host ends it again, and its key is free to use. `updateSpace` (for | ||
`space.configure`) replaces the access record whole and renames the | ||
entry, and changes nothing when it cannot change them all. Both refuse a | ||
grant of a role the group has not (`UnknownRole`), one that is no space | ||
scope (`InvalidScope`), two grants of one role, an access record that | ||
lets nobody but the group read, and a name over 64 characters. | ||
`deleteSpace` (for `space.delete`) removes the index entry if there is | ||
one, tells the space's syncers, and deletes the space and the group's | ||
repo in it. What members wrote there stays theirs at their PDSes. | ||
| ||
Two spaces carry the group itself, so their rules are fixed: `meta` and | ||
`members` cannot be made again or deleted (`ReservedSpace`), `members` | ||
must stay granting `member` `read`, and | ||
who joins it by writing there cannot change. A space for chosen people is | ||
theirs, and the group can neither change nor delete it. | ||
`space.create`) makes one from a `type` and its `access` (its grants, | ||
whether it's public, and who writes there in their own name). It | ||
optionally takes its key, a name for its entry, and `index: false` to | ||
leave it out of the index. It answers the space and strong references to | ||
the access record and the index entry it wrote. | ||
| ||
A space is made whole or not at all. If its access record or its index | ||
entry can't be written, the host ends it again, and its key is free to | ||
use. `updateSpace` (for `space.configure`) replaces the access record | ||
whole and renames the entry. When it can't change them all, it changes | ||
nothing. Both refuse a grant of a role the group doesn't have | ||
(`UnknownRole`), a grant that's no space scope (`InvalidScope`), and two | ||
grants of one role. They also refuse an access record that lets nobody | ||
but the group read, and a name over 64 characters. `deleteSpace` (for | ||
`space.delete`) removes the index entry if there is one, tells the | ||
space's syncers, and deletes the space and the group's repo in it. What | ||
members wrote there stays theirs at their PDSes. | ||
| ||
Two spaces carry the group itself, so their rules are fixed. `meta` and | ||
`members` can't be made again or deleted (`ReservedSpace`). `members` | ||
must keep granting `member` `read`, and who joins it by writing there | ||
can't change. A space for chosen people is theirs, and the group can't | ||
change or delete it. | ||
| ||
## A handle on its own domain | ||
| ||
A group may take a handle on a domain it controls. The domain must name | ||
the group the way any handle names an account: by | ||
`/.well-known/atproto-did`, or through the services in `HANDLE_RESOLVERS`. | ||
the group the way any handle names an account, by | ||
`/.well-known/atproto-did` or through the services in `HANDLE_RESOLVERS`. | ||
Under `HANDLE_DOMAIN` a group may take only its own address. | ||
| ||
`checkGroupHandle` says whether a handle names the group yet, changing | ||
nothing. `updateGroupHandle` checks the same, holds the handle in the | ||
host's own record, updates the group's DID document with the host's | ||
rotation key, and tells relays. If the directory refuses the update, the | ||
host puts the group's previous handle back. It fails when the domain does not name the group, or when | ||
the host's key no longer controls the DID. Both are for `group.configure`. | ||
The group's site stays at its address whatever its handle ([sites](sites.md)). | ||
| ||
In the console, the profile page of a group's settings shows its handle, | ||
and, while it is a domain of its own, whether the domain still names it. | ||
"Use your own domain" takes the domain, showing the `_atproto` TXT record | ||
to add there, `did=` and the group's DID; "Go back" gives it its address | ||
back, asked to be sure of. The command is `group | ||
handle`; an MCP client's tool is `group_handle`. | ||
`checkGroupHandle` says whether a handle names the group yet, and changes | ||
nothing. `updateGroupHandle` checks the same and holds the handle in the | ||
host's own record. Then it updates the group's DID document with the | ||
host's rotation key and tells relays. If the directory refuses the | ||
update, the host puts the group's previous handle back. It fails when | ||
the domain doesn't name the group, or when the host's key no longer | ||
controls the DID. Both are for `group.configure`. The group's site stays | ||
at its address whatever its handle is ([sites](sites.md)). | ||
| ||
In the console, the profile page of a group's settings shows its handle. | ||
While that's a domain of its own, it also shows whether the domain still | ||
names the group. "Use your own domain" takes the domain and shows the | ||
`_atproto` TXT record to add there, `did=` and the group's DID. "Go back" | ||
gives the group its address back, after asking you to confirm. The | ||
command is `group handle`, and an MCP client's tool is `group_handle`. | ||
| ||
## Switching off, on and deleting | ||
| ||
`deactivateGroup` (for `group.configure`) switches a group off and tells | ||
relays. While it is off, its repos refuse reads, its spaces grant nothing | ||
to anyone, the group included, and its images are not served. | ||
relays. While it's off, its repos refuse reads, its spaces grant nothing | ||
to anyone (the group included), and its images aren't served. | ||
| ||
A switched-off group's roles cannot decide who may switch it back on, so | ||
the host keeps who held `group.configure` when it was switched off. | ||
A switched-off group's roles can't decide who may switch it back on. So | ||
the host keeps who held `group.configure` when it was switched off, and | ||
`activateGroup` is for one of those stewards. | ||
| ||
In the console, the profile page of a group's settings switches it off | ||
or deletes it, each asked to be sure of. Switched off, the group's page | ||
says so, and to its stewards offers to switch it back on or delete it. | ||
or deletes it, and asks you to confirm each. When the group is off, its | ||
page says so and offers its stewards to switch it back on or delete it. | ||
The commands are `group deactivate` (`--undo` switches it back on) and | ||
`group delete`; an MCP client can switch the group off, never delete it. | ||
`group delete`. An MCP client can switch the group off, but it can never | ||
delete it. | ||
| ||
`deleteGroup` is for a holder of `group.configure`, or for a kept steward | ||
while the group is off. It tells the syncers of each space, ends the | ||
DID, then deletes the account, repos, spaces, address, invites, join requests, tokens, | ||
moderation state and blobs together, and tells relays. What members wrote | ||
in its spaces stays theirs, at their PDSes. | ||
while the group is off. It tells the syncers of each space and ends the | ||
DID. Then it deletes the account, repos, spaces, address, invites, join | ||
requests, tokens, moderation state and blobs together, and tells relays. | ||
What members wrote in its spaces stays theirs, at their PDSes. | ||
| ||
The host ends the DID with a tombstone only when its own key is the only | ||
rotation key on it. If a steward holds a recovery key there, the host | ||
leaves the DID for its holder to bring the group back elsewhere, and | ||
`deleteGroup` answers `tombstoned: false` ([recovery](recovery.md), | ||
[moving](moving.md)). If the directory cannot be reached or refuses the | ||
tombstone, `deleteGroup` fails and the group stays as it was, to be | ||
deleted again. | ||
[moving](moving.md)). If the directory can't be reached or refuses the | ||
tombstone, `deleteGroup` fails and the group stays as it was, so you can | ||
delete it again. | ||
docs/design/mcp.md+87−85
| @@ -1,30 +1,30 @@ | ||
# MCP | ||
| ||
A member may want an AI app to do group work for them: admit people, | ||
write rules, look through the moderation queue. The app should act with | ||
exactly that member's power in one group, and no more. It should stop | ||
when the member disconnects it or leaves the group. | ||
A member may want an AI app to do group work for them, like admitting | ||
people, writing rules or looking through the moderation queue. The app | ||
should act with exactly that member's power in one group, and no more. | ||
It should stop when the member disconnects it or leaves the group. | ||
| ||
The host is an MCP server for that, MCP being the protocol an AI app | ||
uses to call tools on a server, and the OAuth server its client signs in | ||
at. The member connects the client to one group, and from then on it | ||
acts in that group as that member. The console calls such a client an | ||
AI app; this page calls it an MCP client. | ||
MCP is the protocol an AI app uses to call tools on a server. The host | ||
is an MCP server for this work, and it's also the OAuth server the | ||
client signs in at. The member connects the client to one group, and | ||
from then on it acts in that group as that member. The console calls | ||
such a client an AI app, and this page calls it an MCP client. | ||
| ||
## What an MCP client may do | ||
| ||
An MCP client asks for no permissions of its own. If it held its own | ||
grant, that grant could drift from what the member may do. Instead, what | ||
it may do is decided at each call by the member's roles in the group as | ||
they are at that moment (see [membership](membership.md)). A role given | ||
to the member widens what the client can do; a role taken away narrows | ||
it, on the next call. | ||
| ||
A client is connected to exactly one group, chosen by the member when | ||
they approve it. No tool asks which group. The host tells the client, | ||
when it connects, that its tools act as the person who connected it, in | ||
the group they chose, and that anything their roles do not allow is | ||
refused. | ||
grant, that grant could drift from what the member may do. Instead, the | ||
host decides what it may do at each call, from the member's roles in the | ||
group at that moment (see [membership](membership.md)). If the member | ||
gets a role, the client can do more on its next call. If a role is taken | ||
away, the client can do less. | ||
| ||
A client is connected to exactly one group, which the member chooses | ||
when they approve it. No tool asks which group. When the client | ||
connects, the host tells it that its tools act as the person who | ||
connected it, in the group they chose. It also tells it that the host | ||
refuses anything their roles don't allow. | ||
| ||
To approve a client, the member must hold a role in the group, and the | ||
group must be switched on. The approval page offers only such groups. | ||
| @@ -33,119 +33,121 @@ group must be switched on. The approval page offers only such groups. | ||
| ||
The host answers MCP at `<PUBLIC_URL>/mcp` and runs the OAuth flow MCP's | ||
authorization spec describes. A client that calls `/mcp` without a token | ||
gets a `401` pointing to the host's metadata, and from there finds where | ||
to sign in. | ||
gets a `401` pointing to the host's metadata, and from there it finds | ||
where to sign in. | ||
| ||
A client names itself in one of two ways. It can give the https URL of a | ||
client metadata document, a JSON file that describes it; the host | ||
client metadata document, a JSON file that describes it. The host | ||
fetches that document at each sign-in and stores nothing. Or it can | ||
register at `/mcp/register` as a public client, with no secret; | ||
registration is open, and a registered client never connected is | ||
forgotten after a day. One a member has connected is kept, to connect | ||
again, and its connections are forgotten once they lapse. | ||
register at `/mcp/register` as a public client, with no secret. | ||
Registration is open, and the host forgets a registered client that's | ||
never connected after a day. It keeps one a member has connected, so it | ||
can connect again, and forgets its connections once they lapse. | ||
| ||
The member approves on the console. The client sends the member's | ||
browser to `/mcp/authorize`, and the host passes them to the console's | ||
approval page. Signed in to the console as themselves, the member sees | ||
the client's name, the client ID it came from, and the roles it would | ||
act with, then picks a group or declines. The name is the client's own | ||
word for itself and the host does not check it, so the page says so and | ||
shows the client ID beside it. | ||
approval page. The member is signed in to the console as themselves. | ||
They see the client's name, the client ID it came from, and the roles it | ||
would act with, and then they pick a group or decline. The name is the | ||
client's own word for itself and the host doesn't check it. So the page | ||
says so and shows the client ID beside it. | ||
| ||
Approval sends the browser back to the client with a code. The client | ||
exchanges it once, proving with PKCE that it started the flow, for an | ||
access token and a refresh token. | ||
exchanges it once for an access token and a refresh token, proving with | ||
PKCE that it started the flow. | ||
| ||
Apps sign in to a group through a different path, the host's atproto | ||
OAuth server, where they act as the group itself (see [signing | ||
in](signing-in.md)). An MCP client acts as a member, so the two must not | ||
mix. MCP clients' tokens are kept apart from apps' tokens. `/mcp` | ||
mix. The host keeps MCP clients' tokens apart from apps' tokens. `/mcp` | ||
accepts only an MCP client's token, and the XRPC methods never accept | ||
one. | ||
| ||
Details: | ||
| ||
- The metadata is at `/.well-known/oauth-protected-resource/mcp` and | ||
`/.well-known/oauth-authorization-server/mcp`; the issuer is | ||
`/.well-known/oauth-authorization-server/mcp`. The issuer is | ||
`<PUBLIC_URL>/mcp`. | ||
- PKCE is `S256` only. Grants are `authorization_code` and | ||
`refresh_token`. | ||
- A pending request lasts 10 minutes. An access token lasts an hour. | ||
- Refreshing rotates both tokens, and the old refresh token works once. | ||
A refresh token lapses 30 days after it was issued, so a client that | ||
has not refreshed for 30 days must be approved again. | ||
- Tokens are random and kept only as SHA-256 hashes. | ||
hasn't refreshed for 30 days must be approved again. | ||
- Tokens are random, and the host keeps them only as SHA-256 hashes. | ||
- Redirect URIs, limits and errors are in [the API | ||
reference](../reference/api.md). | ||
| ||
## Tools and calls | ||
| ||
Each tool is the twin of a command of `opensocial` | ||
([the commands](../reference/cli.md#opensocial)): `opensocial member | ||
assign` is the tool `member_assign`, and takes the same arguments, its | ||
flags named in snake case. The two are made from one list of tools in | ||
`crates/group-host-mcp`, so they cannot drift. The tools are grouped as | ||
the commands are: the group, its profile, rules, roles, members, join | ||
requests, invites, spaces, and moderation (see | ||
[moderation](moderation.md)). Each tool's input schema is made from the | ||
lexicon of what it asks or writes, without the group, and its | ||
description says what it does, then what that lexicon says. [The MCP | ||
([the commands](../reference/cli.md#opensocial)). For example, | ||
`opensocial member assign` is the tool `member_assign`. It takes the | ||
same arguments, with its flags named in snake case. Both come from one | ||
list of tools in `crates/group-host-mcp`, so they can't drift. The tools | ||
are grouped the way the commands are: the group, its profile, rules, | ||
roles, members, join requests, invites, spaces, and moderation (see | ||
[moderation](moderation.md)). Each tool's input schema comes from the | ||
lexicon of what it asks or writes, without the group. Its description | ||
says what it does, then what that lexicon says. [The MCP | ||
reference](../reference/mcp.md) lists them. | ||
| ||
What a call does is worked out the same way for a tool and its command, | ||
as a plan of one of four kinds: | ||
| ||
- **A method of the host's**, such as `listInvites` for `invite_list`. | ||
The host asks itself, as the member, the way the console does: it | ||
fills in the connected group, makes a console session for the member, | ||
and sends the method's request through its own router. The method then | ||
decides by the member's roles, as it would for any caller. | ||
- **A record of the group's**, such as a rule, a role or a membership, | ||
put or deleted in its meta or members space. The host makes the write | ||
as the member's own session for the group would make it: with the | ||
scope a group token for that space carries, the member's roles as they | ||
are, and the same rules as any write of it | ||
The host works out what a call does the same way for a tool and its | ||
command. It makes a plan of one of four kinds: | ||
| ||
- A method of the host's, such as `listInvites` for `invite_list`. The | ||
host asks itself, as the member, the way the console does. It fills in | ||
the connected group, makes a console session for the member, and sends | ||
the method's request through its own router. The method then decides | ||
by the member's roles, as it would for any caller. | ||
- A record of the group's, such as a rule, a role or a membership, put | ||
or deleted in its meta or members space. The host makes the write the | ||
way the member's own session for the group would. It uses the scope a | ||
group token for that space carries, the member's current roles, and | ||
the same rules as any write of that record | ||
([membership](membership.md#writing-roles-grants-and-memberships)). | ||
- **An invite**, written as the group in the invitee's inbox, or taken | ||
back, in the same way, with the scope a group token for that inbox | ||
carries ([membership](membership.md#invites)). | ||
- **A role's grant**, set or dropped in the permissions record, the rest | ||
of the record as it was. | ||
- An invite, written as the group in the invitee's inbox, or taken back | ||
the same way. It uses the scope a group token for that inbox carries | ||
([membership](membership.md#invites)). | ||
- A role's grant, set or dropped in the permissions record. The rest of | ||
the record stays as it was. | ||
| ||
The safest way to keep an MCP client within the member's power is to | ||
give it no other path than the member's own, and each kind is that. A | ||
give it no path but the member's own, and each kind is that path. A | ||
refusal comes back as the tool's error, with the host's error and | ||
message; a success comes back as the method's JSON, or the record's URI. | ||
message. A success comes back as the method's JSON, or the record's URI. | ||
| ||
Some of what the host does is not a tool. An MCP client cannot list or | ||
end connections, so it cannot hide itself or end another client's. It | ||
cannot make a group, move one, or bring an account here, which are | ||
commands only, nor change the group's recovery keys or delete it (see | ||
[recovery](recovery.md)); those stay with the member. It can switch the | ||
group off, as `group_deactivate`, which a steward undoes. | ||
Some of what the host does isn't a tool. An MCP client can't list or end | ||
connections, so it can't hide itself or end another client's. It can't | ||
make a group, move one, or bring an account here, since those are | ||
commands only. It also can't change the group's recovery keys or delete | ||
it (see [recovery](recovery.md)). Those stay with the member. It can | ||
switch the group off, as `group_deactivate`, and a steward can undo | ||
that. | ||
| ||
Details: | ||
| ||
- `/mcp` takes one JSON-RPC 2.0 message per POST and answers it as JSON. | ||
A notification is answered `202` with no body. | ||
A notification gets `202` with no body. | ||
- It answers `initialize`, `ping`, `tools/list` and `tools/call`. | ||
- Signing out of the console does not stop a member's MCP clients, since | ||
- Signing out of the console doesn't stop a member's MCP clients, since | ||
each call makes its own session. | ||
| ||
## Seeing and disconnecting | ||
| ||
On the group's page, a member whose roles hold `group.configure` sees | ||
"Connect an AI app": the MCP address to add, to copy, what the app will | ||
then ask of them, and a few things to ask it; and under it the clients | ||
they connected to that group, with when each connected and was last | ||
used. Any other member sees theirs under "Your AI apps", once they have | ||
connected one. A member sees and ends only their own. | ||
"Connect an AI app". It shows the MCP address to add and copy, what the | ||
app will then ask of them, and a few things to ask it. | ||
Under it are the clients they connected to that group, with when each | ||
connected and when it was last used. Any other member sees theirs under | ||
"Your AI apps", once they've connected one. A member sees and ends only | ||
their own. | ||
| ||
Disconnecting a client with `revokeConnectedApp` ends every connection | ||
the member made with that client in that group, and its tokens with it. | ||
the member made with that client in that group, along with its tokens. | ||
A connection also ends when: | ||
| ||
- the member is removed from the group, by ejection, or leaves it; | ||
- the group is deleted, which removes its connections and pending | ||
requests too; | ||
- its refresh token lapses. | ||
- the member is removed from the group by ejection, or leaves it | ||
- the group is deleted, which also removes its connections and pending | ||
requests | ||
- its refresh token lapses | ||
docs/design/membership.md+157−151
| @@ -1,50 +1,50 @@ | ||
# Membership | ||
| ||
A group has no one person in charge. So who is in it, and what each member | ||
may do, is recorded where every member's tools can check it. Getting in is | ||
a decision the group makes, and getting out leaves no access behind. The | ||
methods' parameters and errors are in [the API reference](../reference/api.md). | ||
A group has no one person in charge. So the host records who's in it, | ||
and what each member may do, where every member's tools can check it. | ||
The group decides who gets in, and someone who leaves keeps no access. | ||
The methods' parameters and errors are in [the API reference](../reference/api.md). | ||
| ||
## Where membership is recorded | ||
| ||
The group writes its roster in its members space, | ||
`at://<group>/space/fyi.opensocial.members/self`. A space is a private | ||
record store whose authority, here the group, decides who may read and | ||
record store whose authority (here the group) decides who may read and | ||
write it ([spaces](spaces.md)). Any member's tools can read the roster | ||
there, and no one outside the group can. The group writes three kinds of | ||
record: | ||
| ||
- `fyi.opensocial.membership`, one per member, keyed by their DID: the | ||
`roles` they hold, each by its id (`["member", "admin"]`), at most | ||
100. | ||
- `fyi.opensocial.role`, one per role, keyed by its id: its name, | ||
description, and whether it is a `default` or `bot` role. | ||
- `fyi.opensocial.permissions`, one record at `self`: a grant per role, | ||
with the scopes it carries and the roles it may assign | ||
- `fyi.opensocial.membership`, one per member, keyed by their DID. It | ||
holds the `roles` they have, each by its id (`["member", "admin"]`), | ||
at most 100. | ||
- `fyi.opensocial.role`, one per role, keyed by its id. It holds the | ||
role's name, description, and whether it's a `default` or `bot` role. | ||
- `fyi.opensocial.permissions`, one record at `self`. It holds a grant | ||
per role, with the scopes it carries and the roles it may assign | ||
(`defs#groupGrant`, each a list of strings). | ||
| ||
Whoever may read the members space reads who is in it with | ||
`listMembers`: each member and their roles, named by the handle their DID | ||
document gives, a page at a time in the order of their DIDs. A roster | ||
outgrows one answer, so `getGroup` only counts them (`memberCount`). With | ||
`q`, the page holds only those whose handle or DID contains it, whatever | ||
its case, which is how the console finds a member as their handle is | ||
typed. | ||
| ||
A member is anyone with a membership record. Every member holds `member`, | ||
the role the members space lets read, and no membership leaves it out. | ||
Who may read the members space is fixed; `updateSpace` will not change | ||
it. | ||
| ||
Apps change these records the way they change any of the group's: by | ||
writing them as the group, with `com.atproto.space.*`, as the next | ||
sections tell. The host has no method of its own for roles, grants or | ||
Anyone who may read the members space can see who's in it with | ||
`listMembers`. It answers each member and their roles, named by the | ||
handle their DID document gives, a page at a time in DID order. A roster | ||
outgrows one answer, so `getGroup` only counts them (`memberCount`). | ||
With `q`, the page holds only members whose handle or DID contains it, | ||
ignoring case. That's how the console finds a member as you type their | ||
handle. | ||
| ||
A member is anyone with a membership record. Every member holds | ||
`member`, the role the members space lets read, and no membership leaves | ||
it out. Who may read the members space is fixed, and `updateSpace` won't | ||
change it. | ||
| ||
Apps change these records the way they change any of the group's, by | ||
writing them as the group with `com.atproto.space.*` (see the next | ||
sections). The host has no method of its own for roles, grants or | ||
memberships. | ||
| ||
A member may also write an `fyi.opensocial.acceptance` record in their own | ||
repo there. It is their side of membership, for apps that show only those | ||
who have taken up their place. It changes nothing they may do. `getGroup` | ||
reports it to them as `viewer.accepted`. | ||
A member may also write an `fyi.opensocial.acceptance` record in their | ||
own repo there. It's their side of membership, for apps that show only | ||
people who have taken up their place. It doesn't change anything they | ||
may do. `getGroup` reports it to them as `viewer.accepted`. | ||
| ||
## Roles and what they grant | ||
| ||
| @@ -53,95 +53,96 @@ The host's methods ask about eleven actions, such as `invite`, `admit`, | ||
one scope, in atproto's permission syntax | ||
(`space:fyi.opensocial.invites?authority=*&collection=fyi.opensocial.invite`, | ||
`space:*?manage=create`). A | ||
member may do what any of their roles grants. Roles add up, with no deny, | ||
precedence or hierarchy, so every "may they?" is a lookup. A grant may | ||
also carry `repo:<collection>` scopes, the collections of the group's | ||
public repo its holders may write as the group. | ||
member may do what any of their roles grants. Roles add up, with no | ||
deny, precedence or hierarchy, so every "may they?" is a lookup. A grant | ||
may also carry `repo:<collection>` scopes, the collections of the | ||
group's public repo its holders may write as the group. | ||
| ||
The console takes what each person may change from `getGroup`: its | ||
The console takes what each person may change from `getGroup`. Its | ||
settings are for a member whose roles grant `group.configure`, or who | ||
may make app passwords (a grant of `repo:*`), and show those only the | ||
parts that are theirs. Anyone else sees no way to them, and an address | ||
under them says nothing there is theirs to change. | ||
may make app passwords (a grant of `repo:*`). It shows those members only | ||
the parts that are theirs. Anyone else sees no way to the settings, and | ||
an address under them says there's nothing there for them to change. | ||
| ||
Power over other members needs its own limit. A grant's `assignable` lists | ||
the roles its holders may give or take, and whose holders they may eject. | ||
It counts only through the grant that carries the action: whom a member | ||
may assign comes from their roles granting `role.assign`, whom they may | ||
eject from those granting `eject`, and what they may admit someone with | ||
from those granting `admit`. | ||
Power over other members needs its own limit. A grant's `assignable` | ||
lists the roles its holders may give or take, and whose holders they may | ||
eject. It counts only through the grant that carries the action. A | ||
member's roles granting `role.assign` say whom they may assign, their | ||
roles granting `eject` say whom they may eject, and their roles granting | ||
`admit` say what roles they may admit someone with. | ||
| ||
The actions over members are writes of memberships in the members space, | ||
so their scopes say so: `admit` is | ||
and their scopes say so. `admit` is | ||
`space:fyi.opensocial.members?skey=self&collection=fyi.opensocial.membership&action=create`, | ||
`role.assign` the same with `action=update`, and `eject` with | ||
`action=delete`. A scope naming every write of memberships, or of every | ||
collection in every space, carries all three, and so does the | ||
`fyi.opensocial.manageMembers` permission set, with `invite`. | ||
collection in every space, carries all three. So does the | ||
`fyi.opensocial.manageMembers` permission set, along with `invite`. | ||
| ||
A new group has two roles. `admin` grants every action and `repo:*`, and | ||
may assign `admin` and `member`. `member` is the default role and grants | ||
nothing. The founder and each steward named at creation hold both | ||
([groups](groups.md)). | ||
| ||
Some member must always hold a role that grants `group.configure`, or no | ||
one could run the group. Any write that would leave nobody holding one is | ||
refused with `LastConfigurer`, as is `leaveGroup` for its last holder. | ||
Some member must always hold a role that grants `group.configure`, or | ||
no one could run the group. The host refuses any write that would leave | ||
nobody holding one with `LastConfigurer`, and refuses `leaveGroup` for | ||
the last holder the same way. | ||
| ||
## Writing roles, grants and memberships | ||
| ||
An app writes these records as the group through `createRecord`, | ||
`putRecord`, `deleteRecord` or `applyWrites` of `com.atproto.space.*`, | ||
with a session for the group ([signing in](signing-in.md)). The session's | ||
scope must name each write, and the member who signed the app in must, | ||
at the time of each write, hold: | ||
with a session for the group ([signing in](signing-in.md)). The | ||
session's scope must name each write. At the time of each write, the | ||
member who signed the app in must hold: | ||
| ||
- `group.configure` for roles and the permissions record; | ||
- `group.configure` for roles and the permissions record. | ||
- `admit` to create a membership, `role.assign` to change one, and | ||
`eject` to delete one. | ||
| ||
The host then makes each write only as it keeps the group whole, and | ||
does what the write means. The writes of one `applyWrites` are each | ||
asked of the records as the writes before them left them, against the | ||
member's roles as they were before any, and are made together or not at | ||
all. | ||
The host then makes each write only if it keeps the group whole, and | ||
does what the write means. In one `applyWrites`, each write is checked | ||
against the records as the earlier writes left them. It's checked | ||
against the member's roles as they were before any of the writes. The | ||
writes all happen together or not at all. | ||
| ||
A role (`fyi.opensocial.role`) is keyed by its id, 64 characters at | ||
most. It goes only once no member holds it and the permissions record | ||
grants it nothing (`RoleInUse`): an app deletes the role and writes the | ||
permissions record without its grant at once. Its name is 64 characters | ||
at most, its description 2,000. | ||
most. It can only go once no member holds it and the permissions record | ||
grants it nothing (`RoleInUse`). So an app deletes the role and writes | ||
the permissions record without its grant at once. Its name is 64 | ||
characters at most, and its description 2,000. | ||
| ||
The permissions record is kept at `self` and never deleted. It holds at | ||
most one grant per role, of a role the group defines. In it a member | ||
most one grant per role, for a role the group defines. In it a member | ||
changes only: | ||
| ||
- the grants of roles their own grants may assign, or of a new role, | ||
one nobody holds and no grant names (`NotAssignable`); | ||
- scopes their own roles hold, as written or within one they hold, a | ||
permission set of ours read as the scopes it lists (`ScopeNotHeld`); | ||
- the grants of roles their own grants may assign, or of a new role that | ||
nobody holds and no grant names (`NotAssignable`). | ||
- scopes their own roles hold, as written or within one they hold. A | ||
permission set of ours counts as the scopes it lists (`ScopeNotHeld`). | ||
- `assignable` lists, adding only roles they may assign themselves, or a | ||
new role (`NotAssignable`), each defined. | ||
| ||
So nobody gives a role more than they hold, and the founder can grant a | ||
role they have just made and add it to what their own role may assign. | ||
So nobody gives a role more than they hold. And the founder can grant a | ||
role they've just made and add it to what their own role may assign. | ||
| ||
A membership (`fyi.opensocial.membership`) is kept at its member's DID, | ||
holds `member` (`MemberRole`), and names only roles the group defines. | ||
| ||
- Creating one admits someone waiting to join, and their request goes | ||
([joining](#joining)). Each role it gives must be one the writer's | ||
`admit` grants may assign. Nobody who has not asked is made a member | ||
so (`JoinRequestNotFound`). | ||
- Writing one for a member changes their roles: each role added or taken | ||
away must be one the writer's `role.assign` grants may assign. A | ||
request of theirs still waiting goes. | ||
away ([joining](#joining)). Each role it gives must be one the | ||
writer's `admit` grants may assign. Nobody who hasn't asked can be | ||
made a member this way (`JoinRequestNotFound`). | ||
- Writing one for a member changes their roles. Each role added or taken | ||
away must be one the writer's `role.assign` grants may assign. Any | ||
request of theirs that's still waiting goes away. | ||
- Deleting one puts the member out, if each role they hold is one the | ||
writer's `eject` grants may assign ([below](#leaving-and-being-removed)). | ||
| ||
A token from `getGroupAuth` for the members space writes what the | ||
member's grants let them write there, and the console's member and | ||
settings pages write with one, and so do the `opensocial` commands. An | ||
member's grants let them write there. The console's member and settings | ||
pages write with one, and so do the `opensocial` commands. An | ||
[MCP client](mcp.md) makes the same writes with its tools, as the member | ||
who connected it: `role_set`, `role_delete`, `role_grant`, | ||
`member_assign` and `member_eject`. | ||
| @@ -150,26 +151,27 @@ who connected it: `role_set`, `role_delete`, `role_grant`, | ||
| ||
The profile's `joinPolicy` decides how people get in: `open`, `approval` | ||
(the default) or `invite`. Someone asks with `requestJoin`. With `open` | ||
they are in at once. With `invite` they are refused (`JoinClosed`) | ||
unless invited. With `approval` their request waits, with an optional | ||
message, until someone holding `admit` writes their membership as the | ||
group, or turns them down with `denyJoinRequest`. A live invite admits whatever the policy, since the | ||
group has already said yes. The asker may name it (`invite`, its at-uri); | ||
one named that is not their live invite from this group is refused | ||
(`InvalidInvite`). Unnamed, a live invite admits them all the same. | ||
| ||
`requestJoin` answers `status`: `admitted`, with the `membership` it | ||
wrote (its `uri` and `cid`), or `pending`, with the `request` waiting. | ||
| ||
One let in by `requestJoin`, or by an invite, gets the default roles: | ||
those marked `default`, or `member` if none is, and `member` always. An | ||
admitter writing a membership gives the roles it names, each one the | ||
group defines and they may assign. | ||
| ||
The asker is no member, and the members space is for members, so requests | ||
are not records: the host keeps them in its database, one per group and | ||
asker. A decided request is deleted, so a denial looks like no request and | ||
the asker may ask again. | ||
they're in at once. With `invite` the host refuses them (`JoinClosed`) | ||
unless they're invited. With `approval` their request waits, with an | ||
optional message, until someone holding `admit` writes their membership | ||
as the group or turns them down with `denyJoinRequest`. A live invite | ||
admits them under any policy, since the group has already said yes. The | ||
asker may name it (`invite`, its at-uri). If the named invite isn't | ||
their live invite from this group, the host refuses it (`InvalidInvite`). | ||
If they don't name one, a live invite admits them all the same. | ||
| ||
`requestJoin` answers `status`. That's `admitted` with the `membership` | ||
it wrote (its `uri` and `cid`), or `pending` with the `request` waiting. | ||
| ||
Someone let in by `requestJoin`, or by an invite, gets the default | ||
roles. Those are the roles marked `default` (or `member` if none is), | ||
and always `member`. An admitter writing a membership gives the roles it | ||
names, each one the group defines and they may assign. | ||
| ||
The asker isn't a member, and the members space is for members, so | ||
requests aren't records. The host keeps them in its database, one per | ||
group and asker. It deletes a request once it's decided, so a denial | ||
looks like no request and the asker may ask again. | ||
| ||
Details: | ||
| ||
| @@ -178,62 +180,66 @@ Details: | ||
- Getting in by any route ends a waiting request, and so does any write | ||
of the asker's membership. | ||
- The asker sees their request with `getJoinRequest` and withdraws it | ||
with `cancelJoinRequest`; admitters list them with `listJoinRequests`. | ||
with `cancelJoinRequest`. Admitters list them with `listJoinRequests`. | ||
| ||
## Invites | ||
| ||
An invite must reach someone outside the group, so the group writes it | ||
where they already look: their inbox, | ||
`at://<invitee>/space/fyi.opensocial.invites/self`, a space of their own at | ||
their PDS. The invite is an `fyi.opensocial.invite` record in the group's | ||
repo there, with a `createdAt` and an optional `message` and | ||
`expiresAt`. An inbox's policy is `com.atproto.managedspace.policy` naming | ||
this host as its managing app, `<host DID>#opensocial`, and the host | ||
answers `com.atproto.managedspace.checkAccess` for it, asked by the | ||
inbox's authority with service auth: a group on this host may write one, | ||
its owner may read it, and with no account named nobody may do either. | ||
where they already look. That's their inbox, | ||
`at://<invitee>/space/fyi.opensocial.invites/self`, a space of their own | ||
at their PDS. The invite is an `fyi.opensocial.invite` record in the | ||
group's repo there, with a `createdAt` and an optional `message` and | ||
`expiresAt`. An inbox's policy is `com.atproto.managedspace.policy`, | ||
which names this host as its managing app (`<host DID>#opensocial`). So | ||
the host answers `com.atproto.managedspace.checkAccess` for it, when the | ||
inbox's authority asks with service auth. A group on this host may write | ||
one and its owner may read it. With no account named, nobody may do | ||
either. | ||
| ||
An app invites someone by writing that record as the group, through | ||
`com.atproto.space.createRecord` (or `putRecord`, or `applyWrites` with | ||
one write) with a session for the group, and takes the invite back by | ||
one write) with a session for the group. It takes the invite back by | ||
deleting it (`deleteRecord`). A session gets there through the | ||
`manageMembers` permission set, a `space:fyi.opensocial.invites` scope, | ||
or a group token for the inbox from `getGroupAuth`, which the console | ||
uses ([signing in](signing-in.md)). Whichever, the member who signed the | ||
app in must hold `invite` at the time of each write. The host checks each | ||
write as it would make it itself: | ||
uses ([signing in](signing-in.md)). In every case, the member who signed | ||
the app in must hold `invite` at the time of each write. The host checks | ||
each write the same way it would check its own: | ||
| ||
- An inbox holds invites and nothing else, at `self`. | ||
- The invitee may not be a member already (`AlreadyMember`). | ||
- A group has one invite to each person at a time. Writing one while one | ||
waits answers the waiting one, unchanged, unless it is written at that | ||
waits answers the waiting one, unchanged, unless it's written at that | ||
one's key, which replaces it. | ||
- Deleting an invite that does not wait is refused (`InviteNotFound`). | ||
- The host refuses to delete an invite that isn't waiting | ||
(`InviteNotFound`). | ||
| ||
The group tells the invitee's PDS of the write at once. If that fails it | ||
retries, the wait doubling from 10 seconds up to an hour, and gives up | ||
after a day. | ||
The group tells the invitee's PDS about the write at once. If that | ||
fails, it retries with the wait doubling from 10 seconds up to an hour, | ||
and gives up after a day. | ||
| ||
The inbox is the invitee's to read, so the host keeps its own list of | ||
The inbox is the invitee's to read. So the host keeps its own list of | ||
invites sent, one per group and invitee, kept in step with each write, | ||
and redeems from that list. Redeeming takes the invite back, from the | ||
inbox and the list, once the membership is written, so a join that fails | ||
leaves the invite waiting. One past its `expiresAt` no longer admits: the | ||
host takes it back when the invitee asks to join, or within the hour on | ||
its own, and inviting again writes a fresh one. The invitee may refuse | ||
with `declineInvite`, and the group may still invite them later. Holders | ||
of `invite` list invites with `listInvites`. A site that cannot read | ||
someone's inbox shows them their invites through `getActorInvites`. The | ||
console reads them once for each page, beside who is signed in: a dot on | ||
their picture in the header and a count in its menu say some are | ||
waiting, and the home page lists them, each to join or decline, as | ||
the group's own page does for one who opens it invited. Declining one | ||
asks nothing first, as another can be sent. | ||
and redeems from that list. Redeeming takes the invite back from the | ||
inbox and the list once the membership is written, so a join that fails | ||
leaves the invite waiting. An invite past its `expiresAt` doesn't admit | ||
anyone. The host takes it back when the invitee asks to join, or on its | ||
own within the hour, and inviting again writes a fresh one. The invitee | ||
may refuse with `declineInvite`, and the group may still invite them | ||
later. Holders of `invite` list invites with `listInvites`. | ||
| ||
A site that can't read someone's inbox shows them their invites through | ||
`getActorInvites`. The console reads them once for each page, beside who | ||
is signed in. A dot on your picture in the header and a count in its | ||
menu say some are waiting. The home page lists them, each with a way to | ||
join or decline, and the group's own page does the same for an invited | ||
person who opens it. Declining one doesn't ask you to confirm, since the | ||
group can send another. | ||
| ||
Details: | ||
| ||
- `expiresAt` is an atproto datetime, in UTC or at an offset from it, and | ||
must be still to come. | ||
- `expiresAt` is an atproto datetime, in UTC or at an offset from it, | ||
and must be in the future. | ||
- An invite's message is 2,000 characters at most. | ||
| ||
## Leaving and being removed | ||
| @@ -242,28 +248,28 @@ A member leaves with `leaveGroup`. A holder of `eject` puts one out by | ||
deleting their membership as the group, if every role the member holds | ||
is one the ejecter's `eject` grants may assign. Either way the host: | ||
| ||
1. revokes the space credentials the group issued them; | ||
1. revokes the space credentials the group issued them. | ||
2. ends the OAuth grants they approved for the group, and their | ||
[MCP clients'](mcp.md) grants, with every session those began; | ||
3. drops their app passwords for the group; | ||
4. deletes their membership; | ||
5. takes them out of the writer set of each of the group's spaces: the | ||
[MCP clients'](mcp.md) grants, with every session those began. | ||
3. drops their app passwords for the group. | ||
4. deletes their membership. | ||
5. takes them out of the writer set of each of the group's spaces. The | ||
index forgets what they wrote there, and the services syncing each | ||
space are told (`repoRemoved`). | ||
| ||
Credentials go first, so that if revoking fails they are still in and | ||
the call, or the write deleting their membership, can be made again. | ||
Removed, the rest follows the write; deleting a membership that is gone | ||
already changes nothing and does nothing more. A credential lasts ten minutes; the group keeps | ||
each it issues until it lapses, to revoke it at once. For writers on other | ||
PDSes it sends `com.atproto.space.notifyCredentialsRevoked`, best effort. | ||
With no membership they hold no roles, so the access records grant them | ||
nothing. | ||
Credentials go first. So if revoking fails, they're still in, and the | ||
call (or the write deleting their membership) can be made again. Once | ||
they're removed, the rest follows the write. Deleting a membership that's | ||
already gone changes nothing and does nothing more. A credential lasts | ||
ten minutes, and the group keeps each one it issues until it lapses, so | ||
it can revoke it at once. For writers on other PDSes it sends | ||
`com.atproto.space.notifyCredentialsRevoked`, best effort. With no | ||
membership they hold no roles, so the access records grant them nothing. | ||
| ||
An ejection is then kept in the group's [moderation](moderation.md) | ||
The group then keeps an ejection in its [moderation](moderation.md) | ||
queue, as an `ejectEvent` on the member's DID, with who removed them. | ||
Leaving keeps nothing there. | ||
| ||
What they wrote stays in their own repos at their own PDSes. The group's | ||
index forgets it at once, and drops on each sync any writer a space no | ||
longer lets write. | ||
index forgets it at once. On each sync it drops any writer that a space | ||
doesn't let write anymore. | ||
docs/design/moderation.md+132−126
| @@ -1,19 +1,19 @@ | ||
# Moderation | ||
| ||
A group's members write in their own repos, on their own PDSes. The | ||
group cannot edit or delete what they wrote. So a group moderates by | ||
group can't edit or delete what they wrote. So a group moderates by | ||
writing its judgements beside the content, as records of its own, and by | ||
keeping a queue of what still needs a judgement. Reports come in, labels | ||
go out, and the queue sits between them. | ||
| ||
Every moderation method names a group hosted here, a group account with | ||
a members [space](spaces.md). A DID that is not one is refused with | ||
a members [space](spaces.md). The host refuses any other DID with | ||
`GroupNotFound`. | ||
| ||
## Who moderates | ||
| ||
Moderating is a matter of roles, as everything a member does in a group | ||
is (see [membership](membership.md)). Three of the host's actions are | ||
Moderating comes down to roles, like everything else a member does in a | ||
group (see [membership](membership.md)). Three of the host's actions are | ||
about moderation: | ||
| ||
- `mod.read`: see the queue and a subject's history. | ||
| @@ -21,18 +21,19 @@ about moderation: | ||
- `label`: write a label, of any value, and delete one. | ||
| ||
A role holds an action through an OAuth scope in the group's permissions | ||
record, and a member holds the union of their roles' actions. There is | ||
no deny and no hierarchy. A new group's `admin` role holds every action, | ||
moderation included; its `member` role holds none. To make moderators, a | ||
record, and a member holds the union of their roles' actions. There's no | ||
deny and no hierarchy. A new group's `admin` role holds every action, | ||
moderation included. Its `member` role holds none. To make moderators, a | ||
group gives a role these actions and gives that role to people. | ||
| ||
Each method checks the caller's roles as they are at the moment of the | ||
call. The caller is whoever signed in, either through service auth from | ||
Each method checks the caller's roles at the moment of the call. The | ||
caller is the person who signed in, either through service auth from | ||
their PDS or through the console's session (see [signing | ||
in](signing-in.md)). A caller without the action is refused `403 | ||
Forbidden`. An MCP client a member connects can read the queue, label and | ||
resolve as that member, within the same roles, with the `mod_*` tools, | ||
the twins of the `opensocial mod` commands (see [MCP](mcp.md)). | ||
in](signing-in.md)). The host refuses a caller without the action with | ||
`403 Forbidden`. An MCP client a member connects can read the queue, | ||
label and resolve as that member, within the same roles. It does that | ||
with the `mod_*` tools, which mirror the `opensocial mod` commands (see | ||
[MCP](mcp.md)). | ||
| ||
Details: | ||
| ||
| @@ -40,37 +41,37 @@ Details: | ||
`mod.resolve` by `rpc:fyi.opensocial.resolveSubject`, and `label` by | ||
`space:*?collection=com.atproto.label.label`, or any `space:*` scope | ||
covering that collection. | ||
- No caller at all is `401 AuthMissing`. | ||
- No caller at all gets `401 AuthMissing`. | ||
| ||
## Labels | ||
| ||
A label is a moderation tag on a record or an account. Here it is a | ||
`com.atproto.label.label` record that the group writes, as it writes any | ||
record of its own: with `com.atproto.space.createRecord` and the rest, | ||
and a token for the group ([signing in](signing-in.md)). It holds the | ||
subject's `uri` (an account's DID, or a record's URI), optionally the | ||
`cid` of one version of a record, a value `val`, and `cts`, when it was | ||
made. | ||
A label is a moderation tag on a record or an account. Here it's a | ||
`com.atproto.label.label` record that the group writes, the same way it | ||
writes any record of its own. That means `com.atproto.space.createRecord` | ||
and the rest, with a token for the group ([signing in](signing-in.md)). | ||
It holds the subject's `uri` (an account's DID, or a record's URI), | ||
optionally the `cid` of one version of a record, a value `val`, and | ||
`cts`, when it was made. | ||
| ||
A label has to be readable by the people who see its subject, and only | ||
by them. So it goes where the subject lives. A record's label goes into | ||
the space the record is in, in the group's own repo there; an account's | ||
label goes into the group's members space. Whoever may read the space | ||
the space the record is in, in the group's own repo there. An account's | ||
label goes into the group's members space. Anyone who may read the space | ||
may read its labels. | ||
| ||
A member also writes in their own public repo, outside the group's | ||
spaces: a post an app such as a forum shows to the group's public | ||
community. Such a record is labelled where its author's labels go, in | ||
the members space, so a moderator can label one post rather than the | ||
member who wrote it. The host refuses a label whose `uri` is neither a | ||
DID nor a record in the space it is written in, nor, in the members | ||
spaces. An example is a post that an app such as a forum shows to the | ||
group's public community. Such a record is labelled where its author's | ||
labels go, in the members space, so a moderator can label one post | ||
instead of the member who wrote it. The host refuses a label whose `uri` | ||
isn't a DID or a record in the space it's written in. In the members | ||
space, a record in the public repo of someone who holds a role in the | ||
group. | ||
group is also allowed. | ||
| ||
A label is taken back by deleting it. The record is gone from the | ||
space, but the queue keeps that it was written, when, and by whom. | ||
You take a label back by deleting it. The record is gone from the space, | ||
but the queue keeps that it was written, when, and by whom. | ||
| ||
The host gives no value an effect of its own: it hides and removes | ||
The host gives no value an effect of its own, so it hides and removes | ||
nothing. An app that reads a space reads its labels with it, and decides | ||
what to show. The group says what its values mean in its labeler (see | ||
[reports](#reports)). | ||
| @@ -80,64 +81,65 @@ Details: | ||
- Writing or deleting a label needs `label`. It reaches every space of | ||
the group's, but in a space for chosen people only those of them who | ||
hold it. The token's scope must cover the write, as for any record. | ||
- The record is checked against its lexicon: a value is 128 bytes at | ||
- The record is checked against its lexicon. A value is 128 bytes at | ||
most, and `uri`, `val` and `cts` are required. | ||
- The host does not check that the subject exists or that a CID | ||
matches. | ||
- The host doesn't check that the subject exists or that a CID matches. | ||
- Every label written, and every one deleted, is also an event in the | ||
queue. | ||
| ||
## The queue | ||
| ||
A moderator needs to know what is waiting for a judgement and what was | ||
already done about it. The queue answers that. It is the host's own, | ||
kept in its database rather than published in the group's repo, and only | ||
those with `mod.read` see it. | ||
| ||
A subject is an account, sent and answered as | ||
`fyi.opensocial.defs#accountSubject` with its `did`, or a record, as | ||
`fyi.opensocial.defs#recordSubject` with its `uri` and, optionally, the | ||
`cid` of one version. A record is one in a space, or one in a public | ||
repo, `at://<did>/<collection>/<rkey>`, its own subject apart from its | ||
author's account. The queue keeps a record as a whole, by its URI; | ||
the version a report or label names stays on that event. A subject has a | ||
status: `open`, `escalated` or `resolved`. | ||
| ||
Each subject in the queue comes with `actor`: the account it is, or whose | ||
record it is, by its DID and handle, so a moderator reads who it is about | ||
rather than a DID. | ||
| ||
Its history is a list of events, each with an `id`, `createdAt`, who did | ||
it as `createdBy` and, by their DID and handle, as `creator`, the | ||
version of a record it is about as `cid` when it names one, and one of | ||
four kinds as `event`: | ||
A moderator needs to know what's waiting for a judgement and what was | ||
already done about it. The queue answers that. It's the host's own, kept | ||
in its database instead of published in the group's repo, and only | ||
people with `mod.read` see it. | ||
| ||
A subject is either an account or a record. An account is sent and | ||
answered as `fyi.opensocial.defs#accountSubject` with its `did`. A | ||
record is sent as `fyi.opensocial.defs#recordSubject` with its `uri` and, | ||
optionally, the `cid` of one version. The record is one in a space, or | ||
one in a public repo, `at://<did>/<collection>/<rkey>`, and it's a | ||
subject of its own, separate from its author's account. The queue keeps | ||
a record as a whole, by its URI. The version a report or label names | ||
stays on that event. A subject has a status: `open`, `escalated` or | ||
`resolved`. | ||
| ||
Each subject in the queue comes with `actor`, the account it is or whose | ||
record it is, by its DID and handle. So a moderator reads who it's about | ||
instead of a DID. | ||
| ||
Its history is a list of events. Each has an `id` and `createdAt`. It | ||
names who did it as `createdBy` and, by their DID and handle, as | ||
`creator`. It gives the version of a record it's about as `cid` when it | ||
names one, and one of four kinds as `event`: | ||
| ||
- `reportEvent`: someone reported it, with a `reasonType`, an optional | ||
`reason` and the `rule` it cites, if any. An appeal is one, its | ||
`reasonType` `com.atproto.moderation.defs#reasonAppeal`. | ||
`reason` and the `rule` it cites, if any. An appeal is a report too, | ||
with the `reasonType` `com.atproto.moderation.defs#reasonAppeal`. | ||
- `statusEvent`: a moderator set its `status`, with an optional `note`. | ||
- `labelEvent`: a label was written, by the label record's `uri` and its | ||
`val`; or, with `deleted: true`, deleted, which takes it back. | ||
- `ejectEvent`: the member was removed from the group, their membership | ||
deleted. It says nothing more. | ||
`val`. With `deleted: true`, the label was deleted, which takes it | ||
back. | ||
- `ejectEvent`: the member was removed from the group and their | ||
membership deleted. It says nothing more. | ||
| ||
A subject enters the queue with its first report, label or ejection, | ||
opened. | ||
A subject enters the queue with its first report, label or ejection, and | ||
starts out open. | ||
| ||
`listSubjects` lists the subjects of one status, `open` unless asked, | ||
`listSubjects` lists the subjects of one status (`open` by default), | ||
latest changed first. Every event moves a subject to the top. | ||
`getSubjectHistory` answers a subject's events, oldest first, a page at a | ||
time, and with a `cid` only those about that version. A subject nothing | ||
has happened to has no events. `resolveSubject` sets a subject already in | ||
the queue `resolved` or `escalated`, with an optional note of 2,000 | ||
characters at most. Setting the status a subject has keeps the note, so a | ||
note is added that way. It answers the subject as the queue now has it. | ||
Escalating is only a status, for a group to give its own meaning; no one | ||
is told. | ||
`getSubjectHistory` answers a subject's events, oldest first, a page at | ||
a time. With a `cid` it answers only those about that version. A subject | ||
nothing has happened to has no events. `resolveSubject` sets a subject | ||
already in the queue to `resolved` or `escalated`, with an optional note | ||
of 2,000 characters at most. Setting the status a subject already has | ||
keeps the note, so that's how you add a note. It answers the subject as | ||
the queue has it after the change. Escalating is only a status, for a | ||
group to give its own meaning, and no one is told. | ||
| ||
A resolved subject should come back when someone reports it again. A | ||
label is a moderator's own act, so it should not undo a resolution. So | ||
only a report reopens a resolved subject; a label or an ejection opens a | ||
label is a moderator's own act, so it shouldn't undo a resolution. So | ||
only a report reopens a resolved subject. A label or an ejection opens a | ||
subject nobody reported, and leaves a resolved one resolved. An | ||
escalated subject stays escalated through new reports. | ||
| ||
| @@ -145,31 +147,32 @@ Deleting a group deletes its queue. | ||
| ||
Details: | ||
| ||
- A subject that is neither a DID, a record in one of the group's | ||
spaces, nor a record in a public repo is `InvalidSubject`. Resolving | ||
one never in the queue is `SubjectNotFound`. | ||
- A page is 50 events or subjects unless `limit` says, 100 at most; the | ||
`cursor` an answer gives asks for the next. | ||
- A subject that isn't a DID, a record in one of the group's spaces or | ||
a record in a public repo fails with `InvalidSubject`. Resolving one | ||
that was never in the queue fails with `SubjectNotFound`. | ||
- A page is 50 events or subjects unless `limit` says otherwise, and 100 | ||
at most. The `cursor` an answer gives asks for the next page. | ||
| ||
## Reports | ||
| ||
A report comes from someone who can see what they report, so a group | ||
hears from the people its content reaches and not from strangers. A | ||
report arrives at `fyi.opensocial.createReport`, by service auth or the | ||
A report comes from someone who can see what they report. So a group | ||
hears from the people its content reaches, and strangers can't report. | ||
A report arrives at `fyi.opensocial.createReport`, by service auth or the | ||
console's session. It names the `group`, the subject, a `reasonType`, | ||
and optionally a `reason` and the `rule` it cites. It needs no role. | ||
| ||
The subject is an account that is a member of the group, a record in | ||
one of the group's spaces hosted here, or a record in the public repo of | ||
a member. The reporter must be able to read the space the subject is in: | ||
a record's own space, or for an account or a member's public record the | ||
members space, where its labels go. The report goes into the group's | ||
queue as a `reportEvent`, and is answered with its `id` and `createdAt`. | ||
Nobody is notified: the report waits in the queue for a moderator. | ||
The subject is an account that's a member of the group, a record in one | ||
of the group's spaces hosted here, or a record in the public repo of a | ||
member. The reporter must be able to read the space the subject is in. | ||
For a record that's its own space. For an account or a member's public | ||
record it's the members space, where its labels go. The report goes into | ||
the group's queue as a `reportEvent`, and the host answers with its `id` | ||
and `createdAt`. Nobody is notified, so the report waits in the queue | ||
for a moderator. | ||
| ||
The group's labeler, in its meta space, says what reports it takes. Each | ||
of its lists, when present, limits them: `reasonTypes` the reasons, | ||
`subjectTypes` the kinds of subject (`account`, `record`), and | ||
of its lists, when present, limits them. `reasonTypes` limits the | ||
reasons, `subjectTypes` the kinds of subject (`account`, `record`), and | ||
`subjectCollections` the collections a reported record may be in. A new | ||
group's labeler takes reports of accounts and records, for the common | ||
reasons and appeals, of any collection. | ||
| @@ -178,51 +181,54 @@ reasons and appeals, of any collection. | ||
| ||
Someone a group moderated should be able to answer it, and the | ||
moderators should hear it where they hear everything else. So an appeal | ||
is a report, its `reasonType` `com.atproto.moderation.defs#reasonAppeal`, | ||
filed by its subject: an account for itself, or a record's author for | ||
the record, the DID its URI is in. Anyone else appealing is refused | ||
`InvalidRequest`, saying only its subject may appeal. It goes into the | ||
queue as a `reportEvent` like any report, reopening a resolved subject, | ||
and keeps its reason, so a moderator reads it as an appeal. | ||
| ||
Whoever was put out of the group no longer holds a role, nor reads the | ||
members space, yet what was done to them is theirs to answer. So an | ||
appeal of a subject the queue already has, by any event (a report, a | ||
label, an ejection), is taken though its author is no longer a member | ||
and cannot read the space it is in. Any other appeal is held to the | ||
rules of any report. The labeler still decides: a group whose | ||
`reasonTypes` leave appeals out takes none. | ||
is a report with the `reasonType` | ||
`com.atproto.moderation.defs#reasonAppeal`, filed by its subject. That's | ||
an account for itself, or a record's author for the record (the DID its | ||
URI is in). The host refuses anyone else's appeal with `InvalidRequest`, | ||
saying only its subject may appeal. It goes into the queue as a | ||
`reportEvent` like any report and reopens a resolved subject. It keeps | ||
its reason, so a moderator reads it as an appeal. | ||
| ||
Someone put out of the group holds no role and can't read the members | ||
space, but what was done to them is still theirs to answer. So the host | ||
takes an appeal of a subject the queue already has, by any event (a | ||
report, a label, an ejection), even though its author isn't a member and | ||
can't read the space it's in. Any other appeal follows the rules of any | ||
report. The labeler still decides, so a group whose `reasonTypes` leave | ||
appeals out takes none. | ||
| ||
## The group's own labels | ||
| ||
A label anyone can put on anything says nothing to an app that does not | ||
A label anyone can put on anything says nothing to an app that doesn't | ||
know what it means. So the group's labeler also lists the labels it | ||
applies, in `policies.labelValues`, and defines its own in | ||
`policies.labelValueDefinitions`, each as atproto defines one: its | ||
`identifier`, its name and what it means in `locales`, and how apps | ||
applies, in `policies.labelValues`. It defines its own in | ||
`policies.labelValueDefinitions`, each the way atproto defines one. That | ||
covers its `identifier`, its name and meaning in `locales`, and how apps | ||
should show what wears it (`severity`, `blurs`, `defaultSetting`, | ||
`adultOnly`). A new group applies `!hide` and `!takedown`, which atproto | ||
defines, and none of its own. | ||
| ||
`putLabelDefinition` defines one, or changes the one with that value, and | ||
adds it to the values the labeler applies. `deleteLabelDefinition` takes | ||
both away; labels already applied stay. Each asks `group.configure`, and | ||
writes the labeler as the group, as any change to its meta space is. A | ||
group's own label is lowercase letters and hyphens, as atproto has a | ||
labeler's own values, so atproto's are never redefined. `getGroup` | ||
answers the definitions as `labels`, to whoever may read the meta space. | ||
`putLabelDefinition` defines one, or changes the one with that value, | ||
and adds it to the values the labeler applies. `deleteLabelDefinition` | ||
takes both away, and labels already applied stay. Each needs | ||
`group.configure`, and writes the labeler as the group, like any change | ||
to its meta space. A group's own label is lowercase letters and hyphens, | ||
the way atproto has a labeler's own values, so atproto's are never | ||
redefined. `getGroup` answers the definitions as `labels`, to anyone who | ||
may read the meta space. | ||
| ||
Details: | ||
| ||
- A group not hosted here is `GroupNotFound`. A subject the reporter | ||
cannot read, that is not in the group, a public record of someone not | ||
a member, or of a kind or collection the labeler does not take, is | ||
`InvalidSubject`; a reason it does not take, or an appeal by anyone but | ||
its subject, is `InvalidRequest`. An appeal of a subject already in the | ||
queue is taken though it is no longer in the group or readable by its | ||
author. A member's public record is a `record`, of its collection. | ||
- A group not hosted here fails with `GroupNotFound`. A subject fails | ||
with `InvalidSubject` if the reporter can't read it, if it isn't in | ||
the group, if it's a public record of someone who isn't a member, or | ||
if it's of a kind or collection the labeler doesn't take. A reason it | ||
doesn't take fails with `InvalidRequest`, and so does an appeal by | ||
anyone but its subject. The host takes an appeal of a subject already | ||
in the queue even if it isn't in the group or readable by its author | ||
anymore. A member's public record is a `record`, of its collection. | ||
- A `rule` must be a record's URI in the group's meta space. | ||
- The host does not check that the reported record exists or that its | ||
CID matches. | ||
- The host doesn't check that the reported record exists or that its CID | ||
matches. | ||
- Limits and the answer's fields are in [the API | ||
reference](../reference/api.md). | ||
docs/design/moving.md+148−137
docs/design/README.md+21−21
docs/design/recovery.md+61−58
docs/design/signing-in.md+237−219
456 lines changed: not loaded until asked for.
docs/design/sites.md+248−219
467 lines changed: not loaded until asked for.