Phase 11, part 3: approvals for what agents send out

Agents can now ask to publish or schedule a post, send an email, add
someone to a mailing list, or apply an SEO change. Each waits on the
Approvals page (with a count in the sidebar) for an admin or a member with
edit on its module, who can edit it first, approve or refuse it, and let
the agent take that class of action on its own with a cap per day. A
rotation after a leak revokes the old keys and withdraws everything
allowed. All of it is in the audit log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 10:54:53 -07:00
co-authored by Claude Opus 5.5
parent bfb74e7700
commit 311d2e815b
17 changed files with 1396 additions and 13 deletions
+15 -1
View File
@@ -29,12 +29,26 @@
</tbody>
</table>
<div class="actions">
<form class="inline" method="post" action="/settings/agents/{{$a.ID}}/rotate"><button type="submit" class="secondary">Rotate the key</button></form>
<form class="inline row" method="post" action="/settings/agents/{{$a.ID}}/rotate"><button type="submit" class="secondary">Rotate the key</button>
<label class="check small"><input type="checkbox" name="leaked"> It leaked: stop the old keys now, and withdraw what it may do on its own</label></form>
<form class="inline row" method="post" action="/settings/agents/{{$a.ID}}/new-key"><label class="small">Expires <input type="date" name="expires"></label><button type="submit" class="secondary">Add a key</button></form>
</div>
<p class="help"><strong>Rotate</strong> makes a new key; the old one keeps working for a day, so whatever uses it can be switched over. After a leak, <strong>revoke</strong> it instead: it stops at once.</p>
</section>
<section class="card" id="allowed">
<h2>On its own</h2>
{{if .Allowed}}
<p class="help">What {{$a.Name}} may do without asking, approved on the Approvals page. Everything else it asks for waits there for a person.</p>
<table class="list"><tbody>{{range .Allowed}}<tr>
<td>{{.Label}}</td><td>{{if .DailyCap}}up to {{.DailyCap}} a day{{else}}no cap{{end}}</td><td>{{ago .Granted}}{{with by .GrantedBy}} {{.}}{{end}}</td>
<td><form class="inline" method="post" action="/approvals/allowed/withdraw"><input type="hidden" name="agent" value="{{.Agent}}"><input type="hidden" name="class" value="{{.Class}}"><button type="submit" class="secondary small">Withdraw</button></form></td>
</tr>{{end}}</tbody></table>
{{else}}<p class="help">Nothing: everything it asks to send out (posts, emails, mailing-list adds, changes to the sites) waits on <a href="/approvals">Approvals</a> for a person.</p>{{end}}
{{if .Asked}}<h3>Lately</h3>
<ul class="small">{{range .Asked}}<li>{{.Summary}}: {{if eq .Status "waiting"}}waiting{{else if eq .Status "refused"}}refused{{else if eq .Status "failed"}}failed{{else if .OnItsOwn}}done on its own{{else}}approved{{end}}, {{ago .Created}}</li>{{end}}</ul>{{end}}
</section>
<section class="card">
<div class="actions">
{{if eq $a.Status "disabled"}}