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.

412 B
Raw Blame
// Intentionally ephemeral: DO hibernation/eviction resets the fallback budget.
export class MinuteLimit {
  private minute = -1;
  private count = 0;
  take(limit: number, now = Date.now()) {
    const minute = Math.floor(now / 60_000);
    if (minute !== this.minute) {
      this.minute = minute;
      this.count = 0;
    }
    if (this.count >= limit) return false;
    this.count++;
    return true;
  }
}