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 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** 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 1cd4039c..f01ec2be 100644 --- a/docs/reference/compatibility.md +++ b/docs/reference/compatibility.md @@ -16,14 +16,14 @@ | tmux | Status | |------|--------| -| >= 3.2a | Supported | -| < 3.2a | Not supported (libtmux requirement) | +| >= 3.3a | Supported | +| < 3.3a | Not supported (libtmux requirement) | ## Dependencies | 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/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) 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", ()), ] 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" }, ]