Skip to content

feat: closed-scope member grants, server players and audit log - #2

Merged
codebyant merged 5 commits into
developfrom
feat/discord-bot
Dec 1, 2026
Merged

codebyant merged 5 commits into
developfrom
feat/discord-bot

Conversation

@codebyant

Copy link
Copy Markdown
Owner

Summary

Lets an owner hand a key a closed set of commands, so a bot can control servers without console, files, mods or backups access.

  • Role grants may carry commands: the agent accepts only role ∩ commands. Old agents reject such grants (strict schema), so they fail closed.
  • Restricted keys may only follow server.status and may change a server's state at most 6 times in 10 minutes.
  • host.info reports features (grant_commands, status_players, audit) so clients can tell what the agent supports.
  • server.status and server.status.changed include players online/max and the MOTD, read with a local Server List Ping; changes in the player count are emitted while someone is subscribed.
  • A restricted key may say, in the signed header, which Discord user it acts for (on_behalf_of). Start, stop and restart from any signer go to a local audit log (audit.jsonl, last 5000, 0600), readable by admins with agent.audit.list.
  • Library rebuilt; tag v1.1.0-alpha.1 points at this branch for consumers.

Validation

  • bun run lint, bun run typecheck, bun run test (581 pass), bun run check:lib.
  • Not yet tested on a real host: player count against a real Minecraft server, audit file permissions on Linux.

Do not merge before the end-to-end test.

A grant may carry a closed list of command types. The agent then accepts only commands in that list and within the grant's role (role ∩ commands). Old agents reject such grants because the schema is strict, so they fail closed.
A key whose grant lists its commands may only follow server status and may change a server's state at most 6 times in 10 minutes. host.info now reports the agent's features so clients can tell whether it supports these grants.
The agent asks its own running servers for their status on localhost (Server List Ping) and adds players online/max and the MOTD to server.status. The status watcher also emits server.status.changed when the player count changes, polling every 30 seconds while someone is subscribed.
A restricted key may say, inside the signed command header, which Discord user it acts for. The agent records server start, stop and restart from any signer in a local audit log (last 5000 entries, 0600) and serves it to admins with agent.audit.list.
@codebyant
codebyant marked this pull request as ready for review December 1, 2026 23:26
@codebyant
codebyant merged commit 23fa8a7 into develop Dec 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant