mux-sesh 1.9.4 → 1.9.5
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/README.md +27 -9
- package/package.json +4 -2
- package/src/agents/session-name.ts +11 -2
- package/src/app/commands.ts +8 -8
- package/src/app/controller.ts +16 -4
- package/src/app/controls.ts +11 -9
- package/src/app/core-state.ts +5 -1
- package/src/app/data.ts +40 -5
- package/src/app/derived.ts +3 -3
- package/src/app/effects.ts +132 -15
- package/src/app/handlers.ts +42 -18
- package/src/app/keyboard.ts +3 -3
- package/src/app/modals.ts +8 -8
- package/src/app/runtime.ts +4 -1
- package/src/app/screen.tsx +11 -3
- package/src/app/state.ts +24 -4
- package/src/app/view.ts +17 -6
- package/src/config/index.ts +10 -0
- package/src/handlers/action-helpers.ts +22 -7
- package/src/handlers/actions.ts +51 -42
- package/src/handlers/keyboard/agents.ts +36 -14
- package/src/handlers/keyboard/new-session.ts +1 -1
- package/src/handlers/keyboard/normal.ts +8 -8
- package/src/handlers/keyboard/search.ts +6 -6
- package/src/handlers/keyboard/shared.ts +3 -3
- package/src/herdr/backend.ts +357 -0
- package/src/herdr/protocol.ts +268 -0
- package/src/items/order.ts +3 -7
- package/src/multiplexer/backend.ts +43 -0
- package/src/multiplexer/command.ts +48 -0
- package/src/multiplexer/index.ts +21 -0
- package/src/multiplexer/items.ts +66 -0
- package/src/multiplexer/resolve.ts +106 -0
- package/src/multiplexer/tmux-backend.ts +87 -0
- package/src/multiplexer/types.ts +93 -0
- package/src/opencode/session-name.ts +4 -2
- package/src/preview/project.ts +13 -11
- package/src/projects/session-links.ts +22 -4
- package/src/settings.ts +19 -0
- package/src/tmux/workflows.ts +5 -1
- package/src/types/index.ts +13 -1
- package/src/ui/AgentSessionGroup.tsx +25 -10
- package/src/ui/CommandsModal.tsx +15 -7
- package/src/ui/ItemList.tsx +3 -2
- package/src/ui/SessionDetailsPanel.tsx +68 -34
- package/src/ui/SessionList.tsx +23 -7
- package/src/ui/item-icon.ts +20 -7
- package/src/ui/session-meta.ts +10 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# mux-sesh
|
|
2
2
|
|
|
3
|
-
Fast tmux session
|
|
3
|
+
Fast tmux session and Herdr workspace switching from a polished terminal UI.
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
<img src="screenshot.png" alt="mux-sesh screenshot" width="800">
|
|
@@ -8,19 +8,19 @@ Fast tmux session switching and project launching from a polished terminal UI.
|
|
|
8
8
|
|
|
9
9
|
## Why mux-sesh
|
|
10
10
|
|
|
11
|
-
- Switch
|
|
11
|
+
- Switch between live tmux sessions or Herdr workspaces without leaving the keyboard.
|
|
12
12
|
- Launch local projects from a single, searchable picker.
|
|
13
13
|
- Keep reusable project rules in config instead of shell scripts.
|
|
14
|
-
- Stay inside
|
|
14
|
+
- Stay inside your multiplexer with previews, quick actions, and lightweight workflows.
|
|
15
15
|
|
|
16
16
|
## Quick Start
|
|
17
17
|
|
|
18
|
-
`mux-sesh` runs on Bun and talks directly to tmux.
|
|
18
|
+
`mux-sesh` runs on Bun and talks directly to tmux or Herdr. Herdr needs no mux-sesh plugin.
|
|
19
19
|
|
|
20
20
|
Prerequisites:
|
|
21
21
|
|
|
22
22
|
- [Bun](https://bun.sh)
|
|
23
|
-
- [tmux](https://github.com/tmux/tmux/wiki)
|
|
23
|
+
- [tmux](https://github.com/tmux/tmux/wiki) or Herdr 0.7.5
|
|
24
24
|
- [git](https://git-scm.com) for cloning GitHub repositories from the new-session flow
|
|
25
25
|
|
|
26
26
|
Install globally:
|
|
@@ -49,20 +49,38 @@ tmux source-file ~/.tmux.conf
|
|
|
49
49
|
|
|
50
50
|
## How It Works
|
|
51
51
|
|
|
52
|
-
- Sessions view shows live tmux sessions.
|
|
52
|
+
- Sessions view shows live tmux sessions or Herdr workspaces.
|
|
53
53
|
- Projects view shows scanned or configured directories.
|
|
54
|
-
- Selecting a project attaches to an existing session when possible, or creates one.
|
|
54
|
+
- Selecting a project attaches to an existing session or workspace when possible, or creates one.
|
|
55
55
|
- The new-session flow searches files and directories under `project_paths` as you type, powered by [fff](https://github.com/dmtrKovalenko/fff).
|
|
56
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.
|
|
57
59
|
- The new-session flow can also clone a GitHub repository into your configured repos directory.
|
|
58
60
|
|
|
61
|
+
Herdr concepts map directly into the UI:
|
|
62
|
+
|
|
63
|
+
| mux-sesh | Herdr |
|
|
64
|
+
| -------- | --------- |
|
|
65
|
+
| Session | Workspace |
|
|
66
|
+
| Window | Tab |
|
|
67
|
+
| Pane | Pane |
|
|
68
|
+
|
|
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.
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{ "backend": "herdr" }
|
|
73
|
+
```
|
|
74
|
+
|
|
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.
|
|
76
|
+
|
|
59
77
|
## Minimal Configuration
|
|
60
78
|
|
|
61
79
|
Config lives at `~/.config/mux-sesh/config.json`.
|
|
62
80
|
|
|
63
81
|
```json
|
|
64
82
|
{
|
|
65
|
-
"project_paths": ["~/dev"
|
|
83
|
+
"project_paths": ["~/dev"],
|
|
66
84
|
"repos_path": "~/dev/repos",
|
|
67
85
|
"keybind_mode": "vim",
|
|
68
86
|
"prefix_key": "ctrl+x",
|
|
@@ -94,7 +112,7 @@ With the default prefix key, secondary actions live behind `ctrl+x`:
|
|
|
94
112
|
|
|
95
113
|
- `ctrl+x s` sessions
|
|
96
114
|
- `ctrl+x p` projects
|
|
97
|
-
- `ctrl+x l` last session
|
|
115
|
+
- `ctrl+x l` last session (tmux only)
|
|
98
116
|
- `ctrl+x g` git root session
|
|
99
117
|
- `ctrl+x r` rename session
|
|
100
118
|
- `ctrl+x e` edit configured target
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "mux-sesh",
|
|
4
|
-
"version": "1.9.
|
|
5
|
-
"description": "
|
|
4
|
+
"version": "1.9.5",
|
|
5
|
+
"description": "An OpenTUI manager for tmux sessions and Herdr workspaces with fuzzy project search",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"packageManager": "bun@1.3.5",
|
|
8
8
|
"bin": {
|
|
@@ -25,9 +25,11 @@
|
|
|
25
25
|
},
|
|
26
26
|
"keywords": [
|
|
27
27
|
"tmux",
|
|
28
|
+
"herdr",
|
|
28
29
|
"tui",
|
|
29
30
|
"terminal",
|
|
30
31
|
"session-manager",
|
|
32
|
+
"workspace-manager",
|
|
31
33
|
"opentui",
|
|
32
34
|
"cli",
|
|
33
35
|
"tmux-manager",
|
|
@@ -10,6 +10,15 @@ export function isAgentSessionName(sessionName: string): boolean {
|
|
|
10
10
|
)
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export function isAgentSessionItem(
|
|
14
|
-
|
|
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)
|
|
15
24
|
}
|
package/src/app/commands.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isOpencodeSessionItem } from '../opencode/session-name'
|
|
2
2
|
import type { CommandId } from '../ui/CommandsModal'
|
|
3
3
|
import { AppMode, ViewMode, type Item } from '../types'
|
|
4
4
|
|
|
@@ -13,9 +13,9 @@ interface ExecuteCommandContext {
|
|
|
13
13
|
sessionCandidateItems: Item[]
|
|
14
14
|
projectSourceItems: Item[]
|
|
15
15
|
closeModal: () => void
|
|
16
|
-
openRenameModal: (
|
|
16
|
+
openRenameModal: (item: Item) => void
|
|
17
17
|
openSettingsModal: () => void
|
|
18
|
-
requestKillSession: (
|
|
18
|
+
requestKillSession: (item: Item) => void
|
|
19
19
|
togglePinnedSession: (sessionName: string) => Promise<void>
|
|
20
20
|
setAppMode: (mode: AppMode) => void
|
|
21
21
|
setViewMode: (mode: ViewMode) => void
|
|
@@ -72,7 +72,7 @@ export async function executeCommand(commandID: CommandId, ctx: ExecuteCommandCo
|
|
|
72
72
|
? ctx.regularSessions[ctx.cursor]
|
|
73
73
|
: undefined
|
|
74
74
|
if (target?.isSession) {
|
|
75
|
-
ctx.openRenameModal(target
|
|
75
|
+
ctx.openRenameModal(target)
|
|
76
76
|
}
|
|
77
77
|
return
|
|
78
78
|
}
|
|
@@ -85,7 +85,7 @@ export async function executeCommand(commandID: CommandId, ctx: ExecuteCommandCo
|
|
|
85
85
|
: undefined
|
|
86
86
|
if (target?.isSession) {
|
|
87
87
|
ctx.closeModal()
|
|
88
|
-
ctx.requestKillSession(target
|
|
88
|
+
ctx.requestKillSession(target)
|
|
89
89
|
}
|
|
90
90
|
return
|
|
91
91
|
}
|
|
@@ -115,9 +115,9 @@ export async function executeCommand(commandID: CommandId, ctx: ExecuteCommandCo
|
|
|
115
115
|
if (ctx.viewMode === ViewMode.Sessions && ctx.agentSessions.length > 0) {
|
|
116
116
|
ctx.setAppMode(AppMode.AgentsManage)
|
|
117
117
|
ctx.setAgentCursor(0)
|
|
118
|
-
const firstAgent = ctx.agentSessions[0]
|
|
119
|
-
if (
|
|
120
|
-
await ctx.loadOpencodeStatsForSession(firstAgent)
|
|
118
|
+
const firstAgent = ctx.agentSessions[0]
|
|
119
|
+
if (isOpencodeSessionItem(firstAgent)) {
|
|
120
|
+
await ctx.loadOpencodeStatsForSession(firstAgent.title)
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
return
|
package/src/app/controller.ts
CHANGED
|
@@ -43,6 +43,8 @@ export function useAppController() {
|
|
|
43
43
|
setRenameTarget,
|
|
44
44
|
config,
|
|
45
45
|
setConfig,
|
|
46
|
+
backend,
|
|
47
|
+
setBackend,
|
|
46
48
|
pendingKillSessionName,
|
|
47
49
|
setPendingKillSessionName,
|
|
48
50
|
prefixActive,
|
|
@@ -105,6 +107,8 @@ export function useAppController() {
|
|
|
105
107
|
lastProjectSelectionRef,
|
|
106
108
|
mark,
|
|
107
109
|
setConfig,
|
|
110
|
+
setBackend,
|
|
111
|
+
setMessage,
|
|
108
112
|
setAppMode,
|
|
109
113
|
setViewMode,
|
|
110
114
|
setSessionItems,
|
|
@@ -118,6 +122,7 @@ export function useAppController() {
|
|
|
118
122
|
|
|
119
123
|
const { showMessage, refreshItems, loadOpencodeStatsForSession } = createAppRuntime({
|
|
120
124
|
config,
|
|
125
|
+
backend,
|
|
121
126
|
viewMode,
|
|
122
127
|
measure,
|
|
123
128
|
lastSessionSelectionRef,
|
|
@@ -134,7 +139,7 @@ export function useAppController() {
|
|
|
134
139
|
const {
|
|
135
140
|
regularSessions,
|
|
136
141
|
agentSessions,
|
|
137
|
-
|
|
142
|
+
selectedAgentSession,
|
|
138
143
|
selectedPrimaryItem,
|
|
139
144
|
filteredCommandEntries,
|
|
140
145
|
} = getSessionCommandState(
|
|
@@ -159,8 +164,9 @@ export function useAppController() {
|
|
|
159
164
|
} = createAppControls({
|
|
160
165
|
config,
|
|
161
166
|
pendingKillSessionName,
|
|
162
|
-
handleKillSession:
|
|
163
|
-
handleKillSessionWithFeedback(
|
|
167
|
+
handleKillSession: item =>
|
|
168
|
+
handleKillSessionWithFeedback(item, {
|
|
169
|
+
backend,
|
|
164
170
|
config,
|
|
165
171
|
items,
|
|
166
172
|
sessionItems,
|
|
@@ -196,6 +202,7 @@ export function useAppController() {
|
|
|
196
202
|
handleTogglePinnedSessionWrapper,
|
|
197
203
|
executeCommand,
|
|
198
204
|
} = createAppHandlers({
|
|
205
|
+
backend,
|
|
199
206
|
appMode,
|
|
200
207
|
viewMode,
|
|
201
208
|
config,
|
|
@@ -297,6 +304,7 @@ export function useAppController() {
|
|
|
297
304
|
appMode,
|
|
298
305
|
viewMode,
|
|
299
306
|
config,
|
|
307
|
+
backend,
|
|
300
308
|
sessionItems,
|
|
301
309
|
projectSourceItems,
|
|
302
310
|
sessionCandidateItems,
|
|
@@ -304,7 +312,10 @@ export function useAppController() {
|
|
|
304
312
|
lastProjectSelectionRef,
|
|
305
313
|
setAllItems,
|
|
306
314
|
setItems,
|
|
315
|
+
setSessionItems,
|
|
307
316
|
setCursor,
|
|
317
|
+
setAgentCursor,
|
|
318
|
+
setMessage,
|
|
308
319
|
setSessionCandidateItems,
|
|
309
320
|
filteredCommandEntriesLength: filteredCommandEntries.length,
|
|
310
321
|
setCommandsCursor,
|
|
@@ -323,7 +334,7 @@ export function useAppController() {
|
|
|
323
334
|
setPendingKillSessionName,
|
|
324
335
|
searchQuery,
|
|
325
336
|
allItems,
|
|
326
|
-
|
|
337
|
+
selectedAgentSession,
|
|
327
338
|
loadOpencodeStatsForSession,
|
|
328
339
|
setUpdatedVersion,
|
|
329
340
|
setToastMessage,
|
|
@@ -340,6 +351,7 @@ export function useAppController() {
|
|
|
340
351
|
appMode,
|
|
341
352
|
viewMode,
|
|
342
353
|
config,
|
|
354
|
+
backend,
|
|
343
355
|
items,
|
|
344
356
|
regularSessions,
|
|
345
357
|
agentSessions,
|
package/src/app/controls.ts
CHANGED
|
@@ -8,15 +8,16 @@ import {
|
|
|
8
8
|
openSettingsModal as showSettingsModal,
|
|
9
9
|
type ModalState,
|
|
10
10
|
} from './modals'
|
|
11
|
-
import type { Config } from '../types'
|
|
11
|
+
import type { Config, Item } from '../types'
|
|
12
|
+
import { getItemKey } from '../multiplexer/items'
|
|
12
13
|
import type { SettingsFieldId } from '../settings'
|
|
13
14
|
|
|
14
15
|
interface AppControlsOptions {
|
|
15
16
|
config: Config | null
|
|
16
17
|
pendingKillSessionName: string | null
|
|
17
|
-
handleKillSession: (
|
|
18
|
+
handleKillSession: (item: Item) => Promise<void>
|
|
18
19
|
setPendingKillSessionName: Dispatch<SetStateAction<string | null>>
|
|
19
|
-
setRenameTarget: Dispatch<SetStateAction<
|
|
20
|
+
setRenameTarget: Dispatch<SetStateAction<Item | null>>
|
|
20
21
|
setModalInputValue: Dispatch<SetStateAction<string>>
|
|
21
22
|
setModalState: Dispatch<SetStateAction<ModalState>>
|
|
22
23
|
setCommandsSearchQuery: Dispatch<SetStateAction<string>>
|
|
@@ -34,18 +35,19 @@ export function createAppControls(options: AppControlsOptions) {
|
|
|
34
35
|
options.setPendingKillSessionName(null)
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
function requestKillSession(
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
function requestKillSession(item: Item) {
|
|
39
|
+
const sessionKey = getItemKey(item)
|
|
40
|
+
if (options.pendingKillSessionName === sessionKey) {
|
|
41
|
+
void options.handleKillSession(item)
|
|
40
42
|
return
|
|
41
43
|
}
|
|
42
44
|
|
|
43
|
-
options.setPendingKillSessionName(
|
|
45
|
+
options.setPendingKillSessionName(sessionKey)
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
function openRenameModal(
|
|
48
|
+
function openRenameModal(item: Item) {
|
|
47
49
|
showRenameModal(
|
|
48
|
-
|
|
50
|
+
item,
|
|
49
51
|
clearPendingKill,
|
|
50
52
|
options.setRenameTarget,
|
|
51
53
|
options.setModalInputValue,
|
package/src/app/core-state.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { TextareaRenderable } from '@opentui/core'
|
|
2
2
|
import { useRef, useState } from 'react'
|
|
3
3
|
import { AppMode, ViewMode, type Config, type Item } from '../types'
|
|
4
|
+
import type { MultiplexerBackend } from '../multiplexer'
|
|
4
5
|
|
|
5
6
|
export function useAppCoreState() {
|
|
6
7
|
const [appMode, setAppMode] = useState(AppMode.Normal)
|
|
@@ -14,8 +15,9 @@ export function useAppCoreState() {
|
|
|
14
15
|
const [agentCursor, setAgentCursor] = useState(0)
|
|
15
16
|
const [searchQuery, setSearchQuery] = useState('')
|
|
16
17
|
const [message, setMessage] = useState('')
|
|
17
|
-
const [renameTarget, setRenameTarget] = useState(
|
|
18
|
+
const [renameTarget, setRenameTarget] = useState<Item | null>(null)
|
|
18
19
|
const [config, setConfig] = useState<Config | null>(null)
|
|
20
|
+
const [backend, setBackend] = useState<MultiplexerBackend | null>(null)
|
|
19
21
|
const [pendingKillSessionName, setPendingKillSessionName] = useState<string | null>(null)
|
|
20
22
|
const [prefixActive, setPrefixActive] = useState(false)
|
|
21
23
|
const prefixTimeoutRef = useRef<NodeJS.Timeout | null>(null)
|
|
@@ -53,6 +55,8 @@ export function useAppCoreState() {
|
|
|
53
55
|
setRenameTarget,
|
|
54
56
|
config,
|
|
55
57
|
setConfig,
|
|
58
|
+
backend,
|
|
59
|
+
setBackend,
|
|
56
60
|
pendingKillSessionName,
|
|
57
61
|
setPendingKillSessionName,
|
|
58
62
|
prefixActive,
|
package/src/app/data.ts
CHANGED
|
@@ -2,11 +2,14 @@ import { getListedSessionItems, mergeSessionItems } from '../config/listed-sessi
|
|
|
2
2
|
import { orderProjectItems, orderSessionItems } from '../items/order'
|
|
3
3
|
import { annotateProjectItemsWithSessionLinks } from '../projects/session-links'
|
|
4
4
|
import { clearMatchIndices } from '../search'
|
|
5
|
-
import {
|
|
5
|
+
import { workspaceToItem } from '../multiplexer/items'
|
|
6
|
+
import type { MultiplexerBackend } from '../multiplexer'
|
|
7
|
+
import { getItemKey } from '../multiplexer/items'
|
|
6
8
|
import { getProjectItems, getSessionCandidateItems } from '../tmux/projects'
|
|
7
9
|
import { filterHiddenSessions } from '../tmux/workflows'
|
|
8
10
|
import { isAgentSessionItem } from '../agents/session-name'
|
|
9
11
|
import type { Config, Item } from '../types'
|
|
12
|
+
import { clampCursorIndex } from '../ui/list-window'
|
|
10
13
|
|
|
11
14
|
export type Measure = <T>(name: string, fn: () => Promise<T>) => Promise<T>
|
|
12
15
|
|
|
@@ -16,7 +19,9 @@ export function getSessionSelectionIndex(nextItems: Item[], selection?: string |
|
|
|
16
19
|
return 0
|
|
17
20
|
}
|
|
18
21
|
|
|
19
|
-
const index = regularItems.findIndex(
|
|
22
|
+
const index = regularItems.findIndex(
|
|
23
|
+
item => getItemKey(item) === selection || item.title === selection
|
|
24
|
+
)
|
|
20
25
|
return index >= 0 ? index : 0
|
|
21
26
|
}
|
|
22
27
|
|
|
@@ -29,12 +34,35 @@ export function getProjectSelectionIndex(nextItems: Item[], selection?: string |
|
|
|
29
34
|
return index >= 0 ? index : 0
|
|
30
35
|
}
|
|
31
36
|
|
|
37
|
+
export function getAgentSelectionIndex(
|
|
38
|
+
nextItems: Item[],
|
|
39
|
+
selection: string | undefined,
|
|
40
|
+
currentCursor: number
|
|
41
|
+
): number {
|
|
42
|
+
const agentSessions = nextItems.filter(isAgentSessionItem)
|
|
43
|
+
const selectedIndex = selection
|
|
44
|
+
? agentSessions.findIndex(item => getItemKey(item) === selection)
|
|
45
|
+
: -1
|
|
46
|
+
return selectedIndex >= 0 ? selectedIndex : clampCursorIndex(agentSessions.length, currentCursor)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function reuseSessionItemIdentities(previous: Item[], next: Item[]): Item[] {
|
|
50
|
+
const previousByKey = new Map(previous.map(item => [getItemKey(item), item]))
|
|
51
|
+
return next.map(item => {
|
|
52
|
+
const existing = previousByKey.get(getItemKey(item))
|
|
53
|
+
return existing && JSON.stringify(existing) === JSON.stringify(item) ? existing : item
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
|
|
32
57
|
export async function loadSessionItems(
|
|
33
58
|
config: Config,
|
|
34
59
|
measure: Measure,
|
|
60
|
+
backend: MultiplexerBackend,
|
|
35
61
|
labelPrefix = 'sessions'
|
|
36
62
|
): Promise<{ visibleSessions: Item[]; sessionItems: Item[] }> {
|
|
37
|
-
const sessions = await measure(`${labelPrefix}:
|
|
63
|
+
const sessions = await measure(`${labelPrefix}:listWorkspaces`, async () =>
|
|
64
|
+
(await backend.list()).map(workspaceToItem)
|
|
65
|
+
)
|
|
38
66
|
const visibleSessions = filterHiddenSessions(sessions, config.hiddenSessions)
|
|
39
67
|
const listedSessions = await measure(`${labelPrefix}:getListedSessionItems`, () =>
|
|
40
68
|
getListedSessionItems(config)
|
|
@@ -83,9 +111,16 @@ export async function loadProjectSourceItems(config: Config, measure: Measure):
|
|
|
83
111
|
)
|
|
84
112
|
}
|
|
85
113
|
|
|
86
|
-
export async function loadSessionCandidateItems(
|
|
114
|
+
export async function loadSessionCandidateItems(
|
|
115
|
+
config: Config,
|
|
116
|
+
measure: Measure,
|
|
117
|
+
backend: MultiplexerBackend
|
|
118
|
+
): Promise<Item[]> {
|
|
87
119
|
const [candidates, sessions] = await measure('loadSessionCandidateItems', () =>
|
|
88
|
-
Promise.all([
|
|
120
|
+
Promise.all([
|
|
121
|
+
getSessionCandidateItems(config),
|
|
122
|
+
backend.list().then(items => items.map(workspaceToItem)),
|
|
123
|
+
])
|
|
89
124
|
)
|
|
90
125
|
|
|
91
126
|
const visibleSessions = filterHiddenSessions(sessions, config.hiddenSessions)
|
package/src/app/derived.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { splitVisibleSessions } from './view'
|
|
|
14
14
|
interface SessionCommandState {
|
|
15
15
|
regularSessions: Item[]
|
|
16
16
|
agentSessions: Item[]
|
|
17
|
-
|
|
17
|
+
selectedAgentSession: Item | undefined
|
|
18
18
|
selectedPrimaryItem: Item | undefined
|
|
19
19
|
filteredCommandEntries: CommandEntry[]
|
|
20
20
|
}
|
|
@@ -49,8 +49,8 @@ export function getSessionCommandState(
|
|
|
49
49
|
return {
|
|
50
50
|
regularSessions: sessionSplit.regularSessions,
|
|
51
51
|
agentSessions: sessionSplit.agentSessions,
|
|
52
|
-
|
|
53
|
-
appMode === AppMode.AgentsManage ? sessionSplit.agentSessions[agentCursor]
|
|
52
|
+
selectedAgentSession:
|
|
53
|
+
appMode === AppMode.AgentsManage ? sessionSplit.agentSessions[agentCursor] : undefined,
|
|
54
54
|
selectedPrimaryItem,
|
|
55
55
|
filteredCommandEntries: filterCommandEntries(
|
|
56
56
|
getCommandEntries(appMode, config?.keybindMode, config?.prefixKey, selectedPrimaryItem),
|