feat(base,app,learn,todo,train,meditate): agent accounts with tokens

ADR 0044's step 6a (D42, D43, D45): accounts for programs, such as AI
assistants, that an identified person makes from the Profile.

halkyon_base keeps them on the instance's register, which its members
ask: an agent is an account (agent_account: its owner, its name, its
public keys, set by itself once) with one token (agent_token: 32
random bytes, kept as their SHA-256 alone, shown once). agents.create,
mine, newToken, revoke, delete and setKeys serve its owner;
agentSignIn.signIn exchanges the token for an ordinary server-side
session of a day, with the scopes identified and agent, at most 60
sign-ins an hour from a network. Revoking a token or making a new one
ends the agent's sessions; a token unused for 90 days lapses in every
service's pruning. Up to 5 agents a person, where the operator didn't
switch them off (AGENTS=off; said on the privacy page and in
instance.basics). An agent makes no agents, creates or owns no shared
space, is invited and raised as a Viewer alone, is never handed a
space on, is named no operator and granted no assistants; each refusal
has its test. Deleting a person deletes their agents first; an agent's
public profile names whose agent it is.

In the apps, every Profile has an Agents card (halkyon_app's
AgentsSection): made with a name and a handle, its token shown once to
copy, a new token, the token taken back, deleted. Learn's Share sheet
marks an agent among the members and offers it no role above Viewer.

The migrations, the module's and each host's (Learn, Meditate, Todo,
Train), are additive alone: CREATE TABLE "agent_account" with a unique
index on "agentId" (one row an agent account) and one on "ownerId" (a
person's agents, and deleting them with the person), and CREATE TABLE
"agent_token" with unique indexes on "agentId" (one token an agent)
and "tokenHash" (the sign-in finds the token by its hash). No existing
table is touched, so the server before the deploy keeps working on the
migrated database.

Whats-New: Make agents in your Profile: accounts for programs such as AI assistants, which sign in with a token and see only what you share with them.
Whats-New-De: Leg in deinem Profil Agenten an: Konten für Programme wie KI-Assistenten, die sich mit einem Token anmelden und nur sehen, was du mit ihnen teilst.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-11-11 19:55:27 +01:00
commit 7aee78bd87
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -6,7 +6,7 @@
agent's recommendations, which they chose on 11 Nov 2026, D14 too, and D15 to D26;
D27 their choice; D28 the agent's, to be confirmed; D29 to D32 the agent's
recommendations, which they chose.
Steps 1 to 3 built; the rest below.
Steps 1 to 5 and step 6's first part built; the rest below.
- **Builds on:** ADR 0005 (publishing, reports and suggestions), ADR 0014 (the module),
ADR 0016 (one account across an instance), ADR 0017 (key pairs), ADR 0019 (private
studysets), ADR 0021 (operators and assistants).
@ -218,6 +218,39 @@ member reads everything in the space.
Japanese with you" with Open and Leave, counted in its badge until seen, and the
studyset's library card says New until it is opened.
- **D41.** **The agent shares Learn's code rather than repeating it** (decided 11 Nov 2026,
the agent's recommendation): what reads and seals Learn's content (its models, the
payload codecs, the envelope, halkyon_app's `SharedKeys` and `KeyPins`) moves into
pure-Dart packages the app and the agent both use, and the agent syncs its spaces
through the engine's client (pure Dart) as an app does. Over an endpoint handing the
agent a space's rows with a codec of its own, which would keep the privacy rules in
two places, and over readable studysets alone, which would leave D6's keys for later.
- **D42.** **Step 6 is built in three parts** (decided 11 Nov 2026, the agent's
recommendation): agent accounts and their tokens in the module, made and revoked in
the Profile (D6, D12); suggestions within a shared space in Learn (D10); then the
agent itself, its CLI and MCP server (D7, D41). Each is usable and tested alone.
- **D43.** **An agent's token is exchanged for a session** (decided 11 Nov 2026, the
agent's recommendation): sent once to the module's sign-in for agents, it gets an
ordinary server-side session, so every endpoint, scope and revocation holds as for
people; the instance keeps the token's hash alone and stamps its last use at each
sign-in (D12), and revoking it ends the agent's sessions. Over the token on every
call, a second way of authenticating beside Serverpod's sessions.
- **D44.** **Whoever may not edit suggests** (decided 11 Nov 2026, the agent's
recommendation): an agent, and a person who is a Viewer, suggest changes within a
shared studyset, which an Editor or its Owner accepts or declines (D10 widened).
- **D45.** **Agent accounts as the register keeps them** (decided 11 Nov 2026, the
agent's recommendations): an agent is an account of the instance's register
(`agent_account`: its owner, its name), up to 5 a person, made from the Profile by an
identified person who is no agent, where the operator didn't switch agents off
(`AGENTS=off`, on otherwise, said on the privacy page). Its token (`agent_token`, one
an agent, 32 random bytes kept as their SHA-256 alone, shown once) signs it in for a
day at most; the agent signs in at each start. Its sessions carry `identified` and
`agent`, and an agent makes no agents, creates or owns no shared space, is invited and
raised as a Viewer alone, uses none of the operator's assistants, operates nothing
and signs in no other way. It sets its public keys itself, once. Deleting the owner
deletes their agents first, as accounts are deleted; its public profile says whose
agent it is.
## Steps
1. **Share with the community's confirmation** (D8, D9), needing nothing else here.
@ -266,7 +299,22 @@ member reads everything in the space.
address and its code where the invitation was mailed; what is new shows in the
Inbox ("@alice shared Japanese with you", Open or Leave), on the Profile tab's
badge and as New on the studyset's card, until the studyset is opened.
6. **Agents** (D6, D7, D10, D12).
6. **Agents** (D6, D7, D10, D12), in three parts (D42).
a. **Agent accounts** (D43, D45), built 11 Nov 2026: the module's `agent_account`
and `agent_token`, kept by the register and asked by its members;
`agents.create`, `mine`, `newToken`, `revoke`, `delete` and `setKeys` for the
owner, `agentSignIn.signIn` exchanging the token for a day's session with the
scopes `identified` and `agent`, at most 60 sign-ins an hour a network; a token
unused for 90 days lapses in each service's pruning. The refusals of D45 have
their denial tests (an agent making agents, creating or owning a space, invited
or raised above Viewer, handed a space on, named operator, granted assistants).
`instance.basics().agents`, the privacy page's sentence, `Profile.agentOf`. In
the apps, halkyon_app's `AgentsSection` in every Profile (made, token shown
once to copy, new token, taken back, deleted) and members marked as agents
(`SpaceMember.agent`; Learn's Share sheet: a bot, "Agent", no role above
Viewer offered, none to hand the studyset on to).
b. Suggestions within a shared space (D10, D44).
c. The agent itself, its CLI and MCP server, on a pure-Dart core (D7, D41).
## Open questions, before building