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:
parent
fb6b78fa19
commit
7aee78bd87
8 changed files with 113257 additions and 50 deletions
|
|
@ -2308,5 +2308,7 @@
|
|||
"inboxSharedNoHandle": "{title} wurde mit dir geteilt",
|
||||
"inboxSharedArriving": "Ein Lernset, das noch unterwegs ist",
|
||||
"inboxSharedOpen": "Öffnen",
|
||||
"studysetNew": "Neu"
|
||||
"studysetNew": "Neu",
|
||||
"shareRefusedAgentViewer": "Ein Agent kann nur Betrachter:in sein.",
|
||||
"shareAgent": "Agent"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2946,5 +2946,9 @@
|
|||
"inboxSharedOpen": "Open",
|
||||
"@inboxSharedOpen": {"description": "Button opening a studyset shared with the person"},
|
||||
"studysetNew": "New",
|
||||
"@studysetNew": {"description": "Mark on a library card of a studyset someone shared with the person, until opened"}
|
||||
"@studysetNew": {"description": "Mark on a library card of a studyset someone shared with the person, until opened"},
|
||||
"shareRefusedAgentViewer": "An agent can only be a Viewer.",
|
||||
"@shareRefusedAgentViewer": {"description": "An agent invited or set to another role than Viewer, refused"},
|
||||
"shareAgent": "Agent",
|
||||
"@shareAgent": {"description": "Marks a member that is an agent, a program acting for its owner"}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13633,6 +13633,18 @@ abstract class AppLocalizations {
|
|||
/// In en, this message translates to:
|
||||
/// **'New'**
|
||||
String get studysetNew;
|
||||
|
||||
/// An agent invited or set to another role than Viewer, refused
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'An agent can only be a Viewer.'**
|
||||
String get shareRefusedAgentViewer;
|
||||
|
||||
/// Marks a member that is an agent, a program acting for its owner
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Agent'**
|
||||
String get shareAgent;
|
||||
}
|
||||
|
||||
class _AppLocalizationsDelegate
|
||||
|
|
|
|||
|
|
@ -8714,4 +8714,11 @@ class AppLocalizationsDe extends AppLocalizations {
|
|||
|
||||
@override
|
||||
String get studysetNew => 'Neu';
|
||||
|
||||
@override
|
||||
String get shareRefusedAgentViewer =>
|
||||
'Ein Agent kann nur Betrachter:in sein.';
|
||||
|
||||
@override
|
||||
String get shareAgent => 'Agent';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8636,6 +8636,12 @@ class AppLocalizationsEn extends AppLocalizations {
|
|||
|
||||
@override
|
||||
String get studysetNew => 'New';
|
||||
|
||||
@override
|
||||
String get shareRefusedAgentViewer => 'An agent can only be a Viewer.';
|
||||
|
||||
@override
|
||||
String get shareAgent => 'Agent';
|
||||
}
|
||||
|
||||
/// The translations for English, as used in the United Kingdom (`en_GB`).
|
||||
|
|
|
|||
|
|
@ -126,6 +126,9 @@ class Dependencies({
|
|||
/// What the instance's operators do there (ADR 0021, D21 to D24).
|
||||
@override required final InstanceOperatorRepository instanceOperators,
|
||||
|
||||
/// The person's agents (Halkyon's ADR 0044, D45).
|
||||
@override required final AgentRepository agents,
|
||||
|
||||
/// The assistants the operator granted the person, and asking them or
|
||||
/// the person's own (ADR 0021, step 2).
|
||||
@override required final AssistantRepository assistants,
|
||||
|
|
@ -309,6 +312,7 @@ class Dependencies({
|
|||
passwords: passwords,
|
||||
simpleLogin: simpleLogin,
|
||||
instanceOperators: instanceOperators,
|
||||
agents: AgentRepository(ServerpodAgentGateway(client.modules.base)),
|
||||
assistants: assistants,
|
||||
assistantOperators: assistantOperators,
|
||||
profiles: PublicProfileRepository(
|
||||
|
|
|
|||
|
|
@ -258,6 +258,7 @@ String? _problemText(AppLocalizations l10n, JoinSpaceState state) {
|
|||
SpaceRefusal.self ||
|
||||
SpaceRefusal.nextOwnerNeeded ||
|
||||
SpaceRefusal.lastMember ||
|
||||
SpaceRefusal.agentViewer ||
|
||||
SpaceRefusal.handleNeeded => l10n.shareRefusedNotAllowed,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class const _Ready({
|
|||
final owner = state.yourRole == SpaceRole.owner;
|
||||
final others = [
|
||||
for (final member in state.members)
|
||||
if (!member.you && !member.invited) member,
|
||||
if (!member.you && !member.invited && !member.agent) member,
|
||||
];
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
|
|
@ -221,6 +221,8 @@ class const _MemberRow({
|
|||
final role = _roleName(l10n, member.role);
|
||||
final note = member.you
|
||||
? l10n.shareYou
|
||||
: member.agent
|
||||
? l10n.shareAgent
|
||||
: member.invited
|
||||
? l10n.shareInvited
|
||||
: switch (trust) {
|
||||
|
|
@ -233,6 +235,8 @@ class const _MemberRow({
|
|||
leading: CircleAvatar(
|
||||
child: member.byEmail
|
||||
? const Icon(LucideIcons.mail, size: 18)
|
||||
: member.agent
|
||||
? const Icon(LucideIcons.bot, size: 18)
|
||||
: Text(_nameOf(member).characters.firstOrNull?.toUpperCase() ?? ''),
|
||||
),
|
||||
title: Text(
|
||||
|
|
@ -286,7 +290,7 @@ class const _RoleMenu({required final SpaceMember member})
|
|||
tooltip: l10n.shareMemberOptions,
|
||||
icon: const Icon(LucideIcons.ellipsisVertical),
|
||||
itemBuilder: (context) => [
|
||||
if (member.role != SpaceRole.editor)
|
||||
if (member.role != SpaceRole.editor && !member.agent)
|
||||
PopupMenuItem(
|
||||
value: _MemberAction.editor,
|
||||
child: Text(l10n.shareMakeEditor),
|
||||
|
|
@ -296,7 +300,7 @@ class const _RoleMenu({required final SpaceMember member})
|
|||
value: _MemberAction.viewer,
|
||||
child: Text(l10n.shareMakeViewer),
|
||||
),
|
||||
if (!member.invited)
|
||||
if (!member.invited && !member.agent)
|
||||
PopupMenuItem(
|
||||
value: _MemberAction.owner,
|
||||
child: Text(l10n.shareMakeOwner),
|
||||
|
|
@ -572,6 +576,7 @@ void _report(BuildContext context, SpaceAction outcome) {
|
|||
SpaceRefusal.tooManyMails => l10n.shareRefusedTooManyMails,
|
||||
SpaceRefusal.mailFailed => l10n.shareRefusedMailFailed,
|
||||
SpaceRefusal.handleNeeded => l10n.shareRefusedHandleNeeded,
|
||||
SpaceRefusal.agentViewer => l10n.shareRefusedAgentViewer,
|
||||
SpaceRefusal.notAllowed ||
|
||||
SpaceRefusal.ownerRole ||
|
||||
SpaceRefusal.self ||
|
||||
|
|
|
|||
Loading…
Reference in a new issue