Add caller-aware discovery and explicit startup#99
Open
tony wants to merge 6 commits into
Open
Conversation
why: Keep MCP tools on the invoking tmux server and preserve caller identity across transient environment changes. what: - Freeze the invocation environment and normalize selector precedence - Follow the caller socket path through libtmux Server.from_env - Share normalized cache targets and cover comma-bearing paths
why: Let agents execute the documented caller-pane discovery filter without forwarding synthetic model fields to libtmux's QueryList. what: - Split native filters from registered synthetic filters - Apply exact boolean synthetic matches after one serialization pass - Cover dict, JSON, exact, false, and invalid caller filters
why: Let agents resolve caller-relative tmux requests without a list and filter round trip or an error when invocation context is unavailable. what: - Add frozen typed caller and effective-target discovery - Keep routine outside, dead, stale, and mismatch states structured - Move the bounded discovery preload and document relational use
why: Let callers opt into session-local discovery without changing the server-wide default or widening when caller identity is unavailable. what: - Add fail-closed caller-session resolution to pane and window lists - Reject conflicting selectors and invalid direct-call scopes - Cover the contract in tests, tool docs, and the changelog
why: Bound hierarchy discovery so large tmux installations do not flood callers while preserving honest filtered totals. what: - Return typed page envelopes from all four hierarchy list tools - Add compact summary/full projections for windows and panes - Verify ordering, bounds, schemas, middleware exclusions, and docs
why: Starting a session on a dead target could silently launch a long-lived tmux daemon and load user configuration. what: - Gate dead-server session creation behind an explicit configurable opt-in - Report the startup-enabled fallback and improve dead-server recovery errors - Document and test the startup contract
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #99 +/- ##
==========================================
+ Coverage 85.30% 86.49% +1.18%
==========================================
Files 44 45 +1
Lines 3274 3547 +273
Branches 454 487 +33
==========================================
+ Hits 2793 3068 +275
- Misses 351 353 +2
+ Partials 130 126 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
is_callerpane filter executable.where_am_idiscovery tool plus explicitscope="caller_session"routing for window and pane lists.tools, with compact window and pane summaries by default.
create_sessionreceives explicitpermission or the server-wide startup setting enables it.
Contract changes
configured socket name, frozen caller socket, then tmux default.
list_servers,list_sessions,list_windows, andlist_panesnow returnpage objects. Read rows from
.items; the envelope also reportstotal,offset,limit, andtruncated.detail="summary"; callers can requestdetail="full". Their default scope remains server-wide for compatibility,while
scope="caller_session"fails closed when caller identity is absent,stale, or on another effective target.
create_sessionno longer starts a stopped tmux target by default. Theserver_startedfield records the observable startup-enabled fallback aftera no-start attempt proved the target absent; it does not claim process
ownership across an external-client race.
Verification
uv run ruff format . --checkuv run ruff check .uv run mypyuv run pytest— 826 passed in each of two complete runsuv run pytest tests/test_server_tools.py -ra— 48 passedjust build-docsuv buildgit diff --check main..HEADCloses #92.
Closes #93.
Closes #94.
Closes #95.
Closes #96.