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.

761 B
Raw Blame
import type {
  EndpointCapabilityDefinition,
  EndpointCapabilityRow,
  EndpointPresence,
} from "@pibot/protocol-base";

export function endpointCapabilityView(
  row: EndpointCapabilityRow,
  definition: EndpointCapabilityDefinition | undefined,
  online: boolean,
  presence: EndpointPresence | undefined,
) {
  const deviceName = presence?.name ?? row.endpointId;
  return {
    ...row,
    online,
    endpointKind:
      row.endpointId === "local" ? ("desktop" as const) : (definition?.kind ?? ("runner" as const)),
    endpointName:
      row.endpointId === "local"
        ? { zh: "这台电脑", en: "This computer" }
        : { zh: deviceName, en: deviceName },
    name: definition?.name ?? { zh: "未知能力", en: "Unknown capability" },
  };
}