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.

511 B
Raw Blame
/** Count redacted output lines without keeping their contents or depending on tail retention. */
export class OutputProgress {
  private completed = 0;
  private partial = false;

  push(text: string) {
    if (!text) return;
    for (let i = 0; i < text.length; i++)
      if (text.charCodeAt(i) === 10) this.completed = Math.min(this.completed + 1, 1_000_000_000);
    this.partial = !text.endsWith("\n");
  }

  get lines() {
    return Math.min(this.completed + Number(this.partial), 1_000_000_000);
  }
}