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>
107 lines
7.1 KiB
HTML
107 lines
7.1 KiB
HTML
{{define "content"}}{{template "settings-start" .}}{{with .Data}}{{$d := .}}{{$a := .Row}}
|
|
<p><a href="/settings/agents">← Agents</a></p>
|
|
<h2>{{$a.Name}}{{if $a.BuiltIn}} <span class="pill">built in</span>{{end}}{{if eq $a.Status "disabled"}} <span class="pill">turned off</span>{{end}}{{if not $a.Limits.Paused.IsZero}} <span class="pill warn">paused</span>{{end}}</h2>
|
|
{{with .Problem}}<p class="error" role="alert">{{.}}</p>{{end}}
|
|
|
|
<section class="card" id="running">
|
|
{{if $a.Limits.Paused.IsZero}}
|
|
<form method="post" action="/settings/agents/{{$a.ID}}/pause" class="row">
|
|
<button type="submit" class="danger">Pause</button>
|
|
<span class="help">Stops all its calls at once, whatever key it uses, until it's resumed.</span>
|
|
</form>
|
|
{{else}}
|
|
<form method="post" action="/settings/agents/{{$a.ID}}/resume" class="row">
|
|
<button type="submit">Resume</button>
|
|
<span class="help">Paused {{ago $a.Limits.Paused}}{{with by $a.Limits.PausedBy}} {{.}}{{end}}: every call it makes is refused.</span>
|
|
</form>
|
|
{{end}}
|
|
<form method="post" action="/settings/agents/{{$a.ID}}/limits" class="row wrap">
|
|
<label class="small">Calls a minute <input name="per_minute" type="number" min="1" value="{{$a.Limits.PerMinute}}" class="tiny"></label>
|
|
<label class="small">Things it asks to send out, a day <input name="out_per_day" type="number" min="1" value="{{$a.Limits.OutPerDay}}" class="tiny"></label>
|
|
<button type="submit" class="secondary small">Save the limits</button>
|
|
</form>
|
|
<p class="help">In the last 24 hours it asked to send out {{.SentDay}} of its {{$a.Limits.OutPerDay}}: posts, emails, mailing-list adds and changes to the sites, approved or not.</p>
|
|
</section>
|
|
|
|
{{if .Waiting}}
|
|
<section class="card">
|
|
<h2>Waiting on</h2>
|
|
<ul>{{range .Waiting}}<li><a href="/approvals#r-{{.ID}}">{{.Summary}}</a> <span class="muted small">asked {{ago .Created}}</span></li>{{end}}</ul>
|
|
</section>
|
|
{{end}}
|
|
|
|
<section class="card" id="calls">
|
|
<h2>Recent calls</h2>
|
|
{{if .Calls}}
|
|
<table class="list">
|
|
<thead><tr><th>When</th><th>Tool</th><th>Result</th><th class="num">Took</th></tr></thead>
|
|
<tbody>{{range .Calls}}<tr>
|
|
<td title="{{.At.Local.Format "2 Jan 2006 15:04:05"}}">{{ago .At}}</td>
|
|
<td><code>{{.Tool}}</code></td>
|
|
<td>{{if eq .Outcome "ok"}}<span class="muted small">{{truncate 100 .Detail}}</span>{{else if eq .Outcome "refused"}}<span class="pill warn">refused</span> <span class="small">{{.Detail}}</span>{{else}}<span class="error-text small">{{truncate 160 .Detail}}</span>{{end}}</td>
|
|
<td class="num small">{{.Took.Milliseconds}} ms</td>
|
|
</tr>{{end}}</tbody>
|
|
</table>
|
|
<p class="help">The last 50; kept for 30 days.</p>
|
|
{{else}}<p class="muted">No calls yet.</p>{{end}}
|
|
</section>
|
|
|
|
<form class="card" method="post" action="/settings/agents/{{$a.ID}}/save">
|
|
<label>Name <input name="name" value="{{$a.Name}}" required></label>
|
|
<label>What it's for <textarea name="description" rows="2">{{$a.Description}}</textarea></label>
|
|
{{template "agent-scopes" (dict "Scopes" $a.Modules "Grants" .Grants)}}
|
|
<button type="submit">Save</button>
|
|
</form>
|
|
|
|
<section class="card" id="keys">
|
|
<h2>Keys</h2>
|
|
<table class="list">
|
|
<thead><tr><th>Key</th><th>Made</th><th>Expires</th><th>Last used</th><th></th></tr></thead>
|
|
<tbody>
|
|
{{range $a.Keys}}<tr>
|
|
<td><code>{{.Prefix}}…</code>
|
|
{{if not .Revoked.IsZero}} <span class="pill">revoked {{ago .Revoked}}</span>
|
|
{{else if not (.Working $d.Now)}} <span class="pill">stopped</span>
|
|
{{else if not .Retires.IsZero}} <span class="pill warn">replaced: works until {{.Retires.Local.Format "2 Jan 15:04"}}</span>
|
|
{{else}} <span class="pill ok">working</span>{{end}}</td>
|
|
<td>{{.Created.Local.Format "2 Jan 2006"}}</td>
|
|
<td>{{if .Expires.IsZero}}<span class="muted">never</span>{{else}}{{.Expires.Local.Format "2 Jan 2006"}}{{end}}</td>
|
|
<td>{{if .Used.IsZero}}<span class="muted">never</span>{{else}}{{ago .Used}}{{with .UsedFrom}} <span class="muted small">from {{.}}</span>{{end}}{{end}}</td>
|
|
<td>{{if .Working $d.Now}}<form class="inline" method="post" action="/settings/agents/{{$a.ID}}/revoke" data-confirm="Revoke this key? Whatever uses it stops at once."><input type="hidden" name="key" value="{{.ID}}"><button type="submit" class="secondary small danger">Revoke</button></form>{{end}}</td>
|
|
</tr>{{else}}<tr><td colspan="5" class="muted">No keys.</td></tr>{{end}}
|
|
</tbody>
|
|
</table>
|
|
<div class="actions">
|
|
<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"}}
|
|
<form class="inline" method="post" action="/settings/agents/{{$a.ID}}/enable"><button type="submit" class="secondary">Turn it back on</button></form>
|
|
{{else}}
|
|
<form class="inline" method="post" action="/settings/agents/{{$a.ID}}/disable"><button type="submit" class="secondary danger">Turn it off</button></form>
|
|
{{end}}
|
|
{{if not $a.BuiltIn}}<form class="inline" method="post" action="/settings/agents/{{$a.ID}}/remove" data-confirm="Remove {{$a.Name}} and its keys for good?"><button type="submit" class="danger">Remove</button></form>{{end}}
|
|
</div>
|
|
<p class="help">Turned off, none of its keys work, until it's turned back on.</p>
|
|
</section>
|
|
{{end}}{{template "settings-end"}}{{end}}
|