Something went wrong. Try again.
small gleam coding and (not yet) persistent agent daemon with a detachable cli forked from okami.mom/albedo
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435"""Where the browser keeps what a cell did not name a path for."""
from __future__ import annotations
import osimport timefrom pathlib import Path
# A screenshot nobody kept is not worth the disk after this long.SCREENSHOT_TTL_SECONDS = 7 * 24 * 60 * 60
def home() -> Path: return Path(os.environ.get("ALBEDO_HOME") or "~/.albedo").expanduser()
def screenshots() -> Path: """Default screenshots go to the cache, never into the working tree.""" return home() / "cache" / "browser-screenshots"
def prune(directory: Path, *, now: float | None = None) -> None: """Removes the PNGs in `directory` last written before the time-to-live.""" cutoff = (time.time() if now is None else now) - SCREENSHOT_TTL_SECONDS try: entries = list(directory.glob("*.png")) except OSError: return for entry in entries: try: if entry.stat().st_mtime < cutoff: entry.unlink() except OSError: pass