Title: Experimental: pure-chain ChainWorkspaceBuilder + `--builder=chain` by tony · Pull Request #1054 · tmux-python/tmuxp · GitHub
Open Graph Title: Experimental: pure-chain ChainWorkspaceBuilder + `--builder=chain` by tony · Pull Request #1054 · tmux-python/tmuxp
X Title: Experimental: pure-chain ChainWorkspaceBuilder + `--builder=chain` by tony · Pull Request #1054 · tmux-python/tmuxp
Description: Summary Add a ChainWorkspaceBuilder that constructs a workspace's entire session → window → pane tree from a single libtmux._experimental.chain.ForwardPlan, resolved over the minimum number of tmux invocations instead of one subprocess per new-window / split-window. Add an opt-in --builder=chain flag to tmuxp load (Env: TMUXP_BUILDER); the default builder is unchanged. Experimental: depends on libtmux's _experimental.chain API, pinned to a sibling worktree via [tool.uv.sources]. Not for merge — companion to the libtmux experiment. Changes by area src/tmuxp/workspace/chain_builder.py (new) ChainWorkspaceBuilder, a subclass of WorkspaceBuilder, overriding build(): the session is created, then every window and pane is described in one ForwardPlan seeded from the session and resolved via ServerPlanRunner. Reuses the parent's helpers (_wait_for_pane_ready, config_after_window, focus handling, plugin hooks, before_script, session options). src/tmuxp/cli/load.py Adds --builder={default,chain} (Env TMUXP_BUILDER), threaded through command_load → load_workspace as builder_name, selecting the builder class. The rest of the load path is unchanged because the subclass mirrors the constructor, .session, and event hooks. pyproject.toml [tool.uv.sources] pins libtmux to the sibling ../libtmux worktree so the experimental chain API is importable. Design decisions Reuse the default window, don't orphan it. Seeding with ForwardPlan.from_session(session) and addressing window 1 through seed.initial_window / seed.initial_pane builds onto the session's default window instead of moving it aside and killing it (the move-to-99 + kill dance the classic builder performs). send_keys_mode, default readiness. The chain batches split + send-keys without waiting for the new pane's shell prompt. readiness builds only the structure via the chain, then sends each pane's commands shell-ready (matching the classic builder, deterministic). batched folds send-keys into the plan for the fullest "all at once" — faster, but it can race an interactive prompt. Sync, not async. tmuxp has no async today and a workspace build is causally serial (windows depend on the session; decorations depend on captured ids), so the chain's synchronous path (ServerPlanRunner / run_resolving) is the right fit. Subclass, not fork. Extending WorkspaceBuilder keeps .session, find_current_attached_session, the on_* event hooks, and the plugin lifecycle identical, so load.py needs only to pick the class. Test plan Lint + format clean on the new builder, tests, and the CLI change Type-check (mypy) clean tests/workspace/test_chain_builder.py — two/three-pane structure, window + pane focus, readiness-mode commands landing, batched mode, and --builder flag parsing Existing tests/workspace/test_builder.py and tests/cli/test_load.py still pass (the subclass leaves the default builder untouched) Smoke: tmuxp load -d --builder=chain tests/fixtures/workspace/builder/two_pane.yaml builds editor (2 panes), logging, test, matching the default builder Companion PR Depends on the libtmux experimental chain API: tmux-python/libtmux#685.
Open Graph Description: Summary Add a ChainWorkspaceBuilder that constructs a workspace's entire session → window → pane tree from a single libtmux._experimental.chain.ForwardPlan, resolved over the minimum number of...
X Description: Summary Add a ChainWorkspaceBuilder that constructs a workspace's entire session → window → pane tree from a single libtmux._experimental.chain.ForwardPlan, resolved over the minimum numbe...
Opengraph URL: https://github.com/tmux-python/tmuxp/pull/1054
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:6f93a65d-e987-a0a2-96ba-dbd3e615aa7a |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 935E:2E2180:16995F:1EEB70:6B008277 |
| html-safe-nonce | 3d823ca1567e4cdb75fd78e247c0a69a53d75bdaf7c01ae9b239ddc6c8ec8072 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MzVFOjJFMjE4MDoxNjk5NUY6MUVFQjcwOjZCMDA4Mjc3IiwidmlzaXRvcl9pZCI6IjEzNzcxNjUxNDYyNDUzMzM2MjMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f91e9ec4edd9400fc0001fa60d174c025b1515b45f4e8aabf8e5a84d2f541783 |
| hovercard-subject-tag | pull_request:3904426232 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/tmux-python/tmuxp/pull/1054/files |
| twitter:image | https://avatars.githubusercontent.com/u/26336?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/26336?s=400&v=4 |
| og:image:alt | Summary Add a ChainWorkspaceBuilder that constructs a workspace's entire session → window → pane tree from a single libtmux._experimental.chain.ForwardPlan, resolved over the minimum number of... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 82c186f13e104004ab7bdb779f3195e59dd38bfde531aaa74b76470fc2462b83 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/tmux-python/tmuxp git https://github.com/tmux-python/tmuxp.git |
| octolytics-dimension-user_id | 37234308 |
| octolytics-dimension-user_login | tmux-python |
| octolytics-dimension-repository_id | 12398170 |
| octolytics-dimension-repository_nwo | tmux-python/tmuxp |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 12398170 |
| octolytics-dimension-repository_network_root_nwo | tmux-python/tmuxp |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | d1bc2aa1939001689f5ce935982c10a6138f745c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width