Files
hermes-agent/session_keys.py
yoniebans e50375c995 feat(storage): neutral helpers and the store-handle seams callers share
The top-level helpers the switched callers share (session keys, process identity, storage limits, lineage adoption, session rescue) and the store-handle seams that open persistence beside the legacy store, with the test fixtures and fakes the caller tests use.
2026-11-17 17:50:50 +01:00

16 lines
597 B
Python

"""The profile namespace of a gateway session key, for the gateway and the storage backend."""
from persistence.core.keys import profile_from_session_key_namespace
__all__ = ["profile_from_session_key", "profile_from_session_key_namespace"]
def profile_from_session_key(session_key):
"""Profile namespace encoded in an ``agent:<ns>:...`` gateway session key, else None."""
if not session_key:
return None
parts = str(session_key).split(":")
if len(parts) < 2 or parts[0] != "agent":
return None
return profile_from_session_key_namespace(parts[1] or "main")