Files
Anton 052591281d Initial clean version - Agent Maxim
- Complete agent system with planning and execution
- Bridge API with FastAPI server
- WhatsApp-style mobile dashboard
- Enhanced web search with query improvement
- Security guards and policy checks
- Comprehensive documentation
2026-04-09 18:07:43 +03:00

32 lines
804 B
Python

"""Basic policy guard for Bridge prompts."""
from __future__ import annotations
MAX_PROMPT_LENGTH = 4000
_BLOCKED_PHRASES = frozenset({
"<placeholder>",
"TODO",
"FIXME",
"your prompt here",
})
def check(prompt: str) -> tuple[bool, str]:
"""Check a prompt against policy rules.
Returns:
(True, "") if prompt passes
(False, reason) if prompt is blocked
"""
if not prompt or not prompt.strip():
return False, "prompt is empty"
if len(prompt) > MAX_PROMPT_LENGTH:
return False, f"prompt exceeds {MAX_PROMPT_LENGTH} chars (got {len(prompt)})"
lower = prompt.lower()
for phrase in _BLOCKED_PHRASES:
if phrase.lower() in lower:
return False, f"prompt contains blocked phrase: '{phrase}'"
return True, ""