import type { AgentDefinition } from "./types"; // Built-in tools whose approval tier is "read" (see tool classes' `approval`). // An agent is read-only iff its declared tools are a non-empty subset of this set. // Fail-safe: any unknown tool makes the agent not read-only. // export const READ_ONLY_TOOL_NAMES: ReadonlySet = new Set([ "read", "wait", "grep", "glob", "find", "web_search", "ast_grep", "yield", "ask", "todo", "recall", "reflect", "retain", "memory_edit", "checkpoint", "rewind", ]); export function isReadOnlyAgent(agent: AgentDefinition): boolean { return !!agent.tools?.length && agent.tools.every(tool => READ_ONLY_TOOL_NAMES.has(tool)); }