MCPcopy
hub / github.com/aiming-lab/MetaClaw / _load

Method _load

metaclaw/cli_session_store.py:65–78  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

63 # ── persistence ──────────────────────────────────────────────
64
65 def _load(self) -> None:
66 if not self._path.exists():
67 return
68 try:
69 raw = json.loads(self._path.read_text(encoding="utf-8"))
70 for sid, entry in raw.get("bindings", {}).items():
71 self._bindings[sid] = CliSessionBinding(
72 cli_session_id=entry["cli_session_id"],
73 auth_profile_id=entry.get("auth_profile_id"),
74 system_prompt_hash=entry.get("system_prompt_hash"),
75 created_at=entry.get("created_at", 0.0),
76 )
77 except Exception as e:
78 logger.warning("[CliSessionStore] failed to load %s: %s", self._path, e)
79
80 def save(self) -> None:
81 self._path.parent.mkdir(parents=True, exist_ok=True)

Callers 1

__init__Method · 0.95

Calls 4

CliSessionBindingClass · 0.85
existsMethod · 0.45
getMethod · 0.45
warningMethod · 0.45

Tested by

no test coverage detected