Skip to content

armgit / pibot

Public Imported from GitHub
0

Open-source, local-first AI agent team for your desktop: multi-agent group chats, computer use, browser, MCP, routines and approvals. macOS, Windows, Linux + Android. Built on pi.

490 B
Raw Blame
import type { MethodResults } from "@pibot/protocol";

/**
 * One definition of "how many things wait for the user", shared by every badge and the inbox
 * page. A pending send draft also has a pending approval row, so `draft` is a subset of
 * `approval` and must not be added again.
 */
export function inboxTotal(counts: MethodResults["inbox.counts"]): number {
  return Object.entries(counts).reduce(
    (sum, [key, count]) => sum + (key === "draft" ? 0 : (count ?? 0)),
    0,
  );
}