@@ -34,33 +34,58 @@ $ uvx --from 'libtmux' --prerelease allow python
3434
3535### Features
3636
37- - Control-mode–first engine protocol (experimental): adds structured command results,
38- notification parsing (layout changes, unlinked windows, client detach/session change,
39- session rename, paste-buffer events), and stats while keeping existing
40- ` Server/Session/Window/Pane.cmd ` return type (` tmux_cmd ` ) stable. (#605 )
41- - Control mode engine's internal connection session is now automatically filtered from
42- ` Server.sessions ` and ` Server.has_session() ` , making engine choice transparent to
43- users. Advanced users can access all sessions via ` Server._sessions_all() ` . (#605 )
44- - ` ControlModeEngine ` accepts optional ` internal_session_name ` and ` attach_to `
45- parameters for advanced session management scenarios. (#605 )
46- - ` Server.connect() ` : New convenience method for session management. Returns an
47- existing session if found, otherwise creates a new detached session. Simplifies
48- common session reuse patterns and works transparently with both subprocess and
49- control-mode engines.
50- - Control-mode diagnostics: bounded notification queue with drop counting,
51- richer exceptions (` ControlModeTimeout ` , ` ControlModeProtocolError ` ,
52- ` ControlModeConnectionError ` , ` SubprocessTimeout ` ), and documented retry/timeout
53- behaviour. Control sandbox pytest fixture provides a hermetic control-mode server
54- for integration tests.
37+ #### Control mode engine (experimental) (#605 )
38+ - Control-mode–first engine stack with structured ` CommandResult ` , notification parsing
39+ (%layout-change, unlinked window add/close/rename, client session change/detach, paste buffer),
40+ and stats, while keeping the public ` cmd ` API returning ` tmux_cmd ` .
41+ - Internal control session is automatically filtered from ` Server.sessions ` /
42+ ` Server.has_session() ` ; advanced users can inspect all sessions via
43+ ` Server._sessions_all() ` .
44+ - ` ControlModeEngine ` accepts ` internal_session_name ` (default ` libtmux_control_mode ` )
45+ and ` attach_to ` for advanced connection strategies.
46+
47+ Example:
48+
49+ ``` python
50+ from libtmux._internal.engines.control_mode import ControlModeEngine
51+ from libtmux.server import Server
52+
53+ engine = ControlModeEngine(command_timeout = 5 )
54+ server = Server(engine = engine)
55+ session = server.new_session(session_name = " ctrl" )
56+ for notif in engine.iter_notifications(timeout = 0.1 ):
57+ print (notif.kind, notif.data)
58+ ```
59+
60+ #### Convenience APIs (#605 )
61+ - ` Server.connect() ` returns an existing session or creates a new detached one,
62+ working with both subprocess and control-mode engines.
63+
64+ #### Diagnostics and resilience (#605 )
65+ - Bounded notification queue with drop counting; exposed via engine stats.
66+ - Expanded exceptions: ` ControlModeTimeout ` , ` ControlModeProtocolError ` ,
67+ ` ControlModeConnectionError ` , ` SubprocessTimeout ` ; documented retry/timeout behaviour.
68+ - Control-mode capture-pane trims trailing whitespace-only lines to mirror subprocess
69+ semantics; first capture after send-keys briefly retries to avoid prompt races.
70+
71+ #### Testing utilities (#605 )
72+ - Control sandbox fixture provides a hermetic control-mode tmux server (isolated HOME,
73+ TMUX_TMPDIR, unique socket); handy for integration-style tests.
74+ Example:
75+
76+ ``` python
77+ @pytest.mark.engines ([" control" ])
78+ def test_control_sandbox (control_sandbox ):
79+ with control_sandbox as server:
80+ out = server.cmd(" display-message" , " -p" , " hi" )
81+ assert out.stdout == [" hi" ]
82+ ```
5583
5684### Compatibility
5785
58- - Control mode's internal session is now automatically filtered from user-facing APIs.
59- Code that previously filtered ` libtmux_control_mode ` manually can be simplified.
60- APIs remain unchanged for tmux command return objects; new metadata is attached for
61- advanced users. (#605 )
62- - Control-mode ` capture-pane ` trims trailing whitespace-only lines to align with
63- subprocess behaviour; explicit range flags (` -S/-E ` ) remain exact.
86+ - Control mode internal session filtering is engine-driven; callers no longer need
87+ to manually exclude ` libtmux_control_mode ` . APIs stay unchanged; additional metadata
88+ is attached for advanced users. (#605 )
6489
6590## libtmux 0.50.0 (2025-11-30)
6691
0 commit comments