~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

Invites are records the group writes in the invitee's inbox

Merged chadtmiller.com asked to merge into main from chadtmiller.com/group-host:proposal/writes-invites
crates/atproto/src/lib.rs+1−0
@@ -24,6 +24,7 @@ pub mod space;
pub mod space_auth;
pub mod syntax;
pub mod tid;
pub mod time;
pub use cid::Cid;
pub use commit::Commit;
crates/atproto/src/time.rsnew+26−0
@@ -0,0 +1,26 @@
//! Times as atproto writes them: ISO 8601 in UTC, to the millisecond.
use std::time::{SystemTime, UNIX_EPOCH};
/// Milliseconds since 1970.
pub fn now_millis() -> i64 {
let since = SystemTime::now().duration_since(UNIX_EPOCH);
since.expect("after 1970").as_millis() as i64
}
/// `millis` since 1970 as `2026-11-03T21:14:28.123Z`.
pub fn iso(millis: i64) -> String {
let (days, ms) = (millis.div_euclid(86_400_000), millis.rem_euclid(86_400_000));
// Howard Hinnant's days_to_civil, for the proleptic Gregorian calendar.
let z = days + 719_468;
let era = z.div_euclid(146_097);
let doe = z.rem_euclid(146_097);
let yoe = (doe - doe / 1460 + doe / 36_524 - doe / 146_096) / 365;
let doy = doe - (365 * yoe + yoe / 4 - yoe / 100);
let mp = (5 * doy + 2) / 153;
let day = doy - (153 * mp + 2) / 5 + 1;
let month = if mp < 10 { mp + 3 } else { mp - 9 };
let year = yoe + era * 400 + i64::from(month <= 2);
let (h, m, s, f) = (ms / 3_600_000, ms / 60_000 % 60, ms / 1000 % 60, ms % 1000);
format!("{year:04}-{month:02}-{day:02}T{h:02}:{m:02}:{s:02}.{f:03}Z")
}
crates/group-host/src/assistants.rs+6−1
@@ -692,13 +692,18 @@ fn query_of(args: &Value) -> Vec<(String, String)> {
impl Host {
/// Calls `tool` with `args` as `who`, in their group: as the console
/// does, the host asking itself as them.
/// does, the host asking itself as them. A tool that writes an invite
/// makes the write their own session for the group would.
async fn call_as(
self: &Arc<Self>,
who: &Connected,
tool: Tool,
mut args: Value,
) -> Result<Value, String> {
if tool.nsid.starts_with("com.atproto.space.") {
let made = self.invite_as(who, &tool.name, &args).await;
return made.map_err(|e| format!("{}: {}", e.error, e.message));
}
args["group"] = json!(who.group);
let cookie = self.session_cookie(&who.member, now_millis());
let cookie = format!("{}={cookie}", crate::console_login::COOKIE);
crates/group-host/src/group_invites.rs+191−79
@@ -1,26 +1,32 @@
//! Invites. A group invites someone by writing an invite in its own repo
//! in the invitee's inbox: a space under the invitee's own DID, at their
//! PDS, which lets this host say who may write there
//! (`com.atproto.managedspace.checkUserAccess`). The invitee's apps read
//! it there; the host keeps its own list of what it sent, which is what
//! redeems an invite, as the inbox is its owner's to read, not the
//! group's.
//! (`com.atproto.managedspace.checkUserAccess`). An app writes it as the
//! group, through `com.atproto.space.*` with a session for the group, and
//! takes it back by deleting it. The invitee's apps read it there; the
//! host keeps its own list of what it sent, which is what redeems an
//! invite, as the inbox is its owner's to read, not the group's.
//!
//! An invite is redeemed by asking to join: admitted at once, whatever
//! the group's join policy, with its default roles.
use crate::Host;
use crate::api::{Params, invalid, page, param};
use crate::assistants::Connected;
use crate::group::meta_space;
use crate::group_api::{caller, group_of, signed_in};
use crate::group_members::acting;
use crate::group_members::{Members, acting};
use crate::lexicons::check_record;
use crate::oauth_resource::Acting;
use crate::oauth_store::Grant;
use crate::rbac::NS;
use crate::repo::Write;
use crate::scopes::Permissions;
use crate::store::Invite;
use crate::time::{iso, now_millis};
use crate::token_writes::{action, missing, no_longer};
use crate::xrpc::XrpcError;
use atproto::space::SpaceRef;
use atproto::syntax;
use axum::Json;
use axum::extract::{Query, State};
use axum::http::{HeaderMap, StatusCode};
@@ -187,61 +193,188 @@ impl Host {
}
}
/// Invites someone, for one holding `invite`: an invite written in the
/// group's repo in their inbox, told to their PDS. One already waiting is
/// the one answered.
pub async fn create_invite(
State(host): State<Arc<Host>>,
headers: HeaderMap,
Json(body): Json<Value>,
) -> Answer {
let (members, me, _) = acting(&host, &headers, &body, "createInvite", Some("invite")).await?;
let invitee = body["invitee"].as_str().expect("its lexicon requires it");
if members.membership(invitee)?.is_some() {
return Err(bad("AlreadyMember", "they are a member already"));
}
let expires_at = match body["expiresAt"].as_str() {
Some(at) => Some(millis_of(at).ok_or_else(|| invalid("expiresAt is a datetime"))?),
None => None,
};
// One that has lapsed already could admit nobody.
if expires_at.is_some_and(|at| at <= now_millis()) {
return Err(invalid("expiresAt is a time to come"));
}
let message = body["message"].as_str();
let group = members.group.clone();
// One waiting is the one answered; one lapsed is taken back, and a
// fresh one written.
if let Some(waiting) = host.waiting_invite(&group, invitee).await? {
return Ok(Json(json!({ "uri": invite_uri(&waiting) })));
/// Whether `space` is someone's inbox, where groups write invites to them.
pub fn is_inbox(space: &SpaceRef) -> bool {
space.kind == format!("{NS}.invites")
}
/// The scope a group's session takes to write invites in `inbox`, and
/// only there.
pub(crate) fn inviting_scope(inbox: &SpaceRef) -> String {
format!(
"atproto space:{NS}.invites?authority={}&skey={}&collection={NS}.invite&action=create&action=update&action=delete",
inbox.authority, inbox.skey
)
}
impl Host {
/// Makes `writes` in someone's inbox as the group, with `acting`'s
/// session: one invite at a time, as [`Host::write_invite`] has it.
pub(crate) async fn write_invites(
&self,
acting: &Acting,
inbox: &SpaceRef,
writes: Vec<Write>,
) -> Result<Vec<Write>, XrpcError> {
let Ok([write]) = <[Write; 1]>::try_from(writes) else {
return Err(invalid("an inbox takes one invite write at a time"));
};
Ok(vec![self.write_invite(acting, inbox, write).await?])
}
let invite = Invite {
seq: 0,
group: group.clone(),
invitee: invitee.into(),
by: me.clone(),
message: message.map(String::from),
rkey: host.clock.next(),
created_at: now_millis(),
expires_at,
};
let mut record = json!({"$type": format!("{NS}.invite"), "createdAt": iso(invite.created_at)});
if let Some(m) = &invite.message {
record["message"] = json!(m);
/// Writes an invite in the group's repo in someone's inbox, or deletes
/// one, with `acting`'s session, for a member whose roles hold
/// `invite`: the write as made, told to the inbox's authority.
///
/// A group has one invite to each person at a time. Written while one
/// waits, it is that one answered, unless it is written at that one's
/// key, which replaces it. An invite is for someone not yet a member,
/// and lapses, if it does, at a time still to come. Deleted, it is
/// taken back. The host's own list of invites, which redeems them,
/// keeps in step.
pub(crate) async fn write_invite(
&self,
acting: &Acting,
inbox: &SpaceRef,
write: Write,
) -> Result<Write, XrpcError> {
let (group, member) = (&acting.grant.group, &acting.grant.member);
let kind = format!("{NS}.invite");
let (collection, rkey) = write.path();
if collection != kind || inbox.skey != "self" {
let only = format!("an inbox, at self, holds {kind} records, and no other");
return Err(invalid(only));
}
let asked = action(&write);
if !acting.permissions.space(inbox, Some(collection), asked) {
let scope = format!("space:{}?collection={kind}&action={asked}", inbox.kind);
return Err(missing(scope));
}
if !self.may_do(group, member, "invite")? {
return Err(no_longer(collection));
}
let (invitee, uri) = (&inbox.authority, inbox.to_string());
let waiting = self.waiting_invite(group, invitee).await?;
let Some(value) = write.value() else {
let named = waiting.filter(|w| w.rkey == rkey);
let invite = named.ok_or_else(|| bad("InviteNotFound", "no invite to them waits"))?;
self.take_back(&invite).await?;
self.wrote(acting, Some(&uri), std::slice::from_ref(&write))?;
return Ok(write);
};
check_record(collection, value)?;
if Members::of(self, group)?.membership(invitee)?.is_some() {
return Err(bad("AlreadyMember", "they are a member already"));
}
let expires_at = match value["expiresAt"].as_str() {
Some(at) => Some(millis_of(at).ok_or_else(|| invalid("expiresAt is a datetime"))?),
None => None,
};
// One that has lapsed already could admit nobody.
if expires_at.is_some_and(|at| at <= now_millis()) {
return Err(invalid("expiresAt is a time to come"));
}
if let Some(other) = waiting.as_ref().filter(|w| w.rkey != rkey) {
let record = self.group_record(group, &uri, &kind, &other.rkey);
let record = record.map_err(XrpcError::internal)?.unwrap_or_default();
let (collection, rkey) = (kind, other.rkey.clone());
return Ok(Write::Create {
collection,
rkey,
value: record,
});
}
let (collection, rkey, value) = (kind, rkey.to_string(), value.clone());
let message = value["message"].as_str().map(String::from);
let made = match &waiting {
Some(_) => Write::Update {
collection,
rkey: rkey.clone(),
value,
},
None => Write::Create {
collection,
rkey: rkey.clone(),
value,
},
};
let written = self.space_write(group, &uri, std::slice::from_ref(&made));
written.await?;
if waiting.is_some() {
let replaced = self.store.uninvite(group, invitee);
replaced.map_err(XrpcError::internal)?;
}
let invite = Invite {
seq: 0,
group: group.clone(),
invitee: invitee.clone(),
by: member.clone(),
message,
rkey,
created_at: now_millis(),
expires_at,
};
self.store.invite(&invite).map_err(XrpcError::internal)?;
self.wrote(acting, Some(&uri), std::slice::from_ref(&made))?;
Ok(made)
}
if let Some(at) = body["expiresAt"].as_str() {
record["expiresAt"] = json!(at);
/// What an assistant's invite tool does, as the member who connected
/// it, in their group: the write the member's own group session for
/// the invitee's inbox would make (`sendInvite`, or `takeBackInvite`
/// for the one waiting), logged as the assistant's. The invite's URI.
pub(crate) async fn invite_as(
&self,
who: &Connected,
tool: &str,
args: &Value,
) -> Result<Value, XrpcError> {
let invitee = args["invitee"].as_str().unwrap_or_default();
let inbox = SpaceRef::parse(&inbox_of(invitee)).map_err(|e| invalid(e.to_string()))?;
let now = now_millis();
let grant = Grant {
id: format!("assistant-{}", who.id),
group: who.group.clone(),
member: who.member.clone(),
client_id: who.client_id.clone(),
client_auth: json!({}),
scope: inviting_scope(&inbox),
dpop_jkt: String::new(),
access_expires: now,
expires_at: now,
created_at: now,
source: "assistant".into(),
used_at: None,
};
let permissions = Permissions::new(&grant.scope, &grant.group);
let acting = Acting { grant, permissions };
let collection = format!("{NS}.invite");
let write = match tool {
"sendInvite" => {
let mut value = json!({"$type": collection, "createdAt": iso(now)});
for field in ["message", "expiresAt"] {
if let Some(given) = args.get(field) {
value[field] = given.clone();
}
}
let rkey = self.clock.next();
Write::Create {
collection,
rkey,
value,
}
}
_ => {
let waiting = self.store.invited(&who.group, invitee);
let waiting = waiting.map_err(XrpcError::internal)?;
let rkey = waiting.map(|w| w.rkey).unwrap_or_default();
Write::Delete { collection, rkey }
}
};
let made = self.write_invite(&acting, &inbox, write).await?;
let rkey = made.path().1;
Ok(json!({"uri": format!("{inbox}/{}/{NS}.invite/{rkey}", who.group)}))
}
let write = Write::Create {
collection: format!("{NS}.invite"),
rkey: invite.rkey.clone(),
value: record,
};
let inbox = inbox_of(invitee);
let written = host.space_write(&group, &inbox, std::slice::from_ref(&write));
written.await?;
host.store.invite(&invite).map_err(XrpcError::internal)?;
Ok(Json(json!({ "uri": invite_uri(&invite) })))
}
/// The group's invites waiting, newest first, for one holding `invite`.
@@ -272,27 +405,6 @@ pub async fn list_invites(
Ok(Json(json!({"invites": invites, "cursor": cursor})))
}
/// Takes back an invite, by its URI, for one holding `invite`.
pub async fn revoke_invite(
State(host): State<Arc<Host>>,
headers: HeaderMap,
Json(body): Json<Value>,
) -> Answer {
let (members, _, _) = acting(&host, &headers, &body, "revokeInvite", Some("invite")).await?;
let uri = body["uri"].as_str().expect("its lexicon requires it");
let invitee = uri.strip_prefix("at://").and_then(|r| r.split('/').next());
let invitee = invitee
.filter(|d| syntax::is_did(d))
.ok_or_else(|| invalid("not an invite's URI"))?;
let invited = host
.store
.invited(&members.group, invitee)
.map_err(XrpcError::internal)?;
let invite = invited.ok_or_else(|| bad("InviteNotFound", "no invite to them waits"))?;
host.take_back(&invite).await?;
Ok(Json(json!({})))
}
/// The caller's own invites waiting, from the groups here, newest first;
/// with `group`, that group's only.
pub async fn get_actor_invites(
crates/group-host/src/group_tokens.rs+42−13
@@ -15,6 +15,7 @@ use crate::Host;
use crate::api::{Params, invalid, param};
use crate::group::members_space;
use crate::group_api::{group_of, signed_in};
use crate::group_invites::{inviting_scope, is_inbox};
use crate::oauth_resource::Refusal;
use crate::oauth_scope::writes_in;
use crate::oauth_store::{Grant, Tokens};
@@ -41,6 +42,10 @@ fn forbidden(message: impl Into<String>) -> XrpcError {
XrpcError::new(StatusCode::FORBIDDEN, "Forbidden", message)
}
/// A group token's scope, and the kinds of record it writes in its space
/// and in the group's repo.
type Authed = Result<(String, Vec<String>, Vec<String>), Refusal>;
fn objects(field: &str, items: impl IntoIterator<Item = impl Into<String>>) -> Value {
items
.into_iter()
@@ -75,6 +80,34 @@ impl Host {
Ok(out)
}
/// What a group token for `space`, one of the group's, carries for
/// `member`: its scope, and the kinds of record it writes there and in
/// the group's repo.
fn space_auth(&self, group: &str, member: &str, space: &SpaceRef) -> Authed {
let uri = space.to_string();
let roles = self.roles(group, member).map_err(XrpcError::internal)?;
let access = self.group_record(group, &uri, &format!("{NS}.access"), "self");
let access = access.map_err(XrpcError::internal)?.unwrap_or_default();
let everything = self.may_issue(group, member)?;
let writes = writes_in(&Access::of(&access, &uri), &roles, member, everything);
if writes.is_empty() {
return Err(forbidden("no role of yours may act as the group in this space").into());
}
let collections: Vec<String> = writes.keys().cloned().collect();
let scope = scopes_for(space, &writes).join(" ");
Ok((scope, collections.clone(), collections))
}
/// What a group token for `inbox`, someone's, carries for `member`:
/// the invites they may write there as the group, if they may invite.
fn inbox_auth(&self, group: &str, member: &str, inbox: &SpaceRef) -> Authed {
if !self.may_do(group, member, "invite")? {
return Err(forbidden("no role of yours may invite").into());
}
let invites = vec![format!("{NS}.invite")];
Ok((inviting_scope(inbox), invites, Vec::new()))
}
/// `member`'s standing to act as `group`: may they configure it?
fn configures(&self, group: &str, member: &str) -> Result<(), XrpcError> {
group_of(self, group)?;
@@ -120,21 +153,18 @@ pub async fn get_group_auth(
let uri = body["space"].as_str().expect("its lexicon requires it");
group_of(&host, group)?;
host.active(group)?;
let space = SpaceRef::parse(uri).ok().filter(|s| s.authority == group);
let parsed = SpaceRef::parse(uri).ok();
let inbox = parsed.clone().filter(is_inbox);
let space = parsed.filter(|s| s.authority == group || inbox.is_some());
let space = space.ok_or_else(|| invalid("not one of this group's spaces"))?;
let now = now_millis();
let proof = host.dpop_proof(&headers, "POST", &format!("/xrpc/{nsid}"), None, now);
let proof = proof.map_err(|e| host.refuse(e.error, e.description))?;
let proof = proof.ok_or_else(|| host.refuse("invalid_dpop_proof", "DPoP proof required"))?;
let roles = host.roles(group, &me).map_err(XrpcError::internal)?;
let access = host.group_record(group, uri, &format!("{NS}.access"), "self");
let access = access.map_err(XrpcError::internal)?.unwrap_or_default();
let everything = host.may_issue(group, &me)?;
let writes = writes_in(&Access::of(&access, uri), &roles, &me, everything);
if writes.is_empty() {
return Err(forbidden("no role of yours may act as the group in this space").into());
}
let scope = scopes_for(&space, &writes).join(" ");
let (scope, collections, published) = match inbox {
Some(inbox) => host.inbox_auth(group, &me, &inbox)?,
None => host.space_auth(group, &me, &space)?,
};
let access_token = jose::random(32);
let tokens = Tokens {
access_hash: &jose::sha256(&access_token),
@@ -163,13 +193,12 @@ pub async fn get_group_auth(
let took = format!("took a token for {uri}");
host.record(group, &me, Some(GROUP_AUTH_CLIENT), &took)
.map_err(XrpcError::internal)?;
let collections: Vec<&String> = writes.keys().collect();
Ok(Json(json!({
"did": group,
"accessJwt": access_token,
"pds": host.config.public_url,
"collections": objects("collection", collections.iter().map(|c| c.as_str())),
"repoCollections": objects("collection", collections.iter().map(|c| c.as_str())),
"collections": objects("collection", collections),
"repoCollections": objects("collection", published),
"scope": scope,
"expiresAt": iso(tokens.expires_at),
})))
crates/group-host/src/lexicons.rs+0−2
@@ -45,7 +45,6 @@ pub const FILES: &[&str] = &[
lexicon!("fyi/opensocial/configure"),
lexicon!("fyi/opensocial/createAppPassword"),
lexicon!("fyi/opensocial/createGroup"),
lexicon!("fyi/opensocial/createInvite"),
lexicon!("fyi/opensocial/createReport"),
lexicon!("fyi/opensocial/createSpace"),
lexicon!("fyi/opensocial/deactivateGroup"),
@@ -111,7 +110,6 @@ pub const FILES: &[&str] = &[
lexicon!("fyi/opensocial/revokeAppPassword"),
lexicon!("fyi/opensocial/revokeConnectedApp"),
lexicon!("fyi/opensocial/revokeGroupToken"),
lexicon!("fyi/opensocial/revokeInvite"),
lexicon!("fyi/opensocial/role"),
lexicon!("fyi/opensocial/rule"),
lexicon!("fyi/opensocial/space"),
crates/group-host/src/lib.rs+0−8
@@ -309,18 +309,10 @@ pub fn router(host: Arc<Host>) -> Router {
"/xrpc/fyi.opensocial.cancelJoinRequest",
post(group_join::cancel_join_request),
)
.route(
"/xrpc/fyi.opensocial.createInvite",
post(group_invites::create_invite),
)
.route(
"/xrpc/fyi.opensocial.listInvites",
get(group_invites::list_invites),
)
.route(
"/xrpc/fyi.opensocial.revokeInvite",
post(group_invites::revoke_invite),
)
.route(
"/xrpc/fyi.opensocial.getActorInvites",
get(group_invites::get_actor_invites),
crates/group-host/src/oauth_scope.rs+11−0
@@ -211,6 +211,8 @@ impl Host {
/// - `space:T?…`, where some space of the group's of type `T` lets the
/// roles write each collection asked for, as asked, as the group; or
/// read it, if reading is all it asks;
/// - `space:fyi.opensocial.invites?…`, people's inboxes, for roles that
/// may invite, as far as it asks for invites;
/// - `space:*?…`, made into one scope for each of the group's spaces
/// the roles read, writing there what they may of what it asks;
/// - `blob:`, beside anything above that writes.
@@ -237,6 +239,7 @@ impl Host {
let everything = repo.contains("*");
let held = actions_for(&grants, roles);
let rooms = self.rooms(group, roles, member, everything)?;
let invite = format!("{NS}.invite");
let (mut kept, mut made) = (Vec::new(), Vec::new());
for s in requested {
let space = SpaceScope::parse(s).filter(|w| w.for_group(group));
@@ -250,6 +253,8 @@ impl Host {
} else if let Some(m) = s.strip_prefix("rpc:") {
let method = m.split('?').next().unwrap_or_default();
everything && method != "*" && !method.starts_with(&format!("{NS}."))
} else if let Some(want) = inbox_scope(s) {
held.contains("invite") && want.collections.iter().all(|c| *c == invite)
} else if let Some(want) = space.as_ref().filter(|w| w.kind == "*") {
made.extend(any_kind(group, want, &rooms));
false
@@ -282,6 +287,12 @@ impl Host {
}
}
/// `scope`, if it is for people's inboxes, where a group writes its
/// invites: any inbox, or one person's.
fn inbox_scope(scope: &str) -> Option<SpaceScope> {
SpaceScope::parse(scope).filter(|w| w.kind == format!("{NS}.invites"))
}
/// Whether `room` lets the roles have the space scope `want`.
fn allows(want: &SpaceScope, room: &Room) -> bool {
if room.kind != want.kind || (want.skey != "*" && room.skey != want.skey) {
crates/group-host/src/rbac.rs+7−3
@@ -177,10 +177,9 @@ fn query_of(scope: &str, name: &str) -> Vec<String> {
}
/// The actions a host method's `rpc:` scope grants, by method.
const BY_METHOD: [(&str, &str); 7] = [
const BY_METHOD: [(&str, &str); 6] = [
("assignRoles", "role.assign"),
("ejectMember", "eject"),
("createInvite", "invite"),
("admitMember", "admit"),
("listSubjects", "mod.read"),
("resolveSubject", "mod.resolve"),
@@ -197,7 +196,7 @@ pub fn scope_of(action: &str) -> Option<String> {
"space.configure" => format!("space:*?collection={NS}.access"),
"role.assign" => rpc("assignRoles"),
"eject" => rpc("ejectMember"),
"invite" => rpc("createInvite"),
"invite" => format!("space:{NS}.invites?authority=*&collection={NS}.invite"),
"admit" => rpc("admitMember"),
"mod.read" => rpc("listSubjects"),
"mod.resolve" => rpc("resolveSubject"),
@@ -232,6 +231,11 @@ pub fn actions_of(scopes: &[String]) -> BTreeSet<&'static str> {
if let Some((_, action)) = action {
out.insert(*action);
}
} else if scope.starts_with(&format!("space:{NS}.invites?")) {
// Invites written in people's inboxes.
if query(scope, "collection").contains(&format!("{NS}.invite").as_str()) {
out.insert("invite");
}
} else if scope.starts_with("space:*") {
let manage = query(scope, "manage");
if manage.contains(&"create") {
crates/group-host/src/time.rs+2−25
@@ -1,26 +1,3 @@
//! Times as atproto writes them: ISO 8601 in UTC, to the millisecond.
//! Times as atproto writes them, from the primitives.
use std::time::{SystemTime, UNIX_EPOCH};
/// Milliseconds since 1970.
pub fn now_millis() -> i64 {
let since = SystemTime::now().duration_since(UNIX_EPOCH);
since.expect("after 1970").as_millis() as i64
}
/// `millis` since 1970 as `2026-11-03T21:14:28.123Z`.
pub fn iso(millis: i64) -> String {
let (days, ms) = (millis.div_euclid(86_400_000), millis.rem_euclid(86_400_000));
// Howard Hinnant's days_to_civil, for the proleptic Gregorian calendar.
let z = days + 719_468;
let era = z.div_euclid(146_097);
let doe = z.rem_euclid(146_097);
let yoe = (doe - doe / 1460 + doe / 36_524 - doe / 146_096) / 365;
let doy = doe - (365 * yoe + yoe / 4 - yoe / 100);
let mp = (5 * doy + 2) / 153;
let day = doy - (153 * mp + 2) / 5 + 1;
let month = if mp < 10 { mp + 3 } else { mp - 9 };
let year = yoe + era * 400 + i64::from(month <= 2);
let (h, m, s, f) = (ms / 3_600_000, ms / 60_000 % 60, ms / 1000 % 60, ms % 1000);
format!("{year:04}-{month:02}-{day:02}T{h:02}:{m:02}:{s:02}.{f:03}Z")
}
pub use atproto::time::{iso, now_millis};
crates/group-host/src/token_writes.rs+14−5
crates/group-host/tests/common/oauth.rs+57−0
crates/group-host/tests/assistants.rs+21−5
crates/group-host/tests/interop.rs+7−9
crates/group-host/tests/invites.rs+172−119
crates/group-host/tests/oauth_scope.rs+27−2
crates/group-host/tests/rbac.rs+2−0
crates/group-host-mcp/src/lib.rs+56−10
crates/group-host-mcp/tests/protocol.rs+19−1
crates/opensocial/src/lib.rs+147−12
crates/opensocial/Cargo.toml+1−0
docs/design/assistants.md+13−6
docs/design/membership.md+32−15
docs/design/signing-in.md+18−9
docs/reference/api.md+7−4
docs/reference/cli.md+3−2
docs/reference/mcp.md+9−1
harness/e2e/flows.spec.mjs+8−1
lexicons/fyi/opensocial/createInvite.jsondeleted+0−62
lexicons/fyi/opensocial/getGroupAuth.json+2−2
lexicons/fyi/opensocial/invite.json+1−1
lexicons/fyi/opensocial/manageMembers.json+1−3
lexicons/fyi/opensocial/revokeInvite.jsondeleted+0−44
web/src/lib/asGroup.tsnew+67−0
web/src/routes/g/[handle]/+page.server.ts+11−2
Cargo.lock+1−0