chadtmiller.com/group-host
atmosphere group host
0
0
The console names people, uses plain verbs, and marks invites anywhere
.claude/skills/docs/questions.md+2−2
| @@ -61,11 +61,11 @@ one question per mechanism. | ||
2. What makes someone a member, and where is that recorded? | ||
3. How does someone join: open, by approval, by invite? | ||
4. How are invites delivered, seen, declined and revoked? | ||
5. What happens when a member leaves or is put out, to their access and | ||
5. What happens when a member leaves or is removed, to their access and | ||
to what they connected? | ||
6. Where is membership recorded (the members space: membership, role and | ||
permissions records), and what does each hold? | ||
7. What does putting someone out take with them: credentials, the OAuth | ||
7. What does removing someone take with them: credentials, the OAuth | ||
grants they approved, their MCP clients, their app passwords and | ||
sessions? | ||
8. How long does the host keep trying to deliver an invite to someone's | ||
.claude/skills/ui/SKILL.md+69−14
| @@ -48,6 +48,8 @@ the rest, once per kept world: | ||
- `long`: a group of dan's with the longest handle, name, words, link | ||
and rule the host takes; frank asking with a long note. | ||
- `waiting`: bob asking to join Riders; carol invited to it. | ||
- `apps`: an app signed in to Riders with alice's app password | ||
"Phone", having posted as it, and taken a post down. | ||
| ||
A state none of them makes is a seed of your own: a module that writes | ||
it, `--seed path/to/it.mjs` (the top of `harness/look/look.mjs` says | ||
| @@ -78,7 +80,7 @@ harness/layers.mjs` holds each to its layer: | ||
- `atoms`: one element (`Avatar`, `Tag`, `Copy`). | ||
- `molecules`: a few atoms that mean something together (`Section`, | ||
`Empty`, `Dialog`, `FormDialog`, `ConfirmDialog`, `Tabs`, `UserMenu`, | ||
`MemberRow`, `GroupRow`, `HandleInput`). | ||
`MemberRow`, `Person`, `GroupRow`, `HandleInput`). | ||
- `organisms`: a part of a page (`MemberList`, `GroupCard`, | ||
`SiteHeader`, `RulesEditor`). | ||
- `templates`: a page's layout, without its data (`Page`, `GroupPage`, | ||
| @@ -145,12 +147,12 @@ sit closer than things that do not: a heading to its list, less than the | ||
list to the next part. | ||
| ||
**Weight.** One primary button on a view at most, for the act the view | ||
is for (Start a group, Join, Save the profile, a dialog's act). What | ||
undoes, removes or turns down is `class="quiet"` (Leave, Take back, | ||
Turn down, Cancel, Sign out), and a quiet button never outweighs what it | ||
is for (Start a group, Join, Save, a dialog's act). What undoes, | ||
removes or declines is `class="quiet"` (Leave, Cancel invite, Decline, | ||
Cancel, Sign out), and a quiet button never outweighs what it | ||
sits beside: leaving a group is a small quiet button at the end of the | ||
member's standing, never the loudest thing on the card. A list whose | ||
rows each wait on an act (letting someone in, taking up an invite) may | ||
rows each wait on an act (approving a request, joining from an invite) may | ||
carry it on each row, `small`, the one thing in the row that is not | ||
quiet. What cannot be undone is `class="danger"`, and only as the act of | ||
a `ConfirmDialog`. A link that goes where a button would act (Start a | ||
| @@ -171,12 +173,13 @@ controls. | ||
editing what is already there field by field (a group's profile, who | ||
sees it) is a form in place, and finding (a search box) is never a | ||
dialog. A handle is typed into `HandleInput`, wherever it is asked for. | ||
- *Confirming.* An act that cannot be undone (leaving, putting someone | ||
out, taking a rule, role or key away, revoking, ending an app's | ||
access, disconnecting) opens a `ConfirmDialog`: its title the question | ||
("Leave Riders?"), what will happen in a sentence, a quiet Cancel, and | ||
the act in `danger`. What is undone by doing it again (taking back an | ||
invite, taking a picture away) needs no asking. | ||
- *Confirming.* An act that cannot be undone (leaving, removing | ||
someone, deleting a rule or role, removing a key, revoking, | ||
disconnecting) opens a `ConfirmDialog`: its title the question | ||
("Leave Riders?", "Delete this rule?"), what will happen in a | ||
sentence, a quiet Cancel, and the act in `danger`, its verb alone | ||
("Delete"). What is undone by doing it again (cancelling an invite, | ||
removing a picture, declining an invite) needs no asking. | ||
- *Lists.* `ul` or `ol` with a class, a row per thing, inside the part's | ||
card: its `Avatar`, `ordinal` or picture first; its name, and under it | ||
what is said about it (`.row-main` with `.what`); its acts at the | ||
| @@ -187,18 +190,68 @@ controls. | ||
more, a page at a time, never every row at once. | ||
- *A part's heading.* `Section`: its title, with its count when that is | ||
worth saying, and the one act on the whole part (Invite someone, Add a | ||
rule, Make an app password) across from it, as a quiet button; never | ||
rule, Create an app password) across from it, as a quiet button; never | ||
a link or a button lower down the card doing the same. | ||
- *Where to go.* A group's own pages (Moderation, Settings) sit together | ||
beside its name, as quiet small `a.button`s; a page under a group says | ||
so with `Page`'s `back`, its name, above its heading. | ||
| ||
**Verbs.** The words people know from other apps, the same everywhere: | ||
| ||
- **Delete** a thing the group made and owns: a rule, a role. | ||
- **Remove** something or someone from a list: a member ("Remove | ||
@bob.test from Riders?"), a link, a picture, a key. | ||
- **Cancel** what you sent and can call back: an invite ("Cancel | ||
invite"), your request ("Cancel request"). | ||
- **Approve** or **Decline** someone else's request, or an invite to you. | ||
- **Revoke** access: an app's, an app password. | ||
- **Create** a new thing that is then listed (a role, an app password); | ||
**Add** one to a list (a rule, a link, a key); **Save** changes made | ||
in place, and as a dialog's act, the verb alone ("Create", "Add", | ||
"Save"). | ||
- Kept as they are: Send invite, Send request, Join, Leave the group, | ||
Disconnect. | ||
| ||
Never "take away", "take back", "put out", "turn down", "let in", "take | ||
off" or "end access". The names of commands, tools and lexicons | ||
(`eject`, `--undo`) stay as they are. | ||
| ||
**Plain words.** Every string on a page reads as a normal app's would: | ||
short, concrete, in the second person, friendly without chatter. What | ||
gives writing away as a machine's | ||
([Signs of AI writing](https://en.wikipedia.org/wiki/Wikipedia:Signs_of_AI_writing)), | ||
and is never written here: | ||
| ||
- triplets ("Its chat, its calendar, its site: …"); | ||
- colon chains, an "X: Y" where a sentence does ("Copy it now: it is | ||
not shown again"); | ||
- negative parallels, "not X, but Y"; | ||
- the elliptical "who may" ("someone who may lets them in"): say who, | ||
and what they do ("an admin approves them"); | ||
- an abstract noun for a person ("Whoever asks shows here"); | ||
- a line under a heading that says the heading again; | ||
- default microcopy ("No items found", "Submit", "Try again later") | ||
where a line of this page's own fits; | ||
- the stock words: seamless, effortless, simply, robust, delve, | ||
leverage, crucial; em dashes; emoji. | ||
| ||
As it should read: | ||
| ||
- "Its members alone: to others, just its handle" → "Members only. | ||
Others see just its handle." | ||
- "Whoever asks shows here, with their note." → "Requests to join show | ||
up here." | ||
- "Copy it now: it is not shown again." → "Copy it now. You won't see | ||
it again." | ||
- "It can't have that address here: choose another." → "That address | ||
is taken. Try another." | ||
| ||
**Pictures.** `Avatar` is given the name of whom it draws: with no | ||
picture, it draws their initial on a hue their name gives them, never a | ||
blank disc. A group with no banner shows no banner block: its picture, | ||
name and nav sit at the top of its card. | ||
| ||
**People.** A person is their avatar and handle, by `MemberRow` or the | ||
**People.** A person is their avatar and handle, by `MemberRow` (a row), `Person` (in a line of text) or the | ||
header's menu, never a bare DID where a handle is known. | ||
| ||
## Critique | ||
| @@ -209,7 +262,9 @@ tool, a fresh one, given the paths under `target/look` (and a sibling | ||
page's), this file's House rules, and only this question: "What looks | ||
wrong, out of place, or unlike its siblings here? Be specific: element, | ||
what is wrong, which rule." Not the code, nor what you meant: it judges | ||
what is drawn. Fix what it finds, or say in the pull why not. | ||
what is drawn. Ask it, too, to read every string it can see against | ||
"Verbs" and "Plain words". Fix what it finds, or say in the pull why | ||
not. | ||
| ||
## Then | ||
| ||
crates/group-host/src/actors.rs+12−0
| @@ -14,6 +14,7 @@ use axum::Json; | ||
use axum::extract::{Query, State}; | ||
use axum::http::{HeaderMap, StatusCode}; | ||
use serde_json::{Value, json}; | ||
use std::collections::{BTreeSet, HashMap}; | ||
use std::sync::Arc; | ||
| ||
type Answer = Result<Json<Value>, XrpcError>; | ||
| @@ -43,6 +44,17 @@ impl Host { | ||
} | ||
} | ||
| ||
/// Each of `dids` as a list names them, each DID read once however | ||
/// often it comes. | ||
pub(crate) async fn actor_views<'a>( | ||
&self, | ||
dids: impl IntoIterator<Item = &'a str>, | ||
) -> HashMap<String, Value> { | ||
let dids: BTreeSet<&str> = dids.into_iter().collect(); | ||
let views = futures::future::join_all(dids.iter().map(|d| self.actor_view(d))).await; | ||
dids.into_iter().map(String::from).zip(views).collect() | ||
} | ||
| ||
/// A group as a list of someone's shows it, to `viewer`, a member: its | ||
/// name and picture as they may read them, and how many are in it. | ||
fn group_view_basic(&self, group: &str, viewer: &str) -> Answer { | ||
crates/group-host/src/app_passwords.rs+9−1
| @@ -409,9 +409,16 @@ pub async fn list_app_passwords( | ||
.grants_of(group, now_millis()) | ||
.map_err(XrpcError::internal)?; | ||
let held = host.app_passwords(group)?; | ||
let held: Vec<_> = held | ||
.into_iter() | ||
.filter(|p| configures || p.member == me) | ||
.collect(); | ||
// Whose each is, by their handle where it can be read. | ||
let actors = host | ||
.actor_views(held.iter().map(|p| p.member.as_str())) | ||
.await; | ||
let passwords: Vec<Value> = held | ||
.iter() | ||
.filter(|p| configures || p.member == me) | ||
.map(|p| { | ||
let client = app_password_client(&p.name); | ||
let used = sessions | ||
| @@ -422,6 +429,7 @@ pub async fn list_app_passwords( | ||
let mut view = json!({ | ||
"name": p.name, | ||
"member": p.member, | ||
"actor": actors[&p.member], | ||
"privileged": p.privileged, | ||
"createdAt": iso(p.created_at), | ||
}); | ||
crates/group-host/src/group_tokens.rs+56−6
| @@ -231,6 +231,36 @@ pub async fn get_group_auth( | ||
}))) | ||
} | ||
| ||
/// What a write in the group's log was, as its words say it (`created | ||
/// <collection>/<rkey> in <space>`): its operation, the record's | ||
/// collection and key, the space, if it was in one, and the DID of whom | ||
/// it is about, if any: a record kept under someone's DID (a | ||
/// membership), or one written in their inbox (an invite). Nothing, for | ||
/// what was not a write. | ||
fn write_of(action: &str) -> Option<(Value, Option<String>)> { | ||
let (done, rest) = action.split_once(' ')?; | ||
let at = ["created", "updated", "deleted"] | ||
.iter() | ||
.position(|d| *d == done)?; | ||
let (path, space) = rest | ||
.split_once(" in ") | ||
.map_or((rest, None), |(p, s)| (p, Some(s))); | ||
let (collection, rkey) = path.split_once('/')?; | ||
let inbox = space.and_then(|s| SpaceRef::parse(s).ok()).filter(is_inbox); | ||
let about = rkey.starts_with("did:").then(|| rkey.to_string()); | ||
let about = about.or(inbox.map(|s| s.authority)); | ||
let operation = ["create", "update", "delete"][at]; | ||
let mut write = json!({ | ||
"operation": operation, | ||
"collection": collection, | ||
"rkey": rkey, | ||
}); | ||
if let Some(space) = space { | ||
write["space"] = json!(space); | ||
} | ||
Some((write, about)) | ||
} | ||
| ||
/// Every grant that acts as the group, and what grants did lately, for | ||
/// one who configures it. | ||
pub async fn list_group_tokens( | ||
| @@ -245,6 +275,19 @@ pub async fn list_group_tokens( | ||
.store | ||
.grants_of(group, now_millis()) | ||
.map_err(XrpcError::internal)?; | ||
let log = host | ||
.store | ||
.activity(group, ACTIVITY_SHOWN) | ||
.map_err(XrpcError::internal)?; | ||
let writes: Vec<_> = log.iter().map(|a| write_of(&a.action)).collect(); | ||
// Whom each names, by their handle where it can be read. | ||
let members = grants.iter().map(|g| g.member.as_str()); | ||
let members = members.chain(log.iter().map(|a| a.member.as_str())); | ||
let abouts = writes | ||
.iter() | ||
.flatten() | ||
.filter_map(|(_, about)| about.as_deref()); | ||
let actors = host.actor_views(members.chain(abouts)).await; | ||
let sessions: Vec<Value> = grants | ||
.iter() | ||
.map(|g| { | ||
| @@ -252,6 +295,7 @@ pub async fn list_group_tokens( | ||
"tokenId": g.id, | ||
"clientId": g.client_id, | ||
"member": g.member, | ||
"actor": actors[&g.member], | ||
"source": g.source, | ||
"scope": g.scope, | ||
"grantedAt": iso(g.created_at), | ||
| @@ -263,17 +307,23 @@ pub async fn list_group_tokens( | ||
view | ||
}) | ||
.collect(); | ||
let log = host | ||
.store | ||
.activity(group, ACTIVITY_SHOWN) | ||
.map_err(XrpcError::internal)?; | ||
let activity: Vec<Value> = log | ||
.iter() | ||
.map(|a| { | ||
let mut view = json!({"member": a.member, "action": a.action, "at": iso(a.at)}); | ||
.zip(writes) | ||
.map(|(a, write)| { | ||
let actor = &actors[&a.member]; | ||
let mut view = | ||
json!({"member": a.member, "actor": actor, "action": a.action, "at": iso(a.at)}); | ||
if let Some(client) = &a.client_id { | ||
view["clientId"] = json!(client); | ||
} | ||
// A write, said as its parts, and whom it is about. | ||
if let Some((write, about)) = write { | ||
view["write"] = write; | ||
if let Some(about) = about { | ||
view["subject"] = actors[&about].clone(); | ||
} | ||
} | ||
view | ||
}) | ||
.collect(); | ||
crates/group-host/tests/app_passwords.rs+1−0
| @@ -226,6 +226,7 @@ async fn is_made_by_whoever_may_do_anything_as_the_group() { | ||
let (_, own) = list(&h, &bob, &did).await; | ||
assert_eq!(names(&own), ["Laptop"]); | ||
assert_eq!(own["passwords"][0]["member"], bob.did.as_str()); | ||
assert_eq!(own["passwords"][0]["actor"]["did"], bob.did.as_str()); | ||
assert_eq!(list(&h, &carol, &did).await.0, 403); | ||
assert_eq!(list(&h, &alice, "did:plc:nothing").await.0, 400); | ||
} | ||
crates/group-host/tests/group_tokens.rs+31−0
| @@ -167,6 +167,34 @@ async fn gives_a_member_a_token_for_the_members_space_as_the_group_grants_them() | ||
.call(&h, "com.atproto.space.putRecord", token, Some(&body)) | ||
.await; | ||
assert_eq!(said.status, 200, "{}", said.body); | ||
// Bob made a member with it; the log says each write in its parts, | ||
// and whom a membership is about. | ||
let made = json!({"$type": c("membership"), "member": bob.did, "roles": ["member"], "createdAt": "2026-11-05T00:00:00Z"}); | ||
let body = json!({"repo": did, "space": members, "collection": c("membership"), "rkey": bob.did, "record": made}); | ||
let said = app | ||
.call(&h, "com.atproto.space.putRecord", token, Some(&body)) | ||
.await; | ||
assert_eq!(said.status, 200, "{}", said.body); | ||
let lxm = format!("{NS}.listGroupTokens"); | ||
let (_, listed) = get(&h, &lxm, &format!("group={did}"), &[auth(&h, &alice, &lxm)]).await; | ||
let [membership, role] = [&listed["activity"][0], &listed["activity"][1]]; | ||
assert_eq!( | ||
membership["write"], | ||
json!({"operation": membership["write"]["operation"], "collection": c("membership"), "rkey": bob.did, "space": members}) | ||
); | ||
assert_eq!(membership["subject"]["did"], bob.did.as_str()); | ||
assert_eq!( | ||
( | ||
&role["write"]["collection"], | ||
&role["write"]["rkey"], | ||
role.get("subject") | ||
), | ||
(&json!(c("role")), &json!("leader"), None) | ||
); | ||
// What was not a write has no parts. | ||
let took = &listed["activity"][2]; | ||
assert!(took["action"].as_str().unwrap().starts_with("took a token")); | ||
assert_eq!(took.get("write"), None); | ||
// A member the group grants nothing writes nothing there. | ||
let said = group_auth(&h, &app, &bob, &json!({"group": did, "space": members})).await; | ||
assert_eq!(said.error(), (403, "Forbidden")); | ||
| @@ -249,6 +277,8 @@ async fn shows_its_configurers_who_acts_as_the_group_and_lets_them_end_it() { | ||
let oauth = sessions.iter().find(|s| s["source"] == "oauth").unwrap(); | ||
assert_eq!(oauth["clientId"], app.id.as_str()); | ||
assert_eq!(oauth["member"], alice.did.as_str()); | ||
// Each names whom by their handle, where it can be read. | ||
assert_eq!(oauth["actor"]["did"], alice.did.as_str()); | ||
assert_eq!(oauth["scope"], "atproto repo:app.bsky.feed.post"); | ||
assert!(oauth["lastUsedAt"].is_string() && oauth["grantedAt"].is_string()); | ||
let groups = sessions | ||
| @@ -272,6 +302,7 @@ async fn shows_its_configurers_who_acts_as_the_group_and_lets_them_end_it() { | ||
] | ||
); | ||
assert_eq!(listed["activity"][1]["clientId"], app.id.as_str()); | ||
assert_eq!(listed["activity"][1]["actor"]["did"], alice.did.as_str()); | ||
| ||
// Only for its configurers. | ||
assert_eq!(list(&bob, &did).await.0, 403); | ||
docs/design/mcp.md+1−1
| @@ -144,7 +144,7 @@ Disconnecting a client with `revokeConnectedApp` ends every connection | ||
the member made with that client in that group, and its tokens with it. | ||
A connection also ends when: | ||
| ||
- the member is put out of the group, by ejection or by leaving; | ||
- 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. | ||
docs/design/membership.md+16−5
| @@ -58,6 +58,12 @@ 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 | ||
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. | ||
| ||
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 | ||
| @@ -131,7 +137,7 @@ holds `member` (`MemberRole`), and names only roles the group defines. | ||
away must be one the writer's `role.assign` grants may assign. A | ||
request of theirs still waiting goes. | ||
- Deleting one puts the member out, if each role they hold is one the | ||
writer's `eject` grants may assign ([below](#leaving-and-being-put-out)). | ||
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 | ||
| @@ -215,7 +221,12 @@ 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`. | ||
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. | ||
| ||
Details: | ||
| ||
| @@ -223,7 +234,7 @@ Details: | ||
must be still to come. | ||
- An invite's message is 2,000 characters at most. | ||
| ||
## Leaving and being put out | ||
## Leaving and being removed | ||
| ||
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 | ||
| @@ -238,7 +249,7 @@ is one the ejecter's `eject` grants may assign. Either way the host: | ||
| ||
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. | ||
Put out, the rest follows the write; deleting a membership that is gone | ||
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.notifyCredentialRevoked`, best effort. | ||
| @@ -246,7 +257,7 @@ 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) | ||
queue, as an `ejectEvent` on the member's DID, with who put them out. | ||
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 | ||
docs/design/moderation.md+1−1
| @@ -108,7 +108,7 @@ it as `createdBy`, and one of four kinds as `event`: | ||
- `labelEvent`: a label was written, by the label record's `uri` and its | ||
`val`. A negation is a label taken back, so it is answered with | ||
`deleted: true` and the negating record's `uri`. | ||
- `ejectEvent`: the member was put out of the group, their membership | ||
- `ejectEvent`: the member was removed from the group, their membership | ||
deleted. It says nothing more. | ||
| ||
A subject enters the queue with its first report, label or ejection, | ||