Phase 11, part 4: agents' limits, recent calls and a pause switch

Each agent has calls a minute and things it may ask to send out a day,
checked on every tool call and every request to send; every call is
recorded (tool, outcome, time) and the agent's page lists the last 50 and
what it's waiting on. Pause refuses all its calls at once. Also fixes each
agent's MCP server being shared with others that had the same scopes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 11:09:18 -07:00
co-authored by Claude Opus 5.5
parent 311d2e815b
commit 6bf0517163
16 changed files with 527 additions and 13 deletions
+8
View File
@@ -252,3 +252,11 @@ func Allowed(d *db.DB, agent int64, class string, now time.Time) (bool, error) {
agent, class, Done, Failed, ts(now.Add(-24*time.Hour))).Scan(&n)
return n < cap, err
}
// AskedSince counts what an agent asked to send out since a time, approved
// or not: its cap per day.
func AskedSince(d *db.DB, agent int64, since time.Time) (int, error) {
var n int
err := d.QueryRow(`SELECT count(*) FROM approvals WHERE agent_id = ? AND created_at >= ?`, agent, ts(since)).Scan(&n)
return n, err
}