ccproxy.plugins.claude_sdk.manager¶
ccproxy.plugins.claude_sdk.manager
¶
Claude SDK Session Manager - Pure dependency injection architecture.
This module provides a SessionManager class that encapsulates session pool lifecycle management using dependency injection patterns without any global state.
SessionManager
¶
Manages the lifecycle of session-based Claude SDK clients with dependency injection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
ClaudeSDKSettings
|
Plugin-specific configuration for Claude SDK |
required |
metrics_factory
|
MetricsFactory | None
|
Optional callable that returns a metrics instance. If None, no metrics will be used. |
None
|
Source code in ccproxy/plugins/claude_sdk/manager.py
start
async
¶
shutdown
async
¶
Gracefully shuts down the session pool.
This method is idempotent - calling it multiple times is safe.
Source code in ccproxy/plugins/claude_sdk/manager.py
get_session_client
async
¶
Get session-aware client.
Source code in ccproxy/plugins/claude_sdk/manager.py
interrupt_session
async
¶
Interrupt a specific session due to client disconnection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_id
|
str
|
The session ID to interrupt |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if session was found and interrupted, False otherwise |
Source code in ccproxy/plugins/claude_sdk/manager.py
interrupt_all_sessions
async
¶
Interrupt all active sessions (for shutdown or emergency cleanup).
Returns:
| Type | Description |
|---|---|
int
|
Number of sessions that were interrupted |
Source code in ccproxy/plugins/claude_sdk/manager.py
get_session_pool_stats
async
¶
reset_for_testing
¶
Synchronous reset for test environments.
Warning
This method should only be used in tests. It does not properly shut down the session pool - use shutdown() for production code.