feat: add guided exploration and share user-started MCP backend

This commit is contained in:
chenmingxuan committed 2026-10-16 18:32:46 +08:00
1 parent f86db1ced6
commit ee256ad7ce
144 files changed
+8625 -2075

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
"""Coordinate queue file reads and replacement across Windows processes/threads."""
from functools import lru_cache
from pathlib import Path
from filelock import FileLock
@lru_cache(maxsize=128)
def _directory_lock(directory: Path) -> FileLock:
# One small OS-backed lock per queue directory, not one leftover file per
# task. FileLock releases the OS lock when its process exits.
return FileLock(directory / ".artemis-queue-io.lock", timeout=3)
def queue_file_lock(path: Path):
"""Hold only during file I/O, never across device operations or retry sleeps."""
return _directory_lock(path.parent.resolve()).acquire(poll_interval=0.005)
def read_queue_text(path: Path) -> str:
with queue_file_lock(path):
return path.read_text(encoding="utf-8")