@@ -49,26 +49,39 @@ class Connection(TypedServerRequestMixin):
4949 remains `None` (no handshake reaches a stateless connection).
5050 """
5151
52+ has_standalone_channel : bool
53+ session_id : str | None
54+
55+ client_params : InitializeRequestParams | None
56+ """The full `initialize` request params; `None` before initialization."""
57+
58+ protocol_version : str | None
59+
60+ initialized : anyio .Event
61+ """Set when `notifications/initialized` arrives (matches TS `oninitialized`);
62+ the point from which the spec permits server-initiated requests beyond
63+ ping/logging. Pre-set on stateless connections."""
64+
65+ state : dict [str , Any ]
66+ """Per-connection scratch state; persists across requests on this connection."""
67+
68+ exit_stack : AsyncExitStack
69+ """Per-connection teardown, unwound LIFO (shielded) when the connection
70+ closes. Push cleanup from handlers or middleware; exceptions are logged
71+ and swallowed."""
72+
5273 def __init__ (self , outbound : Outbound , * , has_standalone_channel : bool , session_id : str | None = None ) -> None :
5374 self ._outbound = outbound
5475 self .has_standalone_channel = has_standalone_channel
55- self .session_id : str | None = session_id
56-
57- self .client_params : InitializeRequestParams | None = None
58- """The full `initialize` request params; `None` before initialization."""
59- self .protocol_version : str | None = None
60- self .initialized : anyio .Event = anyio .Event ()
61- """Set when `notifications/initialized` arrives (matches TS `oninitialized`);
62- the point from which the spec permits server-initiated requests beyond
63- ping/logging. Pre-set on stateless connections."""
64-
65- self .state : dict [str , Any ] = {}
66- """Per-connection scratch state; persists across requests on this connection."""
67-
68- self .exit_stack : AsyncExitStack = AsyncExitStack ()
69- """Per-connection teardown, unwound LIFO (shielded) when the connection
70- closes. Push cleanup from handlers or middleware; exceptions are logged
71- and swallowed."""
76+ self .session_id = session_id
77+
78+ self .client_params = None
79+ self .protocol_version = None
80+ self .initialized = anyio .Event ()
81+
82+ self .state = {}
83+
84+ self .exit_stack = AsyncExitStack ()
7285
7386 @property
7487 def initialize_accepted (self ) -> bool :
0 commit comments