shortcuts

This commit is contained in:
2026-04-02 22:07:11 -03:00
parent 8c1138c746
commit 0b5575f3b3
4 changed files with 306 additions and 17 deletions

View File

@@ -69,17 +69,30 @@ def _parse_mentions(message: str, frames: list[FrameRef]) -> list[FrameRef]:
return mentioned
def _resolve_frame_path(frames_dir: Path, raw_path: str) -> Path | None:
"""Resolve a frame path from index.json, handling mounted/remote sessions."""
p = Path(raw_path)
if p.exists():
return p
# Try relative to frames_dir (handles path prefix mismatch from remote)
local = frames_dir / p.name
if local.exists():
return local
return None
def _load_frames(frames_dir: Path) -> list[FrameRef]:
index_path = frames_dir / "index.json"
if not index_path.exists():
return []
try:
entries = json.loads(index_path.read_text())
return [
FrameRef(id=e["id"], path=Path(e["path"]), timestamp=e["timestamp"])
for e in entries
if Path(e["path"]).exists()
]
frames = []
for e in entries:
resolved = _resolve_frame_path(frames_dir, e["path"])
if resolved:
frames.append(FrameRef(id=e["id"], path=resolved, timestamp=e["timestamp"]))
return frames
except Exception as e:
log.warning("Could not load frames index: %s", e)
return []