export const CH = { get: "approval:get", decide: "approval:decide", request: "approval:request", reset: "approval:reset", changed: "approval:changed", }; export const TOOLS = [ "read_file", "write_file", "run_shell", "http_get", ]; const RISKS = ["read", "write", "exec"]; const DECISIONS = ["allow", "deny", "always"]; export function assertDecideReq(value) { if (typeof value !== "object" || value === null) { throw new Error("BAD_DECIDE_REQ"); } const { id, decision } = value; if (typeof id !== "string" || id.length === 0 || id.length > 64 || !DECISIONS.includes(decision)) { throw new Error("BAD_DECIDE_REQ"); } } export function assertRequestReq(value) { if (typeof value !== "object" || value === null) { throw new Error("BAD_REQUEST_REQ"); } const { tool, risk, detail, ttlMs } = value; if (!TOOLS.includes(tool) || !RISKS.includes(risk) || typeof detail !== "string" || detail.length > 200 || typeof ttlMs !== "number" || !Number.isFinite(ttlMs) || ttlMs < 200 || ttlMs > 60_000) { throw new Error("BAD_REQUEST_REQ"); } } //# sourceMappingURL=ipc.js.map