Skip to content

feat(tracking): Implement SimpleElementTracker with optimal matching #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
uses: actions/checkout@v4

# --- 2. Set up Python ---
- name: Set up Python 3.10
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.11'

# --- 3. Install uv ---
- name: Install uv
Expand Down
56 changes: 21 additions & 35 deletions omnimcp/__init__.py
Original file line number Diff line number Diff line change
@@ -1,45 +1,31 @@
# omnimcp/__init__.py
import sys
import os
from loguru import logger

from omnimcp.config import config
# Import config first as it might be needed by others
from .config import config

# Remove default handler
logger.remove()

# Add stderr handler (keep this functionality)
logger.add(sys.stderr, level=config.LOG_LEVEL.upper() if config.LOG_LEVEL else "INFO")


# Define a function to configure run-specific logging
def setup_run_logging(run_dir=None):
"""
Configure additional logging for a specific run.

Args:
run_dir: Directory to store run-specific logs. If None, logs go to default logs directory.
# Now import the setup function from its new location
from .utils import setup_run_logging

Returns:
The log file path
"""
# Determine log file location
if run_dir:
os.makedirs(run_dir, exist_ok=True)
log_file_path = os.path.join(run_dir, "run.log")
else:
log_dir = config.LOG_DIR or "logs"
os.makedirs(log_dir, exist_ok=True)
log_file_path = os.path.join(log_dir, "run_{time:YYYY-MM-DD_HH-mm-ss}.log")
# Remove default handler added by loguru at import time
logger.remove()

# Add run-specific log handler
# --- Initial Setup ---
# Configure base logging (stderr + optional default file)
# This ensures logging works even if AgentExecutor isn't run immediately
if not config.DISABLE_DEFAULT_LOGGING:
setup_run_logging() # Call without run_dir to set up defaults
else:
# If default is disabled, still add stderr at least
logger.add(
log_file_path, rotation="50 MB", level="DEBUG", encoding="utf8", enqueue=True
sys.stderr, level=config.LOG_LEVEL.upper() if config.LOG_LEVEL else "INFO"
)
logger.info("Default file logging disabled via config. Stderr logging enabled.")

logger.info(f"Run logging configured. Log path: {log_file_path}")
return log_file_path
logger.info(f"OmniMCP package initialized. Log level: {config.LOG_LEVEL.upper()}")


# Set up default logging (for non-run use)
if not config.DISABLE_DEFAULT_LOGGING:
setup_run_logging()
# Optionally expose key classes/functions at the package level
# from .agent_executor import AgentExecutor
# from .visual_state import VisualState
# etc.
Loading