fix(mem0-agent): non-blocking stdin, clean session_state, lint

Found by running the CLI live against a scratch project:
- hook_input() blocked forever on an open stdin pipe with no data. A real hook
  writes JSON and closes the pipe, but any manual invocation hung; now polled
  with select() and never blocks.
- the open-thread snapshot was filling with progress lines and file-modification
  lists -- v1's exact failure -- so it now filters turns through the same
  hard-drop rules the capture gate uses.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Deshraj Yadav
2026-07-28 02:12:23 -07:00
co-authored by Claude Fable 5
parent 4d5f2e653c
commit ba1de5f87b
6 changed files with 76 additions and 9 deletions
@@ -231,7 +231,7 @@ class SessionState:
def read_lines(self, name: str) -> list[dict]:
try:
return [json.loads(l) for l in self._p(name).read_text().splitlines() if l.strip()]
return [json.loads(line) for line in self._p(name).read_text().splitlines() if line.strip()]
except Exception:
return []