feat: add pty monitoring for claude code

This commit is contained in:
hh
2026-05-23 00:37:49 +02:00
parent 9de5647cfa
commit c7b3eddbf4
6 changed files with 386 additions and 3 deletions
@@ -226,6 +226,18 @@ class ClaudeCodeBackendAdapter:
def live_session_count(self) -> int:
return self._backend.live_session_count
@property
def live_sessions(self) -> dict[str, Any]:
"""Live PTY processes keyed by claude session_id.
Pass-through to the underlying ``ClaudeCodeBackend``. The value
type is the claude-code-api ``PtyClaudeProcess``; admin code
consumes ``captured_output()`` / ``add_output_listener`` /
``write`` from it. Typed as ``Any`` to avoid leaking the lower
layer's type into the gateway's public surface.
"""
return self._backend.live_sessions
async def __aenter__(self) -> Self:
await self._backend.__aenter__()
return self