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.

364 B
Raw Blame
import type { BackgroundCommand } from "@pibot/protocol";

export function compareBackgroundCommands(a: BackgroundCommand, b: BackgroundCommand) {
  return (
    Number(b.status === "running") - Number(a.status === "running") ||
    Date.parse(b.endedAt ?? b.startedAt) - Date.parse(a.endedAt ?? a.startedAt) ||
    (a.id < b.id ? 1 : a.id > b.id ? -1 : 0)
  );
}