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.

544 B
Raw Blame
import type { PolicyTrace } from "./explain.ts";
import type { PolicyResult } from "./types.ts";

export function deny(
  result: PolicyResult,
  reason: string,
  trace: PolicyTrace,
  axis: "boundary" | "category" | "level" | "connector" = "boundary",
): PolicyResult {
  result.decision = "deny";
  result.reason = reason;
  result.canRemember = false;
  // A refused call opens nothing; execution must never find roots left on a deny.
  delete result.outsideWrites;
  delete result.outsideWriteRoots;
  return trace.result(result, axis);
}