diff --git a/docs/OPERATIONS.md b/docs/OPERATIONS.md index 268379a..53f4036 100644 --- a/docs/OPERATIONS.md +++ b/docs/OPERATIONS.md @@ -161,8 +161,9 @@ instead, an admin confirms it there or in Approvals with their password. ### Approvals -Start → Approvals (and the "N to approve" in the taskbar, its tooltip -lists them) shows what waits for an admin, newest first: the plans of +Start → Approvals (and the "N to approve" in the taskbar, with "N being +planned" for proposals the planner still works on; its tooltip lists +them) shows what waits for an admin, newest first: the plans of the AI agents' proposals (`#12`, see [AI agents](#ai-agents); those the planner still works on are listed too) and the pending actions (`A12`): deletions of domains, databases, groups, mail domains and diff --git a/webui/src/components/Taskbar.svelte b/webui/src/components/Taskbar.svelte index ff93730..c4ebcea 100644 --- a/webui/src/components/Taskbar.svelte +++ b/webui/src/components/Taskbar.svelte @@ -30,7 +30,8 @@ } = $props(); const attention = $derived(conversations.attention); - const waiting = $derived(approvals.waiting); + // proposals the planner still works on show too + const open = $derived(approvals.undecided); let time = $state(formatHour(Date.now())); @@ -70,19 +71,19 @@ ⚠ {attention.length} {/if} - {#if waiting.length} + {#if open.length} {/if} {#if connection.lost} diff --git a/webui/src/lib/approvals.svelte.ts b/webui/src/lib/approvals.svelte.ts index a282b53..e8f550f 100644 --- a/webui/src/lib/approvals.svelte.ts +++ b/webui/src/lib/approvals.svelte.ts @@ -2,7 +2,7 @@ import { get, type Approval, type PendingAction, type Plan } from './api'; // Start → Approvals: the AI agents' proposals and the pending actions // (deletions, the agent's remote backup changes); the taskbar shows the -// waiting ones, any admin decides +// undecided ones, any admin decides class ApprovalStore { list = $state([]); @@ -10,11 +10,28 @@ class ApprovalStore { this.list = await get('/approvals'); } - /** what an admin can decide on now, for the taskbar */ + /** what an admin can decide on now */ get waiting(): Approval[] { return this.list.filter(a => status(a) === 'pending'); } + /** the proposals the planner still works on */ + get planning(): Approval[] { + return this.list.filter(a => status(a) === 'planning'); + } + + /** "2 to approve, 1 being planned", each part only when there are some */ + get summary(): string { + const waiting = this.waiting.length; + const planning = this.planning.length; + return [ + waiting ? `${waiting} to approve` : '', + planning ? `${planning} being planned` : '', + ] + .filter(Boolean) + .join(', '); + } + /** also the proposals the planner works on */ get undecided(): Approval[] { return this.list.filter(a => undecided(a)); @@ -118,7 +135,7 @@ export function approvalTitle(a: Approval): string { return a.action.description.split('. ')[0].replace(/\.$/, ''); } -/** the taskbar's line of a waiting one */ +/** the taskbar's line of an undecided one */ export function approvalLine(a: Approval): string { const from = a.kind === 'proposal' ? `${a.proposal.from}: ` : ''; return `${approvalNumber(a)} ${from}${approvalTitle(a)}`;