Title: feat: engine-ops async folding workspace builder by tony · Pull Request #1075 · tmux-python/tmuxp · GitHub
Open Graph Title: feat: engine-ops async folding workspace builder by tony · Pull Request #1075 · tmux-python/tmuxp
X Title: feat: engine-ops async folding workspace builder by tony · Pull Request #1075 · tmux-python/tmuxp
Description: Adds an opt-in async workspace builder backed by libtmux's experimental engine-ops stack, plus CLI switches for single-session, parallel, and matrix loads. What's here EngineOpsWorkspaceBuilder (workspace/builder/engine_ops.py): a WorkspaceBuilderProtocol that lowers an expanded workspace dict to libtmux's declarative Workspace IR and abuilds it asynchronously. The build folds: a multi-pane window's commands collapse into a handful of ;-chained dispatches instead of one send-keys per line, so a session renders in a few round-trips rather than dozens. Registered as the engine-ops entry point. workspace_builder: engine-ops config key selects the builder. tmuxp load --engine-ops selects it for a single load without editing the workspace file; the load spinner keeps working via a structural-event bridge. tmuxp load --engine-ops-engine {subprocess,control_mode} picks the async engine the fold runs on (default subprocess). subprocess forks a tmux per dispatch; control_mode drives the whole fold over one persistent tmux -C control-mode client, trading per-call process spawns for a single long-lived connection. Applies to --engine-ops, --parallel, and --expand alike. (imsg has no async engine, so it isn't offered here.) tmuxp load --parallel builds every WORKSPACE_FILE as one WorkspaceSet: all sessions compile into a single rebased, folded plan sharing one preflight, instead of one detached load per file. --dry-run prints the compiled tmux plan without touching the server; --no-fold dispatches one command per operation for debugging. -a/--append and -s are rejected (they describe single-session semantics). tmuxp load --expand KEY=V1,V2 expands one parameterized file into a session per value, substituting $KEY placeholders (e.g. session_name: app-$env). Repeat --expand for a matrix (Cartesian product). Implies the folded set build. Plugin support on the set path --parallel/--expand run the post-build before_script plugin hook on each built session (loaded before the fold so the version pre-flight still gates; run in the file's import sandbox; a raising hook is logged, not fatal to the other sessions). Mid-build hooks (before_workspace_builder, on_window_create, after_window_finished) can't fire without unfolding the plan, so a plugin that overrides one is skipped with a warning; reattach isn't fired on fresh builds (as on any fresh sequential load). Load a workspace on its own for the full hook sequence. See docs/topics/plugins.md. Notes Session collisions surface as FileExistsError (on_exists='error'); duplicate session names in a set are rejected up front. Progress streaming through abuild(on_event=...) is intentionally not wired here: the plugin hooks run after asyncio.run returns and never touch the event stream. (A future streaming PR should route on_event through a bounded non-blocking pump — libtmux's sets.py currently awaits the sink inline, which would head-of-line-block the fold.) Try it via uvx / uv tool This branch pins libtmux to its unreleased engine-ops branch via [tool.uv.sources], and a recent uv (tested with 0.11.25) honors that pin when installing from git — so no extra flags are needed. Do not add --with git+…libtmux…: the pin already supplies it, and a second URL fails with a "conflicting URLs" error. You'll also need tmux on your PATH. These commands attach to the new session; add -d (--detach) to build it in the background instead. Run it once, ephemerally, with uvx: uvx --from git+https://github.com/tmux-python/tmuxp.git@engine-ops tmuxp load --engine-ops ./workspace.yaml Pick the engine the fold runs on. The default is subprocess (a tmux fork per dispatch); pass --engine-ops-engine control_mode to drive the whole fold over one persistent tmux -C client instead: uvx --from git+https://github.com/tmux-python/tmuxp.git@engine-ops tmuxp load --engine-ops --engine-ops-engine control_mode ./workspace.yaml Build several workspaces as one folded set: uvx --from git+https://github.com/tmux-python/tmuxp.git@engine-ops tmuxp load --parallel a.yaml b.yaml Or expand one parameterized file into a matrix of sessions: uvx --from git+https://github.com/tmux-python/tmuxp.git@engine-ops tmuxp load --expand env=dev,prod ./app.yaml The --engine-ops-engine switch works on the set path too: uvx --from git+https://github.com/tmux-python/tmuxp.git@engine-ops tmuxp load --expand env=dev,prod --engine-ops-engine control_mode ./app.yaml Install it persistently as tmuxp on your PATH: uv tool install --from git+https://github.com/tmux-python/tmuxp.git@engine-ops tmuxp Then load any workspace through the folding builder: tmuxp load --engine-ops ./workspace.yaml Dependency Pins libtmux to the engine-ops branch via [tool.uv.sources] — the engine-ops workspace API is unreleased (libtmux.experimental). Draft until that lands.
Open Graph Description: Adds an opt-in async workspace builder backed by libtmux's experimental engine-ops stack, plus CLI switches for single-session, parallel, and matrix loads. What's here EngineOpsWorkspaceBu...
X Description: Adds an opt-in async workspace builder backed by libtmux's experimental engine-ops stack, plus CLI switches for single-session, parallel, and matrix loads. What's here EngineOpsWor...
Opengraph URL: https://github.com/tmux-python/tmuxp/pull/1075
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:33b52359-bb52-2df9-afa4-176a4dd380b7 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9A90:2AF6F7:29F553:3840CD:6B009DC9 |
| html-safe-nonce | 5c0aeb975a83d2c849d9f862cd42db3b826fca55f9a97d66d3747254bee5bc72 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QTkwOjJBRjZGNzoyOUY1NTM6Mzg0MENEOjZCMDA5REM5IiwidmlzaXRvcl9pZCI6IjcxMDE4NzY4NjQwOTU5MTk1NjEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f7944dc24b50e403ff65919c0265ec8c7f2008b2998850a5494eabc6c240d0ac |
| hovercard-subject-tag | pull_request:3991966758 |
| 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/1075/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 | Adds an opt-in async workspace builder backed by libtmux's experimental engine-ops stack, plus CLI switches for single-session, parallel, and matrix loads. What's here EngineOpsWorkspaceBu... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 52c95ce7e48016ae14399656b4ee812462b6f1fa28c5008c8394da64794c00b8 |
| 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 | 1c9ddec8215f9a94e295c8310c3579b9c54ba31a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width