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.

588 B
Raw Blame
import type { Message } from "@pibot/protocol";
import { interruptedRun, RUN_INTERRUPTED } from "@pibot/protocol";

/** Renderer hint for the reply whose run a restart interrupted. */
export function interruptedMessage(message: Pick<Message, "role" | "status" | "usage">): boolean {
  const usage = message.usage;
  const stopReason =
    usage &&
    typeof usage === "object" &&
    !Array.isArray(usage) &&
    usage.stopReason === RUN_INTERRUPTED
      ? RUN_INTERRUPTED
      : null;
  return message.role === "assistant" && interruptedRun({ status: message.status, stopReason });
}