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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user