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

Two example apps: reading a group, and joining one

Merged chadtmiller.com asked to merge into main from chadtmiller.com/group-host:examples/apps
.claude/hooks/format.mjs+1−1
@@ -24,7 +24,7 @@ const run = (cmd, args) => {
if (path.endsWith('.rs')) {
run('rustup', ['run', 'stable', 'rustfmt', '--edition', '2024', path]);
} else if (
/^(web|harness|docs-site)\//.test(path) &&
/^(web|harness|docs-site|examples)\//.test(path) &&
!path.includes('node_modules/') &&
/\.(svelte|ts|js|mjs|cjs|css|json)$/.test(path)
) {
.knotless/workflows/web.yml+23−11
@@ -1,29 +1,31 @@
# The console's checks, as `just lint` runs them: that it, the harness and
# the docs site are formatted as `just fmt` leaves them (oxfmt), that each
# component uses only its own layer and those below (harness/layers.mjs),
# that every dialog's title is its own fixed words (harness/dialogs.mjs),
# that every word a page shows is a message (harness/strings.mjs), and
# svelte-check, which fails on any warning. The packages are kept between
# runs and installed again only when a lockfile changes.
# The console's checks, as `just lint` runs them: that it, the harness,
# the docs site and the examples are formatted as `just fmt` leaves them
# (oxfmt), that each component uses only its own layer and those below
# (harness/layers.mjs), that every dialog's title is its own fixed words
# (harness/dialogs.mjs), that every word a page shows is a message
# (harness/strings.mjs), and svelte-check, which fails on any warning;
# then that each example app still types against the lexicons. The
# packages are kept between runs and installed again only when a lockfile
# changes.
image: node:24.22.1
# The shared runner host, as every workflow here.
runners: [runner.knotless.dev]
# Pushes to main, and pulls that change the pages, the lexicons their
# types are made from, the harness, the docs site,
# types are made from, the harness, the docs site, the examples,
# the format's settings or this file. A pull changing none passes at once,
# noted as skipped.
on:
push: {refs: [refs/heads/main]}
pull:
base: [refs/heads/main, refs/heads/feature/*]
paths: [web/**, lexicons/**, harness/**, docs-site/**, .oxfmtrc.json, .knotless/workflows/web.yml, .knotless/uses.lock]
cache: [web/node_modules]
paths: [web/**, lexicons/**, harness/**, docs-site/**, examples/**, .oxfmtrc.json, .knotless/workflows/web.yml, .knotless/uses.lock]
cache: [web/node_modules, examples/read-a-group/node_modules, examples/join-a-group/node_modules]
steps:
- uses: chadtmiller.com/steps/npm-ci@1
name: packages
with: {dir: web}
- name: format
run: web/node_modules/.bin/oxfmt --check web harness docs-site
run: web/node_modules/.bin/oxfmt --check web harness docs-site examples
- name: layers
run: node harness/layers.mjs
- name: dialogs
@@ -34,3 +36,13 @@ steps:
run: cd web && npm run check
- name: build
run: cd web && npm run build
- uses: chadtmiller.com/steps/npm-ci@1
name: read-a-group packages
with: {dir: examples/read-a-group}
- name: read-a-group
run: cd examples/read-a-group && npm run check
- uses: chadtmiller.com/steps/npm-ci@1
name: join-a-group packages
with: {dir: examples/join-a-group}
- name: join-a-group
run: cd examples/join-a-group && npm run check
docs/design/README.md+2−0
@@ -52,6 +52,8 @@ under `org.atgrp.internal.*`, and may change.
| `web/` | the console, a SvelteKit app where people start and run groups and approve apps. |
| `Dockerfile`, `deploy/` | one image of the host, the console and the command, and the compose file that runs it ([deploying](../deploying.md)) |
| `lexicons/` | the schemas of the records and methods. The host checks every `org.atgrp.*` method's parameters and input against its schema before the handler runs. It also checks a record of our own collections that an app writes as a group before it keeps it. |
| `examples/read-a-group` | an app that reads a group as anyone may, then signs in as the group, as an app built on atproto's TypeScript packages does, and reads its spaces and the host's methods. Its README says how to run it. |
| `examples/join-a-group` | an app that joins a group for a person, signed in at their own PDS: it makes their inbox, reads the group's invite there, asks the host to let them in, and confirms the membership in their own repo. Its README says how to run it. |
## The pages
docs/development.md+4−3
@@ -233,7 +233,8 @@ denied, `cargo deny check`, the console's component layers
(`harness/layers.mjs`), a check that no dialog's title holds a name or
anything typed (`harness/dialogs.mjs`), a check that no component writes
words into its markup rather than saying a message
(`harness/strings.mjs`), and svelte-check.
(`harness/strings.mjs`), svelte-check, and that each example app under
`examples/` still types against the lexicons.
`cargo deny check` holds the dependencies to `deny.toml`: no advisory of
the RustSec database, unmaintained and unsound crates and yanked
@@ -250,8 +251,8 @@ refuses unsafe code in every target, tests too. A new crate takes them
with `[lints] workspace = true`.
`just fmt` formats everything the checks hold to a format. It formats
the Rust with rustfmt, and the console, the harness and the docs site
with [oxfmt](https://oxc.rs/docs/guide/usage/formatter), set in
the Rust with rustfmt, and the console, the harness, the docs site and
the examples with [oxfmt](https://oxc.rs/docs/guide/usage/formatter), set in
`.oxfmtrc.json` (two spaces, single quotes, 100 columns, `.svelte` files
included). An agent doesn't need to run it, since
`.claude/settings.json` has Claude Code format each file as it's
examples/join-a-group/main.tsnew+141−0
@@ -0,0 +1,141 @@
// An app that joins a group for a person. Signed in to their own PDS, it
// makes their inbox, where groups write invites, reads the invite the group
// sent them, asks the group's host to let them in, and once in, confirms
// the membership in their own repo.
//
// npm start <your handle> <group handle or DID> [message to the group]
import { once } from 'node:events';
import { createServer } from 'node:http';
import type { AddressInfo } from 'node:net';
import { Client, XrpcResponseError, l } from '@atproto/lex';
import { SpaceClient, memberspace } from '@atproto/lex-space';
import {
NodeOAuthClient,
buildAtprotoLoopbackClientMetadata,
createDidResolver,
requestLocalLock
} from '@atproto/oauth-client-node';
import { com, org } from './lexicons/index.ts';
const [person, group, message] = process.argv.slice(2);
if (!person || !group)
throw new Error('usage: npm start <your handle> <group handle or DID> [message]');
// A PLC directory on http is a test network's, whose hosts are on http too.
const plcDirectoryUrl = process.env.PLC_URL ?? 'https://plc.directory';
const allowHttp = plcDirectoryUrl.startsWith('http:');
// What the app asks of the person, at their own PDS: to make their inbox
// and read the invites in it, to write their confirmation in any group's
// members space, and to ask a group's host to let them in. A group host's
// permission set `include:org.atgrp.authParticipate` holds these and more,
// where the person's PDS can read its lexicon.
const scope = [
'atproto',
'space:org.atgrp.inbox?action=read&manage=create',
'space:org.atgrp.members?authority=*&collection=org.atgrp.confirmation&action=create',
'rpc:org.atgrp.requestJoin?aud=*'
].join(' ');
// The members space, as far as this app writes it. It is declared here,
// not generated: the alpha's `lex build` makes a space type of several
// collections that TypeScript cannot type.
const members = l.space('literal:self', 'org.atgrp.members', [org.atgrp.confirmation.main]);
// The loopback client, `http://localhost`: an app on this machine, with no
// metadata document of its own to publish. One process, so its sessions and
// the lock on refreshing them are in memory.
const memory = <T>() => {
const kept = new Map<string, T>();
return {
get: async (key: string) => kept.get(key),
set: async (key: string, value: T) => void kept.set(key, value),
del: async (key: string) => void kept.delete(key)
};
};
const server = createServer().listen(0, '127.0.0.1');
await once(server, 'listening');
const callback = `http://127.0.0.1:${(server.address() as AddressInfo).port}/callback`;
const oauth = new NodeOAuthClient({
clientMetadata: buildAtprotoLoopbackClientMetadata({ scope, redirect_uris: [callback] }),
stateStore: memory(),
sessionStore: memory(),
requestLock: requestLocalLock,
plcDirectoryUrl,
handleResolver: process.env.HANDLE_RESOLVER,
allowHttp
});
// The person signs in at their own PDS, as to any app.
const url = await oauth.authorize(person, { scope });
console.log(`Sign in as ${person}:\n\n ${url}\n`);
const [req, res] = await once(server, 'request');
const { session } = await oauth.callback(new URL(req.url, callback).searchParams);
res.end('Signed in. Back to the terminal.');
server.close();
const client = new Client(session);
const didResolver = createDidResolver({ plcDirectoryUrl, allowHttp });
console.log(`Signed in as ${session.did}`);
// The group, and its host: the PDS its DID document names. The host's own
// DID, which calls to it through the person's PDS are addressed to, is what
// it says it is (`describeServer`).
const { did: groupDid, didDoc } = await oauth.identityResolver.resolve(group);
const pds = didDoc.service?.find(
(s) => s.id === '#atproto_pds' || s.id === `${groupDid}#atproto_pds`
);
const hostUrl = String(pds?.serviceEndpoint);
const described = await new Client(hostUrl).call(com.atproto.server.describeServer);
const host = `${described.did}#atgrp` as const;
// The inbox: a space of the person's own, at their PDS, that any group may
// write in (`publicWrite`) and only they read. A group's invite waits there
// once the inbox is made; the host keeps its own list besides, so an
// invite sent before still admits them.
let inbox: SpaceClient<typeof org.atgrp.inbox.main>;
try {
const policy = memberspace.policy.$build({ publicWrite: true });
inbox = await SpaceClient.createSpace(client.agent, org.atgrp.inbox, { policy }, { didResolver });
console.log('Made your inbox, where groups write their invites');
} catch (e) {
if (!(e instanceof XrpcResponseError && e.error === 'SpaceAlreadyExists')) throw e;
inbox = SpaceClient.openSpace(
org.atgrp.inbox,
{ authority: session.did },
{ agent: client.agent, didResolver }
);
}
// The group's invite, in the group's own repo in the inbox, read with a
// credential the person's PDS gives for their delegation token.
for await (const r of inbox.allRecords()) {
if (!r.valid || r.repo !== groupDid || r.collection !== org.atgrp.invite.$type) continue;
console.log(`\n${group} invited you${r.record.message ? `: ${r.record.message}` : ''}`);
}
// Asking to join, of the group's host, through the person's PDS: it signs
// the call as them (service auth) and sends it on to the host, which the
// `atproto-proxy` header names. A live invite lets them in whatever the
// group's join policy; otherwise `approval` leaves the request waiting.
const asked = await client.call(
org.atgrp.requestJoin,
{ group: groupDid, ...(message ? { message } : {}) },
{ service: host }
);
if (asked.status !== 'admitted') {
console.log(`\nAsked to join ${group}: waiting for its admins.`);
} else {
// Their side of the membership: a confirmation in their own repo in the
// group's members space, at their own PDS, which apps that show only
// members who've taken up their place look for.
const space = SpaceClient.openSpace(
members,
{ authority: groupDid },
{ agent: client.agent, didResolver }
);
await space.put(org.atgrp.confirmation.$build({ createdAt: l.currentDatetimeString() }));
console.log(`\nJoined ${group}, and confirmed it.`);
}
await session.signOut();
examples/join-a-group/package-lock.jsonnew+1173−0
1173 lines changed: not loaded until asked for.
examples/join-a-group/package.jsonnew+20−0
@@ -0,0 +1,20 @@
{
"name": "join-a-group",
"private": true,
"description": "An app that joins a group for a person: their inbox, the invite in it, asking to join, and confirming",
"type": "module",
"scripts": {
"lex": "lex build --lexicons ../../lexicons --out lexicons --clear --import-ext .ts --index-file --exclude org.atgrp.meta org.atgrp.members",
"start": "npm run lex && node main.ts",
"check": "npm run lex && tsc"
},
"dependencies": {
"@atproto/lex": "0.0.0-spaces-alpha-20261124235736",
"@atproto/lex-space": "0.0.0-spaces-alpha-20261124235736",
"@atproto/oauth-client-node": "0.0.0-spaces-alpha-20261124235736"
},
"devDependencies": {
"@types/node": "^24.19.2",
"typescript": "^6.0.3"
}
}
examples/join-a-group/README.mdnew+113−0
@@ -0,0 +1,113 @@
# Joining a group
An app that joins a group for a person, as the person's own app: the side
of a group that [reading a group](../read-a-group/README.md) doesn't see.
Signed in to the person's own PDS, it:
1. makes their inbox, `at:space/<them>/org.atgrp.inbox/self`, a space of
their own that any group may write an invite in and only they read, or
finds the one they have;
2. reads the invite the group wrote there, if it sent one;
3. asks the group's host to let them in (`org.atgrp.requestJoin`), through
their own PDS, which signs the call as them and sends it on;
4. once they're in, confirms the membership with an
`org.atgrp.confirmation` in their own repo in the group's members
space, at their own PDS.
A live invite lets them in whatever the group's join policy. Otherwise a
group that takes requests (`approval`) keeps theirs waiting, with their
message, for its admins, and an `invite`-only group refuses it
(`JoinClosed`).
It is one file, `main.ts`, on atproto's own TypeScript packages, from the
spaces alpha the host runs against:
- `@atproto/oauth-client-node` signs the person in at their own PDS: the
loopback client `http://localhost`, an app on this machine.
- `@atproto/lex` calls the host's `org.atgrp.requestJoin`, typed by the
schemas under `lexicons/` at the top of this repository, sent to the
host's `#atgrp` service through the PDS (the `atproto-proxy` header).
- `@atproto/lex-space` makes the inbox, reads the group's invite there with
a credential their PDS gives for their delegation token, and writes the
confirmation.
[Membership](../../docs/design/membership.md) says what the host does on
its side.
## Running it
It needs Node at the version `.node-version` names, which runs `main.ts`
as it is.
```sh
cd examples/join-a-group
npm install
npm start <your handle> <group handle or DID> [message to the group]
```
It prints a link to the person's PDS. Sign in there and allow the app,
and the browser comes back to it. Asked of a group that takes requests,
with no invite:
```
Signed in as did:plc:atldqeavl57gbxg4q6zrnigb
Made your inbox, where groups write their invites
Asked to join did:plc:fycrfwtr6yn64r3u6afr5dtg: waiting for its admins.
```
and again, once the group has invited them:
```
Signed in as did:plc:atldqeavl57gbxg4q6zrnigb
did:plc:fycrfwtr6yn64r3u6afr5dtg invited you: Ride with us on Sunday.
Joined did:plc:fycrfwtr6yn64r3u6afr5dtg, and confirmed it.
```
An invite sent before the person had an inbox isn't in it, as the host
had nowhere to write it, but the host keeps its own list of invites, so
asking to join is let in all the same. Reading the group afterwards with
[read-a-group](../read-a-group/README.md) shows them as members, confirmed.
What the app asks of the person:
| Scope | For |
| ------------------------------------------------------------------------------------- | ------------------------------------------------------- |
| `space:org.atgrp.inbox?action=read&manage=create` | making their inbox, and reading what groups wrote there |
| `space:org.atgrp.members?authority=*&collection=org.atgrp.confirmation&action=create` | writing their confirmation in any group's members space |
| `rpc:org.atgrp.requestJoin?aud=*` | asking a group's host to let them in |
A group host's own permission set,
`include:org.atgrp.authParticipate`, holds these and the rest of what a
person does in a group (withdrawing a request, leaving, declining an
invite, reporting, appealing), where the person's PDS can read its
lexicon.
### On `just dev`
`just dev` runs a PDS and a host on a network of their own, with a PLC
directory of their own, on http. Name the directory, and the PDS to
resolve handles, from what it prints:
```sh
PLC_URL=<the directory> HANDLE_RESOLVER=<the PDS> npm start alice.test hikers.groups.localtest.me
```
Hikers, bob's group, has invited alice. Signing in as `alice.test` with
the password `password` makes her inbox and lets her in.
## What it leaves out
- The members space type is declared in `main.ts` with `l.space(...)`,
naming the collection it writes, rather than generated: the alpha's
`lex build` makes a space type of several collections that TypeScript
cannot type, so `npm run lex` leaves `org.atgrp.meta` and
`org.atgrp.members` out. Fixed upstream by
[bluesky-social/atproto#6085](https://github.com/bluesky-social/atproto/pull/6085).
- It doesn't name the invite it read (`requestJoin`'s `invite`): a live
invite from the group lets them in without it.
- It leaves the rest of what a person does to the host's methods the
permission set lists: `cancelJoinRequest`, `leaveGroup`,
`org.atgrp.internal.declineInvite`, and the moderation methods.
examples/join-a-group/tsconfig.jsonnew+14−0
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"target": "es2024",
"module": "nodenext",
"strict": true,
"noEmit": true,
"allowImportingTsExtensions": true,
"erasableSyntaxOnly": true,
"verbatimModuleSyntax": true,
"skipLibCheck": true,
"types": ["node"]
},
"include": ["main.ts"]
}
examples/read-a-group/main.tsnew+195−0
@@ -0,0 +1,195 @@
// An app that reads a group on a group host: first as anyone may, then
// signed in as the group. An admin of the group approves it at the host,
// and it reads the group's meta and members spaces as the group and asks
// the host one of its own methods.
//
// npm start <group handle or DID>
import { once } from 'node:events';
import { createServer } from 'node:http';
import type { AddressInfo } from 'node:net';
import { Client, XrpcResponseError, l } from '@atproto/lex';
import { SpaceReader, delegationTokenProviderFor } from '@atproto/lex-space';
import {
NodeOAuthClient,
buildAtprotoLoopbackClientMetadata,
createDidResolver,
requestLocalLock
} from '@atproto/oauth-client-node';
import { com, org } from './lexicons/index.ts';
const group = process.argv[2];
if (!group) throw new Error('usage: npm start <group handle or DID>');
// A PLC directory on http is a test network's, whose hosts are on http too.
const plcDirectoryUrl = process.env.PLC_URL ?? 'https://plc.directory';
const allowHttp = plcDirectoryUrl.startsWith('http:');
const didResolver = createDidResolver({ plcDirectoryUrl, allowHttp });
// What the app asks of the group: to read its two spaces, and to list who
// asked to join. The host keeps of it what the approving member's roles hold.
const scope = [
'atproto',
'space:org.atgrp.meta?action=read',
'space:org.atgrp.members?action=read',
'rpc:org.atgrp.listJoinRequests?aud=*'
].join(' ');
// The two spaces every group keeps, as far as this app reads them. They are
// declared here, not generated: the alpha's `lex build` makes a space type
// of several collections that TypeScript cannot type. Records of
// collections not declared come back with `valid` false.
const meta = l.space('literal:self', 'org.atgrp.meta', [
org.atgrp.about.main,
org.atgrp.config.main
]);
const members = l.space('literal:self', 'org.atgrp.members', [
org.atgrp.role.main,
org.atgrp.membership.main,
org.atgrp.confirmation.main,
org.atgrp.rule.main,
com.atproto.label.record.main
]);
// The member who approved the app: the host names them beside the tokens
// it answers with, `member`, a field of its own, which the OAuth client
// doesn't keep. So the client's requests go through this, which reads it.
let approver: string | undefined;
const fetch: typeof globalThis.fetch = async (input, init) => {
const res = await globalThis.fetch(input, init);
const url = new URL(input instanceof Request ? input.url : input);
if (url.pathname === '/oauth/token' && res.ok) approver = (await res.clone().json()).member;
return res;
};
// The loopback client, `http://localhost`: an app on this machine, with no
// metadata document of its own to publish. One process, so its sessions and
// the lock on refreshing them are in memory.
const memory = <T>() => {
const kept = new Map<string, T>();
return {
get: async (key: string) => kept.get(key),
set: async (key: string, value: T) => void kept.set(key, value),
del: async (key: string) => void kept.delete(key)
};
};
const server = createServer().listen(0, '127.0.0.1');
await once(server, 'listening');
const callback = `http://127.0.0.1:${(server.address() as AddressInfo).port}/callback`;
const oauth = new NodeOAuthClient({
clientMetadata: buildAtprotoLoopbackClientMetadata({ scope, redirect_uris: [callback] }),
stateStore: memory(),
sessionStore: memory(),
requestLock: requestLocalLock,
plcDirectoryUrl,
handleResolver: process.env.HANDLE_RESOLVER,
allowHttp,
fetch
});
const { did } = await oauth.identityResolver.resolve(group);
// The group's profile and how it's joined, from its meta space, as
// `options` let it be read.
const profile = async (options: SpaceReader.Options) => {
for await (const r of SpaceReader.openSpace(meta, { authority: did }, options).allRecords()) {
if (!r.valid) continue;
if (r.collection === org.atgrp.about.$type)
console.log(
` ${r.record.displayName}${r.record.description ? `: ${r.record.description}` : ''}`
);
if (r.collection === org.atgrp.config.$type) console.log(` Joining: ${r.record.joinPolicy}`);
}
};
// Signed out: a group whose meta space anyone may read gives a credential
// for it with no delegation token. Its host answers `SpaceNotFound` to
// anyone else, the same as for a space that isn't there.
console.log(`Anyone sees ${group}:`);
try {
await profile({ didResolver });
} catch (e) {
if (!(e instanceof XrpcResponseError && e.error === 'SpaceNotFound')) throw e;
console.log(' nothing: only its members see its profile');
}
// Signing in as the group: the group's DID document names its host, which
// is its authorization server. The host sends the browser to its console,
// where a member signs in and approves.
const url = await oauth.authorize(did, { scope });
console.log(`\nApprove the app as an admin of ${group}:\n\n ${url}\n`);
const [req, res] = await once(server, 'request');
const { session } = await oauth.callback(new URL(req.url, callback).searchParams);
res.end('Signed in. Back to the terminal.');
server.close();
// Each space is read with a credential the host gives for a delegation token
// the session asks it for. @atproto/lex-space's reader does both, and checks
// the host's MACs over what it reads.
const client = new Client(session);
const signedIn = { delegationTokenProvider: delegationTokenProviderFor(client.agent), didResolver };
const roles = new Map<string, org.atgrp.role.Main>();
const memberships = new Map<string, string[]>();
const confirmed = new Set<string>();
const rules: org.atgrp.rule.Main[] = [];
const takenDown = new Set<string>();
const now = new Date().toISOString();
for await (const r of SpaceReader.openSpace(members, { authority: did }, signedIn).allRecords()) {
if (!r.valid) continue;
if (r.collection === org.atgrp.role.$type) roles.set(r.rkey, r.record);
// A membership is keyed by its member's DID, and they confirm it with a
// confirmation in their own repo, at their own PDS.
if (r.collection === org.atgrp.membership.$type) memberships.set(r.rkey, r.record.roles);
if (r.collection === org.atgrp.confirmation.$type) confirmed.add(r.repo);
if (r.collection === org.atgrp.rule.$type) rules.push(r.record);
// Only the group's own labels count, until they lapse. A member it takes
// down is shown to no one.
if (r.collection === com.atproto.label.record.$type && r.repo === did) {
const { uri, val, exp } = r.record;
if (val === '!takedown' && (!exp || exp > now)) takenDown.add(uri);
}
}
// Only an admin may give the app the group, whose roles hold the group's
// administration set: one who approved it, holding less, may read more of
// the group than the app should let them. A session they approved is
// given back.
const adminSet = 'include:org.atgrp.authManageAdmin';
const isAdmin = (memberships.get(approver ?? '') ?? []).some((key) =>
roles.get(key)?.permissions?.some((p) => p === adminSet || p.startsWith(`${adminSet}?`))
);
if (!isAdmin) {
console.log(`${approver ?? 'Someone'} approved it, but isn't an admin of the group.`);
await session.signOut();
process.exit(1);
}
console.log(`Signed in as ${session.did}, approved by ${approver}\n`);
console.log('Its members see:');
await profile(signedIn);
console.log('\nRules:');
rules.sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
for (const rule of rules) console.log(` ${rule.title}: ${rule.text}`);
console.log('\nMembers:');
for (const [member, held] of memberships) {
if (takenDown.has(member)) continue;
const names = held.map((k) => roles.get(k)?.displayName ?? k).join(', ');
console.log(` ${member} ${names}${confirmed.has(member) ? '' : ' (not confirmed)'}`);
}
// The host's own methods, typed by their lexicons. The session names the
// group, so the call needn't.
try {
const { requests } = await client.call(org.atgrp.listJoinRequests, {});
console.log(`\nJoin requests: ${requests.length}`);
for (const r of requests) console.log(` ${r.member} ${r.message ?? ''}`);
} catch (e) {
// ScopeMissing: the approving member may not admit anyone.
console.log(`\nJoin requests: not granted (${(e as Error).message})`);
}
// Gives the grant back: the group's admins see it gone from its apps.
await session.signOut();
examples/read-a-group/package-lock.jsonnew+1173−0
1173 lines changed: not loaded until asked for.
examples/read-a-group/package.jsonnew+20−0
@@ -0,0 +1,20 @@
{
"name": "read-a-group",
"private": true,
"description": "An app signed in as a group on a group host: it reads the group's spaces and asks the host's methods",
"type": "module",
"scripts": {
"lex": "lex build --lexicons ../../lexicons --out lexicons --clear --import-ext .ts --index-file --exclude org.atgrp.meta org.atgrp.members",
"start": "npm run lex && node main.ts",
"check": "npm run lex && tsc"
},
"dependencies": {
"@atproto/lex": "0.0.0-spaces-alpha-20261124235736",
"@atproto/lex-space": "0.0.0-spaces-alpha-20261124235736",
"@atproto/oauth-client-node": "0.0.0-spaces-alpha-20261124235736"
},
"devDependencies": {
"@types/node": "^24.19.2",
"typescript": "^6.0.3"
}
}
examples/read-a-group/README.mdnew+133−0
examples/read-a-group/tsconfig.jsonnew+14−0
.gitignore+2−0
AGENTS.md+5−1
Justfile+5−4
README.md+5−3