import re

# ANSI Escape Sequences (Standard and Xterm)
ANSI_ESCAPE = re.compile(r'\x1b(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')

# --- Agent Orchestration Patterns ---

# Matches satellite thinking turn markers (used in AgentExecutor._compress_reasoning)
TURN_THINKING_MARKER = re.compile(r"🛰️.*\[turn.*thinking", re.IGNORECASE)

# Matches strategy execution boilerplate
STRATEGY_BOILERPLATE = re.compile(r"strategy:.*executing orchestrated tasks", re.IGNORECASE)

# Matches quality gate failure notifications
COWORKER_FAIL_MARKER = re.compile(r"⚠️ \*\*Co-Worker\*\*: Quality check FAILED")

# Parser Patterns
SKILL_CONFIG_JSON = re.compile(r"```json\s*({\s*\"skill_name\":.*?})\s*```", re.DOTALL)
SKILL_DESC_OVERRIDE = re.compile(r"\[DESCRIPTION_OVERRIDE\]:\s*(.*)")
SKILL_PARAM_TABLE = re.compile(r"\|.*\|", re.MULTILINE)
SKILL_BASH_LOGIC = re.compile(r"\[BASH_START\](.*?)\[BASH_END\]", re.DOTALL)

# Infrastructure Patterns
URL_CLEANER = re.compile(r'https?://[^\s<>"]+|www\.[^\s<>"]+')

# Evaluation Patterns
FINAL_SCORE = re.compile(r"FINAL_SCORE:\s*(\d+)")
RUBRIC_SECTION = re.compile(r"^#\s+(Evaluation Rubric|Rework Instructions)", re.MULTILINE | re.IGNORECASE)
