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.

632 B
Raw Blame
import type { MethodResults } from "@pibot/protocol";

// Structural RPC validation cannot establish that the response belongs to this requested Bot.
export function checkedProfile(profile: MethodResults["bots.profile"], botId: string) {
  if (
    profile.bot.id !== botId ||
    profile.memories.some((memory) => memory.scope !== "user" && memory.botId !== botId) ||
    profile.proposals.some((proposal) => proposal.botId !== botId) ||
    (profile.undoable ?? []).some(
      (proposal) => proposal.botId !== botId || proposal.status !== "accepted",
    )
  )
    throw new Error("Profile target mismatch");
  return profile;
}