From a26add09e92aeaad20403c6c377149a5099ca45c Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 22 Nov 2026 15:30:44 -0600 Subject: [PATCH 1/6] py(deps[libtmux]): Raise floor to 0.67.0 why: libtmux 0.63.0 to 0.67.0 change behaviour this server reaches. 0.67.0 passes session names, window names, pane titles and start directories to tmux as literal text (tmux-python/libtmux#901), so the server's own format escaping now doubles every `#`. 0.64.0 puts `--` before send-keys data so text that starts with `-` is typed (tmux-python/libtmux#892), and 0.65.0 raises libtmux's minimum tmux to 3.3a (tmux-python/libtmux#888). Once the next commit drops the server's escaping, an install that resolved 0.62.0 would expand `#` again, so the floor must require 0.67.0. At this revision `uv run pytest` fails 27 tests in tests/test_tmux_format_arguments.py, where names and start directories come back with `##`, and 2 in tests/test_history.py, which pin libtmux's send-keys argv without the new `--`. The next two commits fix them. what: - Raise the libtmux floor from >=0.62.0 to >=0.67.0 and relock - Update the libtmux row in docs/reference/compatibility.md, which tests/docs/test_compatibility.py keeps equal to the manifest See also: - https://github.com/tmux-python/libtmux/releases/tag/v0.63.0 - https://github.com/tmux-python/libtmux/releases/tag/v0.64.0 - https://github.com/tmux-python/libtmux/releases/tag/v0.65.0 - https://github.com/tmux-python/libtmux/releases/tag/v0.66.0 - https://github.com/tmux-python/libtmux/releases/tag/v0.67.0 --- docs/reference/compatibility.md | 2 +- pyproject.toml | 2 +- uv.lock | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/reference/compatibility.md b/docs/reference/compatibility.md index 1cd4039c..db5c0c57 100644 --- a/docs/reference/compatibility.md +++ b/docs/reference/compatibility.md @@ -23,7 +23,7 @@ | Package | Required version | |---------|-----------------| -| [libtmux](https://libtmux.git-pull.com/) | >= 0.62.0, < 1.0 | +| [libtmux](https://libtmux.git-pull.com/) | >= 0.67.0, < 1.0 | | [FastMCP](https://github.com/jlowin/fastmcp) | >= 4.0.2, < 5.0.0 | | [regex](https://github.com/mrabarnett/mrab-regex) | >= 2024.11.6 | diff --git a/pyproject.toml b/pyproject.toml index ad325266..e4c31227 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ include = [ ] dependencies = [ - "libtmux>=0.62.0,<1.0", + "libtmux>=0.67.0,<1.0", "fastmcp>=4.0.2,<5.0.0", "regex>=2024.11.6", ] diff --git a/uv.lock b/uv.lock index fa0f71d1..452cea3e 100644 --- a/uv.lock +++ b/uv.lock @@ -1222,11 +1222,11 @@ wheels = [ [[package]] name = "libtmux" -version = "0.62.0" +version = "0.67.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/0c/b8/0410c8487f7673926d141a5aaaf60133984a564b3c90eb4f3f99e92e7740/libtmux-0.62.0.tar.gz", hash = "sha256:41e9e80602b2656fd119b13253b27bad46af5cfef32099be53cdd391e2936b61", size = 571757, upload-time = "2026-07-12T21:48:02.781Z" } +sdist = { url = "https://files.pythonhosted.org/packages/1b/ff/1873ffb21aa622da76af892580cdb8462ce8b4ee86689f556c84bf0cb306/libtmux-0.67.0.tar.gz", hash = "sha256:97df9cf8aada89f13932e13fc661b8244a2369945985b1a81355826a71332d4f", size = 708673, upload-time = "2026-11-22T19:00:06.405Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/87/96/471ac01844ee157fe794446e17568e9bf219d323575c2acc7957a9a2d8c9/libtmux-0.62.0-py3-none-any.whl", hash = "sha256:626aa6fae45e3a423e1acc81604efafa63b7262b1d67b2c7a8778b1ad691456b", size = 127700, upload-time = "2026-07-12T21:48:01.52Z" }, + { url = "https://files.pythonhosted.org/packages/c5/fa/9fa31ed88d682fb87ac911ffd32db2691611bb0c1a99842686d3063e5c63/libtmux-0.67.0-py3-none-any.whl", hash = "sha256:39dfe4b7345e55de4aa89d5eb9ae95a3610a559107ba57cee3d4f39de3612e1c", size = 159782, upload-time = "2026-11-22T19:00:04.965Z" }, ] [[package]] @@ -1288,7 +1288,7 @@ testing = [ [package.metadata] requires-dist = [ { name = "fastmcp", specifier = ">=4.0.2,<5.0.0" }, - { name = "libtmux", specifier = ">=0.62.0,<1.0" }, + { name = "libtmux", specifier = ">=0.67.0,<1.0" }, { name = "regex", specifier = ">=2024.11.6" }, ] From bd7046a76c21b8eb62f9e2b9c3513dc1d4006ffa Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 22 Nov 2026 15:30:44 -0600 Subject: [PATCH 2/6] mcp(fix): Leave # escaping to libtmux why: libtmux 0.67.0 keeps a `#` in session names, window names, pane titles and start directories as typed (tmux-python/libtmux#901). The server still escaped those values for tmux's format expander, so `create_window(window_name="build#2")` stored `build##2`, and a start directory containing `#` named a path that does not exist, so tmux started the pane in its fallback directory instead. what: - Pass names and titles to libtmux unescaped in create_session, create_window, rename_session, rename_window and set_pane_title - Return the resolved path unescaped from _prepare_start_directory, which create_session, create_window, split_window and respawn_pane share - Keep _escape_tmux_format for option names and pipe_pane commands, which libtmux still hands to tmux's expander --- src/libtmux_mcp/_utils.py | 14 +++++++------- src/libtmux_mcp/tools/pane_tools/lifecycle.py | 3 +-- src/libtmux_mcp/tools/server_tools.py | 5 ++--- src/libtmux_mcp/tools/session_tools.py | 5 ++--- src/libtmux_mcp/tools/window_tools.py | 3 +-- 5 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/libtmux_mcp/_utils.py b/src/libtmux_mcp/_utils.py index 94ebac0e..0126b90b 100644 --- a/src/libtmux_mcp/_utils.py +++ b/src/libtmux_mcp/_utils.py @@ -482,11 +482,11 @@ def escape_run(match: re.Match[str]) -> str: def _prepare_start_directory(start_directory: str | None) -> str | None: """Resolve a caller path to the directory tmux will actually use. - tmux expands ``-c`` as a format before using it as a working - directory, then silently falls back to ``$HOME``, or ``/``, when the - result cannot be entered — so an unresolvable path starts the pane - somewhere else instead of failing. Resolving here leaves no format for - tmux to run and turns a bad path into an error the caller can correct. + tmux silently falls back to ``$HOME``, or ``/``, when a ``-c`` working + directory cannot be entered — so an unresolvable path starts the pane + somewhere else instead of failing. Resolving here turns a bad path into + an error the caller can correct. libtmux passes the path to tmux as + literal text, so a ``#`` in it needs no escaping. Parameters ---------- @@ -496,7 +496,7 @@ def _prepare_start_directory(start_directory: str | None) -> str | None: Returns ------- str or None - Absolute path escaped for tmux, or ``None`` when none was given. + Absolute path, or ``None`` when none was given. Raises ------ @@ -517,7 +517,7 @@ def _prepare_start_directory(start_directory: str | None) -> str | None: if not resolved.is_dir(): msg = f"start_directory is not an existing directory: {str(resolved)!r}" raise ExpectedToolError(msg) - return _escape_tmux_format(str(resolved)) + return str(resolved) def _tmux_argv(server: Server, *tmux_args: str) -> list[str]: diff --git a/src/libtmux_mcp/tools/pane_tools/lifecycle.py b/src/libtmux_mcp/tools/pane_tools/lifecycle.py index 004e3b49..05c719e4 100644 --- a/src/libtmux_mcp/tools/pane_tools/lifecycle.py +++ b/src/libtmux_mcp/tools/pane_tools/lifecycle.py @@ -12,7 +12,6 @@ ExpectedToolError, _ask_before_teardown, _caller_is_on_server, - _escape_tmux_format, _get_caller_identity, _get_server, _prepare_start_directory, @@ -233,7 +232,7 @@ def set_pane_title( session_id=session_id, window_id=window_id, ) - pane.set_title(_escape_tmux_format(title)) + pane.set_title(title) return _serialize_pane(pane) diff --git a/src/libtmux_mcp/tools/server_tools.py b/src/libtmux_mcp/tools/server_tools.py index 3b7fdab8..792a35bc 100644 --- a/src/libtmux_mcp/tools/server_tools.py +++ b/src/libtmux_mcp/tools/server_tools.py @@ -23,7 +23,6 @@ _apply_filters, _ask_before_teardown, _caller_is_on_server, - _escape_tmux_format, _get_caller_identity, _get_server, _invalidate_server, @@ -133,9 +132,9 @@ def create_session( server = _get_server(socket_name=socket_name) kwargs: dict[str, t.Any] = {} if session_name is not None: - kwargs["session_name"] = _escape_tmux_format(session_name) + kwargs["session_name"] = session_name if window_name is not None: - kwargs["window_name"] = _escape_tmux_format(window_name) + kwargs["window_name"] = window_name prepared_start_directory = _prepare_start_directory(start_directory) if prepared_start_directory is not None: kwargs["start_directory"] = prepared_start_directory diff --git a/src/libtmux_mcp/tools/session_tools.py b/src/libtmux_mcp/tools/session_tools.py index 08d291a9..e968ecea 100644 --- a/src/libtmux_mcp/tools/session_tools.py +++ b/src/libtmux_mcp/tools/session_tools.py @@ -20,7 +20,6 @@ _apply_filters, _ask_before_teardown, _caller_is_on_server, - _escape_tmux_format, _get_caller_identity, _get_server, _prepare_start_directory, @@ -174,7 +173,7 @@ def create_window( session = _resolve_session(server, session_name=session_name, session_id=session_id) kwargs: dict[str, t.Any] = {} if window_name is not None: - kwargs["window_name"] = _escape_tmux_format(window_name) + kwargs["window_name"] = window_name prepared_start_directory = _prepare_start_directory(start_directory) if prepared_start_directory is not None: kwargs["start_directory"] = prepared_start_directory @@ -226,7 +225,7 @@ def rename_session( """ server = _get_server(socket_name=socket_name) session = _resolve_session(server, session_name=session_name, session_id=session_id) - session = session.rename_session(_escape_tmux_format(new_name)) + session = session.rename_session(new_name) return _serialize_session(session) diff --git a/src/libtmux_mcp/tools/window_tools.py b/src/libtmux_mcp/tools/window_tools.py index 0c4e35dc..d3a20991 100644 --- a/src/libtmux_mcp/tools/window_tools.py +++ b/src/libtmux_mcp/tools/window_tools.py @@ -20,7 +20,6 @@ _apply_filters, _ask_before_teardown, _caller_is_on_server, - _escape_tmux_format, _get_caller_identity, _get_server, _prepare_start_directory, @@ -303,7 +302,7 @@ def rename_window( session_name=session_name, session_id=session_id, ) - window.rename_window(_escape_tmux_format(new_name)) + window.rename_window(new_name) return _serialize_window(window) From efa5f2095b775de00e56776165f7ae530092ec69 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 22 Nov 2026 15:30:44 -0600 Subject: [PATCH 3/6] test(history): Expect -- before send-keys data why: libtmux 0.64.0 ends send-keys options with `--` so text that starts with `-` reaches the pane (tmux-python/libtmux#892). The two history tests record the argv libtmux builds and compared it with the pre-0.64 shape. The bytes they protect, raw control keys and the single space added only on explicit suppression, are unchanged. what: - Expect `--` before the data argument in the raw send_keys and untimed batch history tests --- tests/test_history.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/test_history.py b/tests/test_history.py index ebc99e69..2d481d19 100644 --- a/tests/test_history.py +++ b/tests/test_history.py @@ -721,11 +721,11 @@ async def _exercise() -> None: asyncio.run(_exercise()) assert calls == [ - ("cmd", ("send-keys", "C-c")), - ("cmd", ("send-keys", "-l", "partial-TUI")), - ("cmd", ("send-keys", "/needle")), + ("cmd", ("send-keys", "--", "C-c")), + ("cmd", ("send-keys", "-l", "--", "partial-TUI")), + ("cmd", ("send-keys", "--", "/needle")), ("enter", ()), - ("cmd", ("send-keys", "-l", " explicit-secret")), + ("cmd", ("send-keys", "-l", "--", " explicit-secret")), ("enter", ()), ] @@ -793,10 +793,10 @@ async def _exercise() -> None: asyncio.run(_exercise()) assert calls == [ - ("cmd", ("send-keys", "C-c")), - ("cmd", ("send-keys", "-l", "TUI_BATCH_DEFAULT")), + ("cmd", ("send-keys", "--", "C-c")), + ("cmd", ("send-keys", "-l", "--", "TUI_BATCH_DEFAULT")), ("enter", ()), - ("cmd", ("send-keys", "-l", " batch-secret")), + ("cmd", ("send-keys", "-l", "--", " batch-secret")), ("enter", ()), ] From 69f5028e652465b2ddd2b1ddcbfbfb2b15e0d716 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 22 Nov 2026 15:30:56 -0600 Subject: [PATCH 4/6] ci(tests): Drop tmux 3.2a from the matrix why: libtmux 0.65.0 raised its minimum tmux to 3.3a (tmux-python/libtmux#888) and dropped 3.2a from its own CI. With the floor at libtmux 0.67.0, a 3.2a lane would test a combination the library no longer supports. what: - Remove tmux 3.2a from the test matrix - Remove its unused checksum pin from .github/tmux-releases.toml, matching libtmux's pin file --- .github/tmux-releases.toml | 1 - .github/workflows/tests.yml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/tmux-releases.toml b/.github/tmux-releases.toml index da27009c..e62467a1 100644 --- a/.github/tmux-releases.toml +++ b/.github/tmux-releases.toml @@ -2,7 +2,6 @@ # https://github.com/tmux/tmux/releases [releases] -"3.2a" = "551553a4f82beaa8dadc9256800bcc284d7c000081e47aa6ecbb6ff36eacd05f" "3.3a" = "e4fd347843bd0772c4f48d6dde625b0b109b7a380ff15db21e97c11a4dcdf93f" "3.4" = "551ab8dea0bf505c0ad6b7bb35ef567cdde0ccb84357df142c254f35a23e19aa" "3.5" = "2fe01942e7e7d93f524a22f2c883822c06bc258a4d61dba4b407353d7081950f" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e22c3c91..3f88bf64 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: python-version: ['3.15'] - tmux-version: ['3.2a', '3.3a', '3.4', '3.5', '3.6', '3.8', 'master'] + tmux-version: ['3.3a', '3.4', '3.5', '3.6', '3.8', 'master'] steps: - uses: actions/checkout@v7 From 5bcf73f9cb1311115df1db592014f78a3633b31a Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 22 Nov 2026 15:31:11 -0600 Subject: [PATCH 5/6] docs(tmux): State the tmux 3.3a minimum why: libtmux 0.65.0 made tmux 3.3a its minimum (tmux-python/libtmux#888), and the docs give libtmux's requirement as the server's tmux floor. With the floor at libtmux 0.67.0 they still named 3.2a. what: - Name tmux 3.3a as the minimum in README.md, docs/installation.md and the tmux table of docs/reference/compatibility.md --- README.md | 2 +- docs/installation.md | 2 +- docs/reference/compatibility.md | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 725eefa4..8c0469af 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ commands, read output, orchestrate panes. ## Quickstart -**Requirements:** Python 3.11+, tmux >= 3.2a on `$PATH`. +**Requirements:** Python 3.11+, tmux >= 3.3a on `$PATH`. The distribution is `libtmux-mcp`, the import is `libtmux_mcp`, and the installed executable is `libtmux-mcp`. diff --git a/docs/installation.md b/docs/installation.md index 17d502de..9cb76523 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -5,7 +5,7 @@ ## Requirements - Python 3.11+ -- tmux >= 3.2a +- tmux >= 3.3a - [uv](https://github.com/astral-sh/uv) ([install](https://docs.astral.sh/uv/getting-started/installation/)) or [pipx](https://github.com/pypa/pipx) ([install](https://pipx.pypa.io/stable/installation/)) — for running without a persistent install ## Run without installing diff --git a/docs/reference/compatibility.md b/docs/reference/compatibility.md index db5c0c57..f01ec2be 100644 --- a/docs/reference/compatibility.md +++ b/docs/reference/compatibility.md @@ -16,8 +16,8 @@ | tmux | Status | |------|--------| -| >= 3.2a | Supported | -| < 3.2a | Not supported (libtmux requirement) | +| >= 3.3a | Supported | +| < 3.3a | Not supported (libtmux requirement) | ## Dependencies From b77a81846e831c84eb22c26dec9e324343f04eff Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 22 Nov 2026 15:34:59 -0600 Subject: [PATCH 6/6] docs(CHANGES): libtmux 0.67.0 floor and tmux 3.3a why: Record what this branch changes for a reader deciding whether to upgrade: the tmux 3.3a minimum, the raised libtmux floor, and the send-keys and rename-window fixes the new libtmux brings. what: - Note the tmux 3.3a minimum under Breaking changes - Note the libtmux floor under Dependencies - State the leading-dash fix for send-keys and rename-window under Fixes, each checked against libtmux 0.62.0 and 0.67.0 on a live tmux server --- CHANGES | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/CHANGES b/CHANGES index e530660e..0f84bd7e 100644 --- a/CHANGES +++ b/CHANGES @@ -13,6 +13,16 @@ _Notes on upcoming releases will be added here_ `libtmux-mcp` requires Python 3.11 or newer. Python 3.10 reached end of life in October 2026. +**tmux 3.3a is the minimum** + +`libtmux-mcp` requires tmux 3.3a or newer, the minimum libtmux has required +since 0.65.0. (#162) + +### Dependencies + +**Minimum `libtmux>=0.67.0`** (was `>=0.62.0`). The fixes below come from +libtmux 0.64.0. (#162) + ### What's new **Kill tools ask the user first** @@ -39,6 +49,15 @@ seconds while visible. Other clients receive the same result as before. See The server advertises its logo as SVG and PNG for hosts that display one. +### Fixes + +**Text that starts with `-` reaches tmux** + +{tooliconl}`send-keys` types text that begins with `-`, such as `-n hello`, +into the pane. It previously typed nothing and reported success. +{tooliconl}`rename-window` accepts a name such as `-n`, which tmux previously +rejected as an unknown flag. (#162) + ### Documentation **The docs open with the libtmux.org top and documentation bars**