Surface Cursor run progress to stderr and response payloads, enforce CURSOR_TIMEOUT_SECONDS, validate git repos before delegate, and fix resume session cwd persistence. Includes docs, tests, and packaging. Co-authored-by: Cursor <cursoragent@cursor.com>
23 lines
608 B
Python
23 lines
608 B
Python
"""Audit log for Cursor delegations."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
from datetime import datetime, timezone
|
|
from pathlib import Path
|
|
from typing import Any
|
|
|
|
from cursor_mcp.config import settings
|
|
|
|
|
|
def audit_log(event: str, payload: dict[str, Any]) -> None:
|
|
path = Path(settings.audit_log_path).expanduser()
|
|
path.parent.mkdir(parents=True, exist_ok=True)
|
|
record = {
|
|
"ts": datetime.now(timezone.utc).isoformat(),
|
|
"event": event,
|
|
**payload,
|
|
}
|
|
with path.open("a", encoding="utf-8") as fh:
|
|
fh.write(json.dumps(record, default=str) + "\n")
|