feat: add pty monitoring
This commit is contained in:
@@ -149,6 +149,18 @@ class ClaudeCodeBackend:
|
||||
def live_session_count(self) -> int:
|
||||
return len(self._sessions)
|
||||
|
||||
@property
|
||||
def live_sessions(self) -> dict[str, PtyClaudeProcess]:
|
||||
"""Snapshot of live PTY processes keyed by ``session_id``.
|
||||
|
||||
Returned dict is a copy — caller may iterate freely without
|
||||
worrying about concurrent ``complete()`` calls reshuffling
|
||||
``_sessions`` (which is keyed by history fingerprint, not
|
||||
``session_id``). Intended for debug surfaces (e.g. admin
|
||||
terminal viewer) that need to look up a session by id.
|
||||
"""
|
||||
return {s.session_id: s.pty for s in self._sessions.values()}
|
||||
|
||||
async def complete(self, messages: list[Mapping[str, Any]]) -> AsyncIterator[Event]:
|
||||
"""Run one turn against the matching session (or spawn one).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user