opencode-sesh 2.0.0 → 2.0.2
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.
- package/AGENTS.md +11 -7
- package/CHANGELOG.md +14 -0
- package/README.md +60 -23
- package/bin/sesh-shortcuts.sh +7 -2
- package/contrib/cmux/README.md +6 -4
- package/dist/tui.js +4359 -0
- package/install.sh +2 -2
- package/package.json +14 -7
- package/tui-plugins/sesh-panel/tui.tsx +13 -10
package/AGENTS.md
CHANGED
|
@@ -11,10 +11,10 @@ territory: read this first, then the specific file you need.
|
|
|
11
11
|
any terminal. Lists **all** sessions across **all** project directories,
|
|
12
12
|
full-text searchable, with transcript preview and resume/fork/delete.
|
|
13
13
|
2. **`tui-plugins/sesh-panel/tui.tsx`** — a SolidJS/OpenTUI plugin for the opencode TUI: a
|
|
14
|
-
|
|
14
|
+
sessions section in the sidebar plus an `option+o` / `/sesh` picker.
|
|
15
15
|
3. **`plugins/sesh-list.ts`** — the `sesh_list` custom tool, so the agent
|
|
16
|
-
can list sessions across every directory by querying the global
|
|
17
|
-
|
|
16
|
+
can list sessions across every directory by querying the global opencode
|
|
17
|
+
SQLite store (the native `opencode session list` is project-scoped).
|
|
18
18
|
|
|
19
19
|
No iTerm2, no AppleScript, no panes, no window management — **never add any.**
|
|
20
20
|
The one exception is the TUI's right-click action, which shells out to
|
|
@@ -57,7 +57,7 @@ The tool name in opencode is `sesh_list`. Do not rename it without updating the
|
|
|
57
57
|
## Data flow (fzf picker)
|
|
58
58
|
|
|
59
59
|
`bin/sesh-list.sh` owns the fzf picker's session store access (opencode SQLite
|
|
60
|
-
DB: `session_v2` / `session_message` tables); the `
|
|
60
|
+
DB: `session_v2` / `session_message` tables); the `sesh_list` agent tool queries
|
|
61
61
|
the same store read-only through `bun:sqlite`. V2 discovers the tool from the
|
|
62
62
|
global config directory's `plugins/`. Keep its SQL column names in sync with
|
|
63
63
|
the schema below. Keystrokes never touch the database:
|
|
@@ -75,7 +75,8 @@ the schema below. Keystrokes never touch the database:
|
|
|
75
75
|
the whole DB and pruning is always safe.
|
|
76
76
|
- render (cheap, pure `jq`): reads the snapshot only. Filters on `searchText`
|
|
77
77
|
(title + `fulltextLower`, both lowercased at extraction), groups by `cwd`,
|
|
78
|
-
sorts groups/items by recency,
|
|
78
|
+
sorts groups/items by pins and recency, with current-project and title-match
|
|
79
|
+
priority while searching, and renders the TSV. Notice rows (headers, a
|
|
79
80
|
vanished selection, an empty store, a query matching nothing) carry an empty
|
|
80
81
|
`sessionId` and a unique `trackingId`. `--header` prints the one-line
|
|
81
82
|
scope/count/status that the picker uses as fzf's header, and a non-actionable
|
|
@@ -89,7 +90,9 @@ the schema below. Keystrokes never touch the database:
|
|
|
89
90
|
The sidebar and home lists use Option-S / Option-R instead: opencode binds
|
|
90
91
|
`ctrl+d` itself (composer delete-char, session delete), so ctrl pins would
|
|
91
92
|
shadow the composer. Pinned directories sort before groups
|
|
92
|
-
containing pinned sessions
|
|
93
|
+
containing pinned sessions. The terminal picker puts pinned sessions first
|
|
94
|
+
inside each group; the TUI picker and sidebar keep sessions recency-ordered
|
|
95
|
+
within each directory. The home list puts pinned sessions first.
|
|
93
96
|
|
|
94
97
|
**Output contract** (TSV, 6 fields):
|
|
95
98
|
`agentId sessionId liveState display cwd trackingId`. `display` is the only
|
|
@@ -105,7 +108,8 @@ live-agent API, so `liveState` is always `unknown` and rows render gray unless
|
|
|
105
108
|
they are archived (opt-in, tagged `· archived`);
|
|
106
109
|
dispatch is always `opencode --session <id>`; Ctrl-F or `--fork` first creates the
|
|
107
110
|
fork with `opencode api session.fork` (the CLI has no fork flag) and resumes the new id.
|
|
108
|
-
Resume
|
|
111
|
+
Resume runs opencode in a subshell at the session's cwd in the same terminal;
|
|
112
|
+
when opencode exits, the picker reopens with the query preserved.
|
|
109
113
|
|
|
110
114
|
## Conventions
|
|
111
115
|
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,18 @@ All notable changes to this project are documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.0.2] - 2026-10-10
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **packaging:** Ship precompiled TUI panel for npm installs
|
|
13
|
+
|
|
14
|
+
## [2.0.1] - 2026-10-10
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- **packaging:** Add root export for opencode plugin and broaden opentui peer range
|
|
19
|
+
|
|
8
20
|
## [2.0.0] - 2026-10-10
|
|
9
21
|
|
|
10
22
|
### Breaking changes
|
|
@@ -482,6 +494,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
482
494
|
- Fixture-database regression suite, TypeScript typechecking, and ShellCheck in
|
|
483
495
|
CI.
|
|
484
496
|
|
|
497
|
+
[2.0.2]: https://github.com/ozandogrultan/opencode-sesh/compare/v2.0.1...v2.0.2
|
|
498
|
+
[2.0.1]: https://github.com/ozandogrultan/opencode-sesh/compare/v2.0.0...v2.0.1
|
|
485
499
|
[2.0.0]: https://github.com/ozandogrultan/opencode-sesh/compare/v1.1.0...v2.0.0
|
|
486
500
|
[1.1.0]: https://github.com/ozandogrultan/opencode-sesh/compare/v1.0.8...v1.1.0
|
|
487
501
|
[1.0.8]: https://github.com/ozandogrultan/opencode-sesh/compare/v1.0.7...v1.0.8
|
package/README.md
CHANGED
|
@@ -12,7 +12,6 @@ The TUI plugin and agent tool require OpenCode V2 and are not compatible with V1
|
|
|
12
12
|
`/sessions`) are scoped to the current project. `sesh` shows all of them —
|
|
13
13
|
grouped by directory, full-text searchable, and previewable from anywhere.
|
|
14
14
|
|
|
15
|
-
[](https://github.com/ozandogrultan/opencode-sesh/actions/workflows/ci.yml)
|
|
16
15
|
[](LICENSE)
|
|
17
16
|
[](#contributing)
|
|
18
17
|
[](https://github.com/ozandogrultan/opencode-sesh/stargazers)
|
|
@@ -35,26 +34,50 @@ search…
|
|
|
35
34
|
## Why sesh
|
|
36
35
|
|
|
37
36
|
- **Every session, everywhere.** Sessions are grouped by project directory and
|
|
38
|
-
|
|
37
|
+
shown across *all* your projects, not just the current one. Archived and
|
|
38
|
+
subagent child sessions are hidden by default.
|
|
39
39
|
- **Pin what matters.** Ctrl-S pins a session and Ctrl-D pins its directory in
|
|
40
|
-
either picker
|
|
41
|
-
persist across restarts
|
|
40
|
+
either picker; the TUI sidebar and home list use Option-S and Option-R.
|
|
41
|
+
Pins are shared and persist across restarts. Pinned directories rise first;
|
|
42
|
+
pinned sessions sort first in the terminal picker and home list. The TUI picker
|
|
43
|
+
and sidebar keep sessions within each directory recency-ordered.
|
|
42
44
|
- **Full-text search.** Type to match against session titles *and* the text of
|
|
43
45
|
the conversation itself. Reasoning and tool output are excluded, so the index
|
|
44
46
|
stays clean.
|
|
45
|
-
- **Transcript preview.**
|
|
46
|
-
Markdown (with `glow`
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
- **Transcript preview.** Ctrl-P in the terminal picker or Option-P in the TUI
|
|
48
|
+
shows the most recent messages first, rendered as Markdown (with `glow` in
|
|
49
|
+
the terminal if you have it).
|
|
50
|
+
- **Resume in place.** Enter runs `opencode --session <id>` in the session's
|
|
51
|
+
own directory. Ctrl-F forks instead. The session opens in the same terminal,
|
|
52
|
+
and exiting opencode returns to the picker — no tabs, panes, or window management.
|
|
53
|
+
- **Native TUI, too.** A sessions section in the opencode sidebar plus an
|
|
51
54
|
`option+o` picker, both themed by your opencode theme.
|
|
52
55
|
- **Fast.** The database is scanned once per refresh and cached; keystrokes only
|
|
53
56
|
re-render the last snapshot, so typing never triggers a query storm.
|
|
54
57
|
|
|
55
58
|
## Install
|
|
56
59
|
|
|
57
|
-
|
|
60
|
+
### OpenCode plugin
|
|
61
|
+
|
|
62
|
+
Add the package to `plugins` in your OpenCode V2 `opencode.json` (server tool)
|
|
63
|
+
and `cli.json` (TUI panel):
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"plugins": ["opencode-sesh"]
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
OpenCode installs the package and loads its server tool and TUI panel. The
|
|
72
|
+
published panel is precompiled (`dist/tui.js`) because OpenCode does not apply
|
|
73
|
+
its Solid transform to sources under `node_modules`. Merge this entry with your
|
|
74
|
+
existing plugins. Remove the copied
|
|
75
|
+
`./tui-plugins/sesh-panel` registration and `plugins/sesh-list.ts` tool before
|
|
76
|
+
switching to avoid loading them twice.
|
|
77
|
+
|
|
78
|
+
### Terminal picker
|
|
79
|
+
|
|
80
|
+
Install the CLI with npm:
|
|
58
81
|
|
|
59
82
|
```bash
|
|
60
83
|
npm install -g opencode-sesh
|
|
@@ -71,7 +94,7 @@ bash install.sh
|
|
|
71
94
|
|
|
72
95
|
`sesh install` (or `bash install.sh`) links `sesh` into `$XDG_BIN_HOME`
|
|
73
96
|
(default `~/.local/bin`), copies
|
|
74
|
-
the `
|
|
97
|
+
the `sesh_list` tool and the TUI panel into
|
|
75
98
|
`${XDG_CONFIG_HOME:-~/.config}/opencode`, registers the panel in `opencode.json`, and
|
|
76
99
|
declares the plugin dependencies (opencode installs them on next start). The
|
|
77
100
|
panel registers the `/sesh` slash command. It never edits your shell rc, and any
|
|
@@ -139,7 +162,7 @@ Flags: `--cwd` (current directory only), `--limit N` (default: all),
|
|
|
139
162
|
|
|
140
163
|
`sesh prune [--older-than 30d] [--dry-run] [--yes]` deletes stale
|
|
141
164
|
sessions (not updated within the threshold) through `opencode session delete`, including their children.
|
|
142
|
-
Pinned sessions, sessions waiting on you, subagent child sessions and already-archived
|
|
165
|
+
Pinned sessions and directories, sessions waiting on you, subagent child sessions and already-archived
|
|
143
166
|
sessions are never selected. Without `--dry-run`, a TTY run
|
|
144
167
|
confirms first and a non-TTY run needs `--yes`.
|
|
145
168
|
|
|
@@ -155,8 +178,8 @@ When searching, title matches outrank transcript-only matches and the current
|
|
|
155
178
|
project rises, so the list answers "where was that thing I worked on" before it
|
|
156
179
|
answers "what is newest". Pins still win outright.
|
|
157
180
|
|
|
158
|
-
|
|
159
|
-
|
|
181
|
+
`--print` still opens the interactive picker, but emits the selected id and
|
|
182
|
+
directory instead of resuming. `--query` supplies the initial search text:
|
|
160
183
|
|
|
161
184
|
```bash
|
|
162
185
|
read -r id cwd < <(sesh --print --query "auth")
|
|
@@ -166,7 +189,7 @@ sesh --print --json --query "auth" | jq -r .cwd
|
|
|
166
189
|
Deleting is irreversible, so the picker asks before dispatching it, and a
|
|
167
190
|
non-interactive `sesh-delete.sh` refuses unless given `--yes`.
|
|
168
191
|
|
|
169
|
-
### TUI
|
|
192
|
+
### TUI picker
|
|
170
193
|
|
|
171
194
|
| Key | Action |
|
|
172
195
|
| --- | --- |
|
|
@@ -178,13 +201,16 @@ non-interactive `sesh-delete.sh` refuses unless given `--yes`.
|
|
|
178
201
|
| `↑`/`↓`, `PgUp`/`PgDn`, `Home`/`End` | Move the selection |
|
|
179
202
|
| Option-P | Toggle the transcript preview |
|
|
180
203
|
| Enter | Open the selected session |
|
|
181
|
-
| Option-D |
|
|
204
|
+
| Option-D | Arm deletion; press Option-D again, `y`, or Enter to confirm |
|
|
182
205
|
| Ctrl-F | Fork the selected session |
|
|
183
206
|
| Ctrl-G | Toggle scope: the selected session's project, or every project |
|
|
184
207
|
| Option-W / Option-S | Show only sessions needing input / pinned sessions |
|
|
185
208
|
| Ctrl-S / Ctrl-D | Pin or unpin the selected session / directory |
|
|
186
209
|
| Esc | Close the preview first, then the picker |
|
|
187
210
|
|
|
211
|
+
While deletion is armed, `n` or Esc cancels; it also cancels after five seconds.
|
|
212
|
+
Option-O opens the picker globally; the other keys above apply inside it.
|
|
213
|
+
|
|
188
214
|
The picker groups sessions under collapsible directory headings (click ▾/▸).
|
|
189
215
|
Mouse-wheel scrolling moves through the tree without changing the selection
|
|
190
216
|
under a stationary pointer. Option-P opens a full-size transcript preview over
|
|
@@ -196,10 +222,14 @@ action, or Esc to dismiss the menu.
|
|
|
196
222
|
Right-click a session in the home list or picker to open it in a new cmux
|
|
197
223
|
workspace at its directory; outside cmux it shows a toast instead.
|
|
198
224
|
|
|
199
|
-
|
|
225
|
+
### TUI sidebar and home list
|
|
226
|
+
|
|
227
|
+
Click the sidebar's `search…` box to filter sessions in place; click
|
|
200
228
|
elsewhere or press Esc to leave search. Click the **Sessions** heading to drive
|
|
201
229
|
the list from the keyboard instead of the mouse (`↑`/`↓` to move, Enter to open,
|
|
202
|
-
Option-P to preview, Option-S
|
|
230
|
+
Option-P to preview, Option-S to pin a session, Option-R to pin its directory,
|
|
231
|
+
Option-D to arm deletion, Esc to leave). Press Option-D again or `y` to confirm
|
|
232
|
+
an armed deletion; `n` or Esc cancels. Pinned
|
|
203
233
|
directories rise first, while sessions within each directory are ordered by
|
|
204
234
|
last update, newest first. The section lists every session and scrolls to fill
|
|
205
235
|
the sidebar, so click **▾ hide** to collapse it when you need the room.
|
|
@@ -212,6 +242,12 @@ Hovering a row while keyboard navigation is active selects it for the next
|
|
|
212
242
|
shortcut. Clicking (or Enter on) a session opens it here. The full picker is one
|
|
213
243
|
keystroke away.
|
|
214
244
|
|
|
245
|
+
The home list also supports search and the Option-P, Option-S, Option-R, and
|
|
246
|
+
Option-D actions on the hovered session. These Option pin shortcuts do not
|
|
247
|
+
replace the picker's Ctrl-S/Ctrl-D bindings; Option-S in the picker filters pins.
|
|
248
|
+
|
|
249
|
+
### Transcript search and needs-input triage
|
|
250
|
+
|
|
215
251
|
The full picker pages through your whole global session list (no fixed window)
|
|
216
252
|
and indexes transcript text for every session in the background, showing
|
|
217
253
|
indexing progress under the search box. It only stops at a safety cap of 5,000
|
|
@@ -233,7 +269,7 @@ All variables are optional.
|
|
|
233
269
|
| `SESH_JQ` / `SESH_FZF` | `PATH` | explicit executable overrides |
|
|
234
270
|
| `SESH_GLOW` | first `glow` on `PATH` | optional Markdown preview renderer |
|
|
235
271
|
| `SESH_OPENCODE` | `opencode` | opencode executable (resume / delete) |
|
|
236
|
-
| `SESH_CACHE_DIR` |
|
|
272
|
+
| `SESH_CACHE_DIR` | `${XDG_CACHE_HOME:-~/.cache}/sesh` | persistent search-index cache |
|
|
237
273
|
| `SESH_PINS_FILE` | `${XDG_DATA_HOME:-~/.local/share}/sesh/pins.json` | shared persistent session/directory pins |
|
|
238
274
|
|
|
239
275
|
## Integrations
|
|
@@ -259,7 +295,7 @@ Flat scripts back the terminal UI — the picker (`sesh.sh`), the refresh engine
|
|
|
259
295
|
scans), preview renderer (`sesh-preview.sh`), deleter (`sesh-delete.sh`) and
|
|
260
296
|
shortcut help (`sesh-shortcuts.sh`). The TUI panel (`tui-plugins/sesh-panel/tui.tsx`) is a
|
|
261
297
|
SolidJS OpenTUI plugin that talks to the opencode SDK over the same store; the
|
|
262
|
-
`
|
|
298
|
+
`sesh_list` agent tool reads it read-only through `bun:sqlite`. V2 discovers
|
|
263
299
|
the installed tool automatically in the global config directory's `plugins/`.
|
|
264
300
|
|
|
265
301
|
## FAQ
|
|
@@ -267,12 +303,13 @@ the installed tool automatically in the global config directory's `plugins/`.
|
|
|
267
303
|
**Does it replace opencode's native session list?** No. `<leader>l` and the
|
|
268
304
|
native `/sessions` command are untouched; `sesh` is additive.
|
|
269
305
|
|
|
270
|
-
**Is there an agent-facing list?** Yes — the `
|
|
306
|
+
**Is there an agent-facing list?** Yes — the `sesh_list` tool lets the model list
|
|
271
307
|
every session across all directories (the native `opencode session list` only
|
|
272
308
|
covers the current project) and offer to resume one.
|
|
273
309
|
|
|
274
310
|
**Where is my data?** It reads the opencode database read-only and caches
|
|
275
|
-
extracted text under
|
|
311
|
+
extracted text under `${XDG_CACHE_HOME:-~/.cache}/sesh` (or `SESH_CACHE_DIR`).
|
|
312
|
+
Nothing is uploaded anywhere.
|
|
276
313
|
|
|
277
314
|
**Does it work on Windows?** It targets macOS and Linux. WSL should work; native
|
|
278
315
|
Windows is untested.
|
package/bin/sesh-shortcuts.sh
CHANGED
|
@@ -15,6 +15,11 @@ sesh shortcuts
|
|
|
15
15
|
Escape Exit the picker
|
|
16
16
|
|
|
17
17
|
Flags: --cwd (current directory only), --limit N (default: all),
|
|
18
|
-
--archived (include archived
|
|
19
|
-
--
|
|
18
|
+
--archived (include archived and child sessions),
|
|
19
|
+
--print (print selected id<TAB>cwd instead of resuming),
|
|
20
|
+
--json (with --print, emit JSON), --fork (resume as a fork),
|
|
21
|
+
--query TEXT (initial search), --check (check dependencies),
|
|
22
|
+
--needs-input [--json] (list sessions waiting on you)
|
|
23
|
+
|
|
24
|
+
--print still opens the picker; select a session with Enter or Ctrl-F.
|
|
20
25
|
HELP
|
package/contrib/cmux/README.md
CHANGED
|
@@ -20,7 +20,8 @@ Paste only the actions you want; the `ui.newWorkspace` block is optional.
|
|
|
20
20
|
|
|
21
21
|
## Resume a session in its own cmux workspace
|
|
22
22
|
|
|
23
|
-
The picker
|
|
23
|
+
The picker runs opencode in the selected session's directory and returns to the
|
|
24
|
+
picker when opencode exits. To instead open a
|
|
24
25
|
session in a **new cmux workspace** at its directory, shell out to cmux after
|
|
25
26
|
resolving the session with sesh's scriptable lookup:
|
|
26
27
|
|
|
@@ -57,9 +58,10 @@ sesh is a normal CLI, so any system-wide launcher works — a cmux `shortcut`, a
|
|
|
57
58
|
cmd + shift - s : cmux new-workspace --command "sesh"
|
|
58
59
|
```
|
|
59
60
|
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
`--print --json` still opens the interactive picker; `--query` initializes its
|
|
62
|
+
search and `--limit` caps the list rather than automatically accepting a result.
|
|
63
|
+
To resume a known session without the picker, use its id and directory directly:
|
|
62
64
|
|
|
63
65
|
```bash
|
|
64
|
-
cmd + alt - r : cmux new-workspace --command "opencode --session
|
|
66
|
+
cmd + alt - r : cmux new-workspace --cwd /path/to/project --command "opencode --session ses_EXAMPLE"
|
|
65
67
|
```
|