mux-sesh 1.10.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/README.md +133 -86
  2. package/bin/mux-sesh +45 -17
  3. package/bin/platform.sh +139 -0
  4. package/bin/postinstall +22 -0
  5. package/package.json +27 -38
  6. package/src/agents/index.ts +0 -1
  7. package/src/agents/session-name.ts +0 -24
  8. package/src/app/commands.ts +0 -138
  9. package/src/app/controller.ts +0 -437
  10. package/src/app/controls.ts +0 -123
  11. package/src/app/core-state.ts +0 -75
  12. package/src/app/data.ts +0 -130
  13. package/src/app/derived.ts +0 -77
  14. package/src/app/effects.ts +0 -650
  15. package/src/app/handlers.ts +0 -406
  16. package/src/app/keyboard.ts +0 -165
  17. package/src/app/modal-keyboard.ts +0 -137
  18. package/src/app/modal-state.ts +0 -53
  19. package/src/app/modals-layer.tsx +0 -159
  20. package/src/app/modals.ts +0 -108
  21. package/src/app/notifications.ts +0 -21
  22. package/src/app/opencode.ts +0 -49
  23. package/src/app/operations.ts +0 -31
  24. package/src/app/runtime.ts +0 -79
  25. package/src/app/screen.tsx +0 -240
  26. package/src/app/state.ts +0 -178
  27. package/src/app/textarea.ts +0 -16
  28. package/src/app/view.ts +0 -101
  29. package/src/app.tsx +0 -50
  30. package/src/config/index.ts +0 -475
  31. package/src/config/listed-sessions.ts +0 -33
  32. package/src/config/paths.ts +0 -13
  33. package/src/config/session-rules.ts +0 -100
  34. package/src/config/store.ts +0 -33
  35. package/src/files/target.ts +0 -96
  36. package/src/handlers/action-helpers.ts +0 -83
  37. package/src/handlers/actions.ts +0 -216
  38. package/src/handlers/keyboard/agents.ts +0 -134
  39. package/src/handlers/keyboard/index.ts +0 -5
  40. package/src/handlers/keyboard/new-session.ts +0 -58
  41. package/src/handlers/keyboard/normal.ts +0 -220
  42. package/src/handlers/keyboard/search.ts +0 -118
  43. package/src/handlers/keyboard/shared.ts +0 -117
  44. package/src/herdr/backend.ts +0 -357
  45. package/src/herdr/protocol.ts +0 -268
  46. package/src/index.tsx +0 -23
  47. package/src/items/order.ts +0 -95
  48. package/src/multiplexer/backend.ts +0 -43
  49. package/src/multiplexer/command.ts +0 -48
  50. package/src/multiplexer/index.ts +0 -21
  51. package/src/multiplexer/items.ts +0 -66
  52. package/src/multiplexer/resolve.ts +0 -109
  53. package/src/multiplexer/tmux-backend.ts +0 -87
  54. package/src/multiplexer/types.ts +0 -93
  55. package/src/opencode/constants.ts +0 -7
  56. package/src/opencode/index.ts +0 -20
  57. package/src/opencode/parser.ts +0 -45
  58. package/src/opencode/session-name.ts +0 -13
  59. package/src/opencode/session.ts +0 -146
  60. package/src/opencode/sqlite.ts +0 -447
  61. package/src/opencode/stats.ts +0 -26
  62. package/src/opencode/tokens.ts +0 -116
  63. package/src/opencode/types.ts +0 -33
  64. package/src/preview/project.ts +0 -362
  65. package/src/projects/session-links.ts +0 -52
  66. package/src/search/fff.ts +0 -224
  67. package/src/search/index.ts +0 -198
  68. package/src/settings.ts +0 -465
  69. package/src/styles/omarchy.ts +0 -295
  70. package/src/styles/opencode-themes-a.ts +0 -1442
  71. package/src/styles/opencode-themes-b.ts +0 -1212
  72. package/src/styles/opencode-tui-colors.ts +0 -1784
  73. package/src/styles/terminal-palette.ts +0 -156
  74. package/src/styles/theme-follow.ts +0 -94
  75. package/src/styles/theme.tsx +0 -311
  76. package/src/tmux/actions.ts +0 -145
  77. package/src/tmux/details.ts +0 -104
  78. package/src/tmux/helpers.ts +0 -35
  79. package/src/tmux/index.ts +0 -10
  80. package/src/tmux/list.ts +0 -31
  81. package/src/tmux/project-discovery.ts +0 -116
  82. package/src/tmux/project-loader.ts +0 -92
  83. package/src/tmux/project-zoxide.ts +0 -128
  84. package/src/tmux/projects.ts +0 -38
  85. package/src/tmux/workflows.ts +0 -26
  86. package/src/types/index.ts +0 -221
  87. package/src/ui/AgentSessionGroup.tsx +0 -93
  88. package/src/ui/CommandsModal.tsx +0 -246
  89. package/src/ui/ErrorScreen.tsx +0 -102
  90. package/src/ui/HighlightedText.tsx +0 -60
  91. package/src/ui/ItemList.tsx +0 -119
  92. package/src/ui/Modal.tsx +0 -48
  93. package/src/ui/OpencodeStatsPanel.tsx +0 -233
  94. package/src/ui/RenameModal.tsx +0 -42
  95. package/src/ui/SearchInput.tsx +0 -43
  96. package/src/ui/SessionDetailsPanel.tsx +0 -273
  97. package/src/ui/SessionList.tsx +0 -119
  98. package/src/ui/SettingEditorModal.tsx +0 -55
  99. package/src/ui/SettingOptionsModal.tsx +0 -95
  100. package/src/ui/SettingsModal.tsx +0 -102
  101. package/src/ui/Toast.tsx +0 -34
  102. package/src/ui/VersionBadge.tsx +0 -45
  103. package/src/ui/item-icon.ts +0 -110
  104. package/src/ui/list-window.ts +0 -35
  105. package/src/ui/session-meta.ts +0 -10
  106. package/src/ui/text-columns.ts +0 -17
  107. package/src/ui/use-textarea-focus.ts +0 -29
  108. package/src/update/events.ts +0 -28
  109. package/src/update/index.ts +0 -91
  110. package/src/update/installation.ts +0 -161
  111. package/src/update/version.ts +0 -33
  112. package/src/util/ansi.ts +0 -3
  113. package/src/util/browser.ts +0 -37
  114. package/src/util/clipboard.ts +0 -22
  115. package/src/util/errors.ts +0 -170
  116. package/src/util/github.ts +0 -100
  117. package/src/util/glob.ts +0 -51
  118. package/src/util/path-display.ts +0 -98
  119. package/src/util/perf.ts +0 -23
  120. package/src/util/shell.ts +0 -3
  121. package/src/util/shutdown.ts +0 -111
  122. package/src/util/terminal.ts +0 -28
  123. package/src/util/time.ts +0 -48
  124. package/tsconfig.json +0 -25
package/README.md CHANGED
@@ -1,89 +1,141 @@
1
1
  # mux-sesh
2
2
 
3
- Fast tmux session and Herdr workspace switching from a polished terminal UI.
3
+ A keyboard-driven picker for tmux sessions and Herdr workspaces. Switch to what's running, start a
4
+ session from any project, and close what you're done with, all from one popup.
4
5
 
5
6
  <p align="center">
6
7
  <img src="screenshot.png" alt="mux-sesh screenshot" width="800">
7
8
  </p>
8
9
 
9
- ## Why mux-sesh
10
+ - **Switch fast:** live sessions, pinned sessions and agent panes in one list, with fuzzy search
11
+ that learns what you open.
12
+ - **Start from a project:** pick a folder, a file or a GitHub URL. mux-sesh shows exactly what
13
+ Enter will do (focus, create or clone) before it does it.
14
+ - **Close safely:** every close is confirmed, and nothing but the session itself is ever removed.
15
+ - **Configure in the app:** a settings screen with real editors, saved to one JSON file.
10
16
 
11
- - Switch between live tmux sessions or Herdr workspaces without leaving the keyboard.
12
- - Launch local projects from a single, searchable picker.
13
- - Keep reusable project rules in config instead of shell scripts.
14
- - Stay inside your multiplexer with previews, quick actions, and lightweight workflows.
17
+ ## Install
15
18
 
16
- ## Quick Start
19
+ You need **tmux** or **Herdr 0.7.5 or newer**, and **git** if you want to clone repositories from
20
+ mux-sesh. Pick one:
17
21
 
18
- `mux-sesh` runs on Bun and talks directly to tmux or Herdr. Herdr needs no mux-sesh plugin.
19
-
20
- Prerequisites:
21
-
22
- - [Bun](https://bun.sh)
23
- - [tmux](https://github.com/tmux/tmux/wiki) or Herdr 0.7.5 or newer
24
- - [git](https://git-scm.com) for cloning GitHub repositories from the new-session flow
25
-
26
- Install globally:
22
+ ```bash
23
+ npm install -g mux-sesh
24
+ ```
27
25
 
28
26
  ```bash
29
27
  bun install -g mux-sesh
30
28
  ```
31
29
 
32
- Run it:
30
+ ```bash
31
+ mise use -g npm:mux-sesh
32
+ ```
33
+
34
+ The package installs a prebuilt binary, so mux-sesh doesn't need Bun or Node at runtime. Supported
35
+ platforms are Linux (x64 and arm64, glibc and musl) and macOS (x64 and arm64), with a baseline
36
+ build for x64 CPUs without AVX2. The binary ships as an optional dependency, so don't install with
37
+ `--omit=optional`.
38
+
39
+ Check it works:
33
40
 
34
41
  ```bash
35
42
  mux-sesh
36
43
  ```
37
44
 
38
- Recommended tmux binding:
45
+ ### Updating
46
+
47
+ With `auto_update` on (the default), npm and Bun installs update themselves in the background;
48
+ the status line tells you to restart when a new version is ready. mise and Homebrew installs are
49
+ left to their own tool, and mux-sesh shows the command to run, such as `mise upgrade npm:mux-sesh`.
50
+
51
+ Upgrading from 1.x? Read the [CHANGELOG](CHANGELOG.md) first: 2.0 validates your config and
52
+ changes a few defaults.
53
+
54
+ To uninstall, use the same tool: `npm uninstall -g mux-sesh`, `bun remove -g mux-sesh` or
55
+ `mise uninstall npm:mux-sesh`.
56
+
57
+ ## Open it from a key
58
+
59
+ mux-sesh works best as a popup over your current work.
60
+
61
+ **tmux:** add this to `~/.tmux.conf`, then reload with `tmux source-file ~/.tmux.conf`:
39
62
 
40
63
  ```tmux
41
64
  bind-key -n M-w popup -E -w 62% -h 70% "mux-sesh"
42
65
  ```
43
66
 
44
- Reload tmux after adding the binding:
67
+ `Alt+W` now opens the picker. To start new sessions in the current pane's directory, add
68
+ `-d "#{pane_current_path}"` before `"mux-sesh"`.
45
69
 
46
- ```bash
47
- tmux source-file ~/.tmux.conf
70
+ **Herdr:** add a popup command to Herdr's `config.toml`, then run `herdr server reload-config`:
71
+
72
+ ```toml
73
+ [[keys.command]]
74
+ key = "prefix+alt+w"
75
+ type = "popup"
76
+ command = "mux-sesh"
77
+ description = "mux-sesh"
78
+ width = "70%"
79
+ height = "70%"
48
80
  ```
49
81
 
50
- ## How It Works
82
+ You can also run `mux-sesh` from any shell. Without tmux or Herdr around it, mux-sesh uses a
83
+ running Herdr server first, then tmux (see [Backend Selection](docs/configuration.md#backend-selection)).
51
84
 
52
- - Sessions view shows live tmux sessions or Herdr workspaces.
53
- - Projects view shows scanned or configured directories.
54
- - Selecting a project attaches to an existing session or workspace when possible, or creates one.
55
- - The new-session flow searches files and directories under `project_paths` as you type, powered by [fff](https://github.com/dmtrKovalenko/fff).
56
- - Selecting a file creates a session in the file's directory and opens it in your editor.
57
- - Newly created Herdr workspaces and tabs are focused automatically when launching a project or editor.
58
- - The Agents section shows Herdr workspaces with detected native agent status alongside tmux agent sessions and `tui_chat`; Herdr `unknown` status and age are hidden.
59
- - The new-session flow can also clone a GitHub repository into your configured repos directory.
85
+ ## Use it
60
86
 
61
- Herdr concepts map directly into the UI:
87
+ The picker opens on the session you're in. Type to search (in `vim` mode, press `i` first), move
88
+ with `j`/`k` or the arrows, and press `enter` to switch.
62
89
 
63
- | mux-sesh | Herdr |
64
- | -------- | --------- |
65
- | Session | Workspace |
66
- | Window | Tab |
67
- | Pane | Pane |
90
+ | To… | Do this |
91
+ | --------------------------------------- | ------------------------------------------------------------------------- |
92
+ | Switch to a session | Select it and press `enter`, or press `1`–`9` for a visible row |
93
+ | Start a session from a project | Press `n`, pick a project or folder (or paste a GitHub URL), then `enter` |
94
+ | Open a file in a new session | In New: `ctrl+o`, type a file name or path, then `enter` |
95
+ | Change the new session before it starts | In New: `ctrl+n` renames it, `ctrl+t` changes its startup command |
96
+ | Start a session in the current folder | In New: `ctrl+g` |
97
+ | Close a session | Press `d`, then `d` again to confirm; any other key cancels |
98
+ | Close several sessions | Mark each with `m`, then press `d` to review and confirm them together |
99
+ | See details about the selected row | `v` |
100
+ | Run any command, change the theme | `ctrl+p`, then type, such as `theme` or `settings` |
68
101
 
69
- Backend detection uses `HERDR_ENV`, then `TMUX`, then an explicit `backend`, then running servers. Auto detection chooses tmux when both run and defaults to installed tmux when neither runs.
102
+ New shows a summary line that says exactly what `enter` will do, for example
103
+ `Focus existing 'api' in ~/dev/api`. Cloning a GitHub URL goes into your `repos_path` and never
104
+ deletes anything. Closing only ever closes the tmux session or Herdr workspace: files, worktrees
105
+ and branches are never touched.
70
106
 
71
- ```json
72
- { "backend": "herdr" }
73
- ```
107
+ ### Essential keys
108
+
109
+ Default mode is `vim`, with `ctrl+x` as the prefix for secondary actions.
74
110
 
75
- Explicit Herdr selection is strict: its server must already run, and mux-sesh never starts it or falls back. Config changes apply on the next mux-sesh launch.
111
+ <!-- keys: vim normal subset -->
76
112
 
77
- ## Minimal Configuration
113
+ | Key | Action |
114
+ | ---------- | ---------------------------------------------------------------------- |
115
+ | `enter` | Open the selected row: focus a live session, or create from a project |
116
+ | `i` | Search |
117
+ | `n` | New session |
118
+ | `d` | Close the selected session (`d` again confirms), or review marked rows |
119
+ | `m` | Mark or unmark a row for a batch close |
120
+ | `v` | Toggle details |
121
+ | `ctrl+x s` | Show sessions |
122
+ | `ctrl+x p` | Show projects |
123
+ | `ctrl+x r` | Rename session |
124
+ | `ctrl+p` | Command palette; type `theme` for the theme picker |
78
125
 
79
- Config lives at `~/.config/mux-sesh/config.json`.
126
+ Quit with `q` or `esc`. In text fields, letters type; only arrows, `enter`, `esc` and `ctrl+…`
127
+ keys act. Prefer typing straight into search? Set `"keybind_mode": "standard"`. Every key for both
128
+ modes: [docs/keybindings.md](docs/keybindings.md).
129
+
130
+ ## Set it up
131
+
132
+ mux-sesh runs with no config. To tell it where your projects live, open **Settings**
133
+ (`ctrl+p`, then `settings`) or edit `~/.config/mux-sesh/config.json`:
80
134
 
81
135
  ```json
82
136
  {
83
137
  "project_paths": ["~/dev"],
84
138
  "repos_path": "~/dev/repos",
85
- "keybind_mode": "vim",
86
- "prefix_key": "ctrl+x",
87
139
  "theme": "rosepine",
88
140
  "default_session": {
89
141
  "startup_command": "nvim"
@@ -91,55 +143,44 @@ Config lives at `~/.config/mux-sesh/config.json`.
91
143
  }
92
144
  ```
93
145
 
94
- Full configuration reference: [docs/configuration.md](docs/configuration.md)
95
-
96
- ## Essential Keys
97
-
98
- Default mode is `vim`.
99
-
100
- | Key | Action |
101
- | ----------- | --------------------- |
102
- | `j` / `k` | Move |
103
- | `Enter` | Attach or create |
104
- | `i` | Search |
105
- | `n` | New session |
106
- | `d` | Kill selected session |
107
- | `1-9` | Quick select |
108
- | `Ctrl+P` | Open command palette. Type `theme` for the theme picker |
109
- | `q` / `Esc` | Quit |
110
-
111
- With the default prefix key, secondary actions live behind `ctrl+x`:
146
+ - `project_paths`: folders scanned for projects and searched by New.
147
+ - `repos_path`: where GitHub URLs are cloned.
148
+ - `default_session.startup_command`: what runs in a new session.
149
+ - `theme`: any built-in theme, or `system` to follow Omarchy or your terminal.
112
150
 
113
- - `ctrl+x s` sessions
114
- - `ctrl+x p` projects
115
- - `ctrl+x l` last session (tmux only)
116
- - `ctrl+x g` git root session
117
- - `ctrl+x r` rename session
118
- - `ctrl+x e` edit configured target
119
- - `ctrl+x Shift+R` refresh
151
+ Changes from Settings save immediately. Edits to the file apply the next time mux-sesh starts. If
152
+ the file has an invalid value, mux-sesh shows which field is wrong instead of starting, and never
153
+ changes the file; fix it and press `r`. For completion and validation in your editor, point it at
154
+ [`mux-sesh.schema.json`](mux-sesh.schema.json).
120
155
 
121
- In vim mode, `s` and `p` are also available as direct view switches.
156
+ Project rules (a fixed session name, a startup command or an icon per project), wildcard rules,
157
+ pinned and hidden sessions, sorting, zoxide and themes are all covered in
158
+ [docs/configuration.md](docs/configuration.md).
122
159
 
123
- Full keybinding reference: [docs/keybindings.md](docs/keybindings.md)
160
+ ### Search history
124
161
 
125
- ## Crash recovery
162
+ Searches rank what you open often a little higher. Names, folders and open counts are kept in
163
+ `~/.local/state/mux-sesh/frecency.jsonl` and never leave your machine. Delete the file to clear it,
164
+ or set `"search_history": false`. See [Search History](docs/configuration.md#search-history).
126
165
 
127
- mux-sesh disables OpenTUI's automatic error console so a crash cannot trap the terminal. React UI failures show a recovery screen with these controls:
166
+ ## When something goes wrong
128
167
 
129
- - `c` copies the complete diagnostics report with OSC 52 (including tmux passthrough)
130
- - `o` opens a prefilled GitHub issue for review
131
- - `r` retries the application UI
132
- - `q`, `Esc`, or `Ctrl+C` restores the terminal and exits
133
- - `↑`/`↓`, `j`/`k`, `PgUp`/`PgDn`, `Home`, and `End` scroll long diagnostics
168
+ - **mux-sesh won't start:** a startup screen names the problem (an invalid config field, or no
169
+ usable tmux or Herdr) and what to do. Press `r` to retry after fixing it.
170
+ - **"no prebuilt binary":** reinstall without `--omit=optional`.
171
+ - **A crash:** a recovery screen shows a diagnostics report. `c` copies it, `o` asks before opening
172
+ a prefilled GitHub issue (opening it sends the report to GitHub), `r` recovers and `q` quits. The
173
+ report is redacted, but read it before sharing.
134
174
 
135
- Uncaught process-level failures restore the terminal first, then print the diagnostics and report URL to normal terminal scrollback before exiting with status 1. Prefilled issues are never submitted automatically; review the report before sending it.
175
+ More: [Crash Recovery](docs/workflows.md#crash-recovery).
136
176
 
137
177
  ## Docs
138
178
 
139
- - [Configuration](docs/configuration.md)
140
- - [Themes](docs/themes.md)
141
- - [Keybindings](docs/keybindings.md)
142
- - [Workflows](docs/workflows.md)
179
+ - [Workflows](docs/workflows.md): step-by-step guides for every task
180
+ - [Configuration](docs/configuration.md): every option and rule
181
+ - [Keybindings](docs/keybindings.md): every key, in vim and standard mode
182
+ - [Themes](docs/themes.md): built-in themes, custom themes and Omarchy
183
+ - [Changelog](CHANGELOG.md)
143
184
 
144
185
  ## Development
145
186
 
@@ -147,9 +188,14 @@ Uncaught process-level failures restore the terminal first, then print the diagn
147
188
  bun install
148
189
  bun run typecheck
149
190
  bun test
191
+ bun run dev
150
192
  ```
151
193
 
152
- Use `bun run build` only when you need the compiled binary in `dist/mux-sesh`.
194
+ `bun run dev` runs from source with your real config. `bun run dev:config-error`,
195
+ `dev:backend-error` and `dev:crash` open each failure screen. [AGENTS.md](AGENTS.md) describes the
196
+ source layout, every script, the test conventions and the rules for never touching a live tmux or
197
+ Herdr session from tests. Builds, packing and release checks are in
198
+ [Install From Source](docs/workflows.md#install-from-source).
153
199
 
154
200
  ## License
155
201
 
@@ -157,5 +203,6 @@ MIT. See [LICENSE](LICENSE).
157
203
 
158
204
  ## Related
159
205
 
160
- - [mux-manager](https://github.com/quiet-ghost/mux-manager) for Telescope-based tmux session management inside Neovim
206
+ - [mux-manager](https://github.com/quiet-ghost/mux-manager) for Telescope-based tmux session
207
+ management inside Neovim
161
208
  - Built with [OpenTUI](https://github.com/anomalyco/opentui)
package/bin/mux-sesh CHANGED
@@ -1,6 +1,8 @@
1
1
  #!/bin/sh
2
2
  set -e
3
3
 
4
+ invocation_cwd="$(pwd -P)"
5
+
4
6
  # Get the real path of this script, resolving any symlinks
5
7
  script_path="$0"
6
8
  while [ -L "$script_path" ]; do
@@ -11,24 +13,50 @@ while [ -L "$script_path" ]; do
11
13
  esac
12
14
  done
13
15
  script_dir="$(dirname "$script_path")"
14
- script_dir="$(cd "$script_dir" && pwd)"
15
-
16
- # Find the package directory and run with bun
17
- resolved=""
18
- current_dir="$script_dir"
19
- while [ "$current_dir" != "/" ]; do
20
- candidate="$current_dir/src/index.tsx"
21
- if [ -f "$candidate" ]; then
22
- resolved="$candidate"
23
- break
16
+ script_dir="$(cd "$script_dir" && pwd -P)"
17
+ package_root="${script_dir%/*}"
18
+
19
+ . "$script_dir/platform.sh"
20
+
21
+ # A dev checkout runs from source; Bun needs the package directory to bootstrap its JSX settings.
22
+ run_source() {
23
+ current_dir="$script_dir"
24
+ while [ "$current_dir" != "/" ]; do
25
+ if [ -f "$current_dir/src/index.tsx" ]; then
26
+ if ! command -v bun >/dev/null 2>&1; then
27
+ printf 'mux-sesh: running from source in %s needs Bun on PATH. Install Bun from https://bun.sh, then retry.\n' "$current_dir" >&2
28
+ exit 1
29
+ fi
30
+
31
+ cd "$current_dir"
32
+ MUX_SESH_INVOCATION_CWD="$invocation_cwd" exec bun "$current_dir/src/index.tsx" "$@"
33
+ fi
34
+ current_dir="$(dirname "$current_dir")"
35
+ done
36
+ }
37
+
38
+ # exec replaces this shell, so the binary owns the terminal, signals, and exit status directly.
39
+ run_binary() {
40
+ binary=""
41
+
42
+ # bin/postinstall links the binary it resolved; without the link, search as postinstall would.
43
+ if [ -x "$script_dir/.platform-binary" ]; then
44
+ binary="$script_dir/.platform-binary"
45
+ else
46
+ binary="$(mux_sesh_find_binary "$package_root")" || binary=""
24
47
  fi
25
- current_dir="$(dirname "$current_dir")"
26
- done
27
48
 
28
- if [ -z "$resolved" ]; then
29
- printf "Could not find mux-sesh source files\n" >&2
30
- exit 1
49
+ if [ -n "$binary" ]; then
50
+ MUX_SESH_INVOCATION_CWD="$invocation_cwd" exec "$binary" "$@"
51
+ fi
52
+ }
53
+
54
+ if [ "${MUX_SESH_DEV:-}" = 1 ]; then
55
+ run_source "$@"
31
56
  fi
32
57
 
33
- # Execute with bun
34
- cd "$(dirname "$resolved")/.." && exec bun "$resolved" "$@"
58
+ run_binary "$@"
59
+ run_source "$@"
60
+
61
+ mux_sesh_missing_binary_message >&2
62
+ exit 1
@@ -0,0 +1,139 @@
1
+ # Platform binary selection shared by bin/mux-sesh and bin/postinstall. Sourced, not executed.
2
+
3
+ # Prints platform package names in preference order. Arguments: os arch libc avx2(yes|no).
4
+ # Keep in sync with Host.candidates in tools/build/targets.ts; tests compare both.
5
+ mux_sesh_platform_candidates() {
6
+ _mux_os=$1
7
+ _mux_arch=$2
8
+ _mux_libc=$3
9
+ _mux_avx2=$4
10
+
11
+ if [ "$_mux_arch" != x64 ]; then
12
+ _mux_variants=default
13
+ elif [ "$_mux_avx2" = yes ]; then
14
+ _mux_variants="default baseline"
15
+ else
16
+ _mux_variants="baseline default"
17
+ fi
18
+
19
+ if [ "$_mux_os" != linux ]; then
20
+ _mux_libcs=none
21
+ elif [ "$_mux_libc" = musl ]; then
22
+ _mux_libcs="musl glibc"
23
+ else
24
+ _mux_libcs="glibc musl"
25
+ fi
26
+
27
+ for _mux_candidate_libc in $_mux_libcs; do
28
+ for _mux_variant in $_mux_variants; do
29
+ _mux_name="mux-sesh-$_mux_os-$_mux_arch"
30
+
31
+ if [ "$_mux_variant" = baseline ]; then
32
+ _mux_name="$_mux_name-baseline"
33
+ fi
34
+
35
+ if [ "$_mux_candidate_libc" = musl ]; then
36
+ _mux_name="$_mux_name-musl"
37
+ fi
38
+
39
+ printf '%s\n' "$_mux_name"
40
+ done
41
+ done
42
+ }
43
+
44
+ # Sets mux_sesh_os, mux_sesh_arch, mux_sesh_libc, and mux_sesh_avx2 for this machine.
45
+ # Most hosts are answered by builtins plus one uname call, keeping launch overhead low.
46
+ mux_sesh_detect_host() {
47
+ mux_sesh_uname="$(uname -s -m)"
48
+
49
+ case "${mux_sesh_uname%% *}" in
50
+ Linux) mux_sesh_os=linux ;;
51
+ Darwin) mux_sesh_os=darwin ;;
52
+ *) mux_sesh_os=unsupported ;;
53
+ esac
54
+
55
+ case "${mux_sesh_uname##* }" in
56
+ x86_64 | amd64) mux_sesh_arch=x64 ;;
57
+ aarch64 | arm64) mux_sesh_arch=arm64 ;;
58
+ *) mux_sesh_arch=unsupported ;;
59
+ esac
60
+
61
+ # Alpine marks itself and a glibc loader means glibc; other systems name their libc in ldd.
62
+ mux_sesh_libc=none
63
+
64
+ if [ "$mux_sesh_os" != linux ]; then
65
+ :
66
+ elif [ -f /etc/alpine-release ]; then
67
+ mux_sesh_libc=musl
68
+ elif [ -e /lib64/ld-linux-x86-64.so.2 ] || [ -e /lib/ld-linux-aarch64.so.1 ]; then
69
+ mux_sesh_libc=glibc
70
+ elif ldd --version 2>&1 | grep -qi musl; then
71
+ mux_sesh_libc=musl
72
+ else
73
+ mux_sesh_libc=glibc
74
+ fi
75
+
76
+ # Bun's default x64 runtime needs AVX2. Unknown support answers no, so baseline builds come first.
77
+ mux_sesh_avx2=no
78
+
79
+ if [ "$mux_sesh_arch" != x64 ]; then
80
+ :
81
+ elif [ "$mux_sesh_os" = linux ]; then
82
+ if grep -qw avx2 /proc/cpuinfo 2>/dev/null; then mux_sesh_avx2=yes; fi
83
+ elif [ "$mux_sesh_os" = darwin ]; then
84
+ if [ "$(sysctl -n hw.optional.avx2_0 2>/dev/null)" = 1 ]; then mux_sesh_avx2=yes; fi
85
+ fi
86
+ }
87
+
88
+ # Prints the best installed platform binary. npm nests it under the package; bun and pnpm hoist it beside.
89
+ mux_sesh_find_binary() {
90
+ _mux_root=$1
91
+ mux_sesh_detect_host
92
+
93
+ if [ "$mux_sesh_os" = unsupported ] || [ "$mux_sesh_arch" = unsupported ]; then
94
+ return 1
95
+ fi
96
+
97
+ for _mux_name in $(mux_sesh_platform_candidates "$mux_sesh_os" "$mux_sesh_arch" "$mux_sesh_libc" "$mux_sesh_avx2"); do
98
+ _mux_dir=$_mux_root
99
+
100
+ while :; do
101
+ _mux_binary="$_mux_dir/node_modules/$_mux_name/bin/mux-sesh"
102
+
103
+ if [ -f "$_mux_binary" ] && [ -x "$_mux_binary" ]; then
104
+ printf '%s\n' "$_mux_binary"
105
+ return 0
106
+ fi
107
+
108
+ if [ -z "$_mux_dir" ] || [ "$_mux_dir" = / ]; then
109
+ break
110
+ fi
111
+
112
+ _mux_dir=${_mux_dir%/*}
113
+ done
114
+ done
115
+
116
+ return 1
117
+ }
118
+
119
+ mux_sesh_missing_binary_message() {
120
+ mux_sesh_detect_host
121
+
122
+ if [ "$mux_sesh_os" = unsupported ] || [ "$mux_sesh_arch" = unsupported ]; then
123
+ printf 'mux-sesh has no prebuilt binary for %s %s.\n' "$(uname -s)" "$(uname -m)"
124
+ printf 'Supported platforms: Linux x64/arm64 (glibc or musl) and macOS x64/arm64.\n'
125
+ return 0
126
+ fi
127
+
128
+ _mux_platform="$mux_sesh_os-$mux_sesh_arch"
129
+
130
+ if [ "$mux_sesh_os" = linux ]; then
131
+ _mux_platform="$_mux_platform ($mux_sesh_libc)"
132
+ fi
133
+
134
+ _mux_expected=$(mux_sesh_platform_candidates "$mux_sesh_os" "$mux_sesh_arch" "$mux_sesh_libc" "$mux_sesh_avx2" | head -n 1)
135
+ printf 'mux-sesh could not find its prebuilt binary for %s.\n' "$_mux_platform"
136
+ printf 'It ships in the optional dependency %s, which was not installed.\n' "$_mux_expected"
137
+ printf 'Optional dependencies are skipped by --omit=optional, --no-optional, or a lockfile made on another platform.\n'
138
+ printf 'Reinstall with optional dependencies enabled: npm install -g mux-sesh (or bun install -g mux-sesh).\n'
139
+ }
@@ -0,0 +1,22 @@
1
+ #!/bin/sh
2
+ # Links the platform binary bin/mux-sesh should run. It never fails the install: the launcher
3
+ # searches again at startup and explains what is missing.
4
+
5
+ script_dir="$(cd "$(dirname "$0")" && pwd -P)"
6
+ link="$script_dir/.platform-binary"
7
+
8
+ . "$script_dir/platform.sh"
9
+
10
+ rm -f "$link"
11
+
12
+ if binary="$(mux_sesh_find_binary "${script_dir%/*}")"; then
13
+ ln -s "$binary" "$link" 2>/dev/null || true
14
+ exit 0
15
+ fi
16
+
17
+ {
18
+ printf 'mux-sesh postinstall warning: '
19
+ mux_sesh_missing_binary_message
20
+ } >&2
21
+
22
+ exit 0
package/package.json CHANGED
@@ -1,28 +1,7 @@
1
1
  {
2
- "$schema": "https://json.schemastore.org/package.json",
3
2
  "name": "mux-sesh",
4
- "version": "1.10.0",
3
+ "version": "2.0.1",
5
4
  "description": "An OpenTUI manager for tmux sessions and Herdr workspaces with fuzzy project search",
6
- "type": "module",
7
- "packageManager": "bun@1.3.14",
8
- "bin": {
9
- "mux-sesh": "./bin/mux-sesh"
10
- },
11
- "files": [
12
- "bin",
13
- "src",
14
- "tsconfig.json"
15
- ],
16
- "scripts": {
17
- "dev": "MUX_SESH_DEV=1 bun run src/index.tsx",
18
- "build": "bun build src/index.tsx --compile --outfile dist/mux-sesh",
19
- "start": "bun run src/index.tsx",
20
- "typecheck": "tsc --noEmit",
21
- "format": "prettier --write .",
22
- "format:check": "prettier --check .",
23
- "test": "bun test",
24
- "prepublishOnly": "bun run typecheck"
25
- },
26
5
  "keywords": [
27
6
  "tmux",
28
7
  "herdr",
@@ -41,28 +20,38 @@
41
20
  "license": "MIT",
42
21
  "repository": {
43
22
  "type": "git",
44
- "url": "https://github.com/quiet-ghost/mux-sesh.git"
23
+ "url": "git+https://github.com/quiet-ghost/mux-sesh.git"
45
24
  },
46
25
  "bugs": {
47
26
  "url": "https://github.com/quiet-ghost/mux-sesh/issues"
48
27
  },
49
28
  "homepage": "https://github.com/quiet-ghost/mux-sesh#readme",
50
- "engines": {
51
- "bun": ">=1.0.0"
52
- },
53
- "overrides": {
54
- "@types/node": "^24"
29
+ "bin": {
30
+ "mux-sesh": "bin/mux-sesh"
55
31
  },
56
- "dependencies": {
57
- "@ff-labs/fff-bun": "0.10.1",
58
- "@opentui/core": "0.4.5",
59
- "@opentui/react": "0.4.5",
60
- "react": "19.2.8"
32
+ "scripts": {
33
+ "postinstall": "sh ./bin/postinstall"
61
34
  },
62
- "devDependencies": {
63
- "@types/bun": "1.3.14",
64
- "@types/react": "19.2.17",
65
- "prettier": "3.9.6",
66
- "typescript": "5.9.3"
35
+ "files": [
36
+ "bin"
37
+ ],
38
+ "os": [
39
+ "linux",
40
+ "darwin"
41
+ ],
42
+ "cpu": [
43
+ "x64",
44
+ "arm64"
45
+ ],
46
+ "optionalDependencies": {
47
+ "mux-sesh-linux-x64": "2.0.1",
48
+ "mux-sesh-linux-x64-baseline": "2.0.1",
49
+ "mux-sesh-linux-arm64": "2.0.1",
50
+ "mux-sesh-linux-x64-musl": "2.0.1",
51
+ "mux-sesh-linux-x64-baseline-musl": "2.0.1",
52
+ "mux-sesh-linux-arm64-musl": "2.0.1",
53
+ "mux-sesh-darwin-x64": "2.0.1",
54
+ "mux-sesh-darwin-x64-baseline": "2.0.1",
55
+ "mux-sesh-darwin-arm64": "2.0.1"
67
56
  }
68
57
  }
@@ -1 +0,0 @@
1
- export * from './session-name'
@@ -1,24 +0,0 @@
1
- import type { Item } from '../types'
2
-
3
- const AGENT_SESSION_PREFIXES = ['opencode-', 'pi-', 'codex-', 'claude-'] as const
4
- const SIDE_SESSION_NAMES = new Set(['tui_chat'])
5
-
6
- export function isAgentSessionName(sessionName: string): boolean {
7
- return (
8
- AGENT_SESSION_PREFIXES.some(prefix => sessionName.startsWith(prefix)) ||
9
- SIDE_SESSION_NAMES.has(sessionName)
10
- )
11
- }
12
-
13
- export function isAgentSessionItem(
14
- item: Pick<Item, 'isSession' | 'title' | 'itemKind' | 'agentStatus' | 'target'>
15
- ): boolean {
16
- if (!item.isSession) {
17
- return false
18
- }
19
-
20
- return item.itemKind === 'herdr'
21
- ? item.target?.kind === 'agent' ||
22
- (item.agentStatus !== undefined && item.agentStatus !== 'unknown')
23
- : isAgentSessionName(item.title)
24
- }