mux-sesh 1.9.2 → 1.9.4
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/package.json +1 -1
- package/src/agents/index.ts +1 -0
- package/src/agents/session-name.ts +15 -0
- package/src/app/commands.ts +16 -12
- package/src/app/controller.ts +16 -16
- package/src/app/core-state.ts +3 -3
- package/src/app/data.ts +2 -2
- package/src/app/derived.ts +11 -11
- package/src/app/effects.ts +18 -17
- package/src/app/handlers.ts +6 -6
- package/src/app/keyboard.ts +9 -9
- package/src/app/screen.tsx +19 -12
- package/src/app/view.ts +7 -7
- package/src/handlers/keyboard/{opencode.ts → agents.ts} +24 -17
- package/src/handlers/keyboard/index.ts +1 -1
- package/src/handlers/keyboard/normal.ts +8 -4
- package/src/handlers/keyboard/search.ts +8 -4
- package/src/handlers/keyboard/shared.ts +3 -3
- package/src/items/order.ts +4 -4
- package/src/types/index.ts +1 -1
- package/src/ui/{OpencodeSessionGroup.tsx → AgentSessionGroup.tsx} +4 -4
- package/src/ui/CommandsModal.tsx +3 -3
- package/src/ui/item-icon.ts +6 -7
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "mux-sesh",
|
|
4
|
-
"version": "1.9.
|
|
4
|
+
"version": "1.9.4",
|
|
5
5
|
"description": "A beautiful tmux session manager built with OpenTUI - fuzzy search sessions, manage projects, clone from GitHub",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"packageManager": "bun@1.3.5",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './session-name'
|
|
@@ -0,0 +1,15 @@
|
|
|
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(item: Pick<Item, 'isSession' | 'title'>): boolean {
|
|
14
|
+
return item.isSession && isAgentSessionName(item.title)
|
|
15
|
+
}
|
package/src/app/commands.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isOpencodeSessionName } from '../opencode/session-name'
|
|
1
2
|
import type { CommandId } from '../ui/CommandsModal'
|
|
2
3
|
import { AppMode, ViewMode, type Item } from '../types'
|
|
3
4
|
|
|
@@ -5,9 +6,9 @@ interface ExecuteCommandContext {
|
|
|
5
6
|
appMode: AppMode
|
|
6
7
|
viewMode: ViewMode
|
|
7
8
|
cursor: number
|
|
8
|
-
|
|
9
|
+
agentCursor: number
|
|
9
10
|
regularSessions: Item[]
|
|
10
|
-
|
|
11
|
+
agentSessions: Item[]
|
|
11
12
|
selectedPrimaryItem?: Item
|
|
12
13
|
sessionCandidateItems: Item[]
|
|
13
14
|
projectSourceItems: Item[]
|
|
@@ -22,7 +23,7 @@ interface ExecuteCommandContext {
|
|
|
22
23
|
setItems: (items: Item[]) => void
|
|
23
24
|
setCursor: (cursor: number) => void
|
|
24
25
|
setSearchQuery: (value: string) => void
|
|
25
|
-
|
|
26
|
+
setAgentCursor: (cursor: number) => void
|
|
26
27
|
refreshItems: (forceViewMode?: ViewMode) => Promise<void>
|
|
27
28
|
handleLastSession: () => Promise<void>
|
|
28
29
|
handleRootSession: (item?: Item) => Promise<void>
|
|
@@ -65,8 +66,8 @@ export async function executeCommand(commandID: CommandId, ctx: ExecuteCommandCo
|
|
|
65
66
|
return
|
|
66
67
|
case 'rename-session': {
|
|
67
68
|
const target =
|
|
68
|
-
ctx.appMode === AppMode.
|
|
69
|
-
? ctx.
|
|
69
|
+
ctx.appMode === AppMode.AgentsManage
|
|
70
|
+
? ctx.agentSessions[ctx.agentCursor]
|
|
70
71
|
: ctx.viewMode === ViewMode.Sessions
|
|
71
72
|
? ctx.regularSessions[ctx.cursor]
|
|
72
73
|
: undefined
|
|
@@ -77,8 +78,8 @@ export async function executeCommand(commandID: CommandId, ctx: ExecuteCommandCo
|
|
|
77
78
|
}
|
|
78
79
|
case 'kill-session': {
|
|
79
80
|
const target =
|
|
80
|
-
ctx.appMode === AppMode.
|
|
81
|
-
? ctx.
|
|
81
|
+
ctx.appMode === AppMode.AgentsManage
|
|
82
|
+
? ctx.agentSessions[ctx.agentCursor]
|
|
82
83
|
: ctx.viewMode === ViewMode.Sessions
|
|
83
84
|
? ctx.regularSessions[ctx.cursor]
|
|
84
85
|
: undefined
|
|
@@ -109,12 +110,15 @@ export async function executeCommand(commandID: CommandId, ctx: ExecuteCommandCo
|
|
|
109
110
|
ctx.closeModal()
|
|
110
111
|
await ctx.handleEditTarget(ctx.selectedPrimaryItem)
|
|
111
112
|
return
|
|
112
|
-
case 'open-
|
|
113
|
+
case 'open-agents':
|
|
113
114
|
ctx.closeModal()
|
|
114
|
-
if (ctx.viewMode === ViewMode.Sessions && ctx.
|
|
115
|
-
ctx.setAppMode(AppMode.
|
|
116
|
-
ctx.
|
|
117
|
-
|
|
115
|
+
if (ctx.viewMode === ViewMode.Sessions && ctx.agentSessions.length > 0) {
|
|
116
|
+
ctx.setAppMode(AppMode.AgentsManage)
|
|
117
|
+
ctx.setAgentCursor(0)
|
|
118
|
+
const firstAgent = ctx.agentSessions[0].title
|
|
119
|
+
if (isOpencodeSessionName(firstAgent)) {
|
|
120
|
+
await ctx.loadOpencodeStatsForSession(firstAgent)
|
|
121
|
+
}
|
|
118
122
|
}
|
|
119
123
|
return
|
|
120
124
|
case 'refresh':
|
package/src/app/controller.ts
CHANGED
|
@@ -33,8 +33,8 @@ export function useAppController() {
|
|
|
33
33
|
setSessionItems,
|
|
34
34
|
cursor,
|
|
35
35
|
setCursor,
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
agentCursor,
|
|
37
|
+
setAgentCursor,
|
|
38
38
|
searchQuery,
|
|
39
39
|
setSearchQuery,
|
|
40
40
|
message,
|
|
@@ -133,8 +133,8 @@ export function useAppController() {
|
|
|
133
133
|
|
|
134
134
|
const {
|
|
135
135
|
regularSessions,
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
agentSessions,
|
|
137
|
+
selectedAgentSessionName,
|
|
138
138
|
selectedPrimaryItem,
|
|
139
139
|
filteredCommandEntries,
|
|
140
140
|
} = getSessionCommandState(
|
|
@@ -142,7 +142,7 @@ export function useAppController() {
|
|
|
142
142
|
viewMode,
|
|
143
143
|
items,
|
|
144
144
|
cursor,
|
|
145
|
-
|
|
145
|
+
agentCursor,
|
|
146
146
|
config,
|
|
147
147
|
commandsSearchQuery
|
|
148
148
|
)
|
|
@@ -204,9 +204,9 @@ export function useAppController() {
|
|
|
204
204
|
cursor,
|
|
205
205
|
showMessage,
|
|
206
206
|
refreshItems,
|
|
207
|
-
|
|
207
|
+
agentCursor,
|
|
208
208
|
regularSessions,
|
|
209
|
-
|
|
209
|
+
agentSessions,
|
|
210
210
|
selectedPrimaryItem,
|
|
211
211
|
sessionCandidateItems,
|
|
212
212
|
projectSourceItems,
|
|
@@ -220,7 +220,7 @@ export function useAppController() {
|
|
|
220
220
|
setItems,
|
|
221
221
|
setCursor,
|
|
222
222
|
setSearchQuery,
|
|
223
|
-
|
|
223
|
+
setAgentCursor,
|
|
224
224
|
setPendingKillSessionName,
|
|
225
225
|
saveConfig,
|
|
226
226
|
setConfig,
|
|
@@ -239,12 +239,12 @@ export function useAppController() {
|
|
|
239
239
|
config,
|
|
240
240
|
items,
|
|
241
241
|
regularSessions,
|
|
242
|
-
|
|
242
|
+
agentSessions,
|
|
243
243
|
sessionItems,
|
|
244
244
|
sessionCandidateItems,
|
|
245
245
|
projectSourceItems,
|
|
246
246
|
cursor,
|
|
247
|
-
|
|
247
|
+
agentCursor,
|
|
248
248
|
searchQuery,
|
|
249
249
|
prefixActive,
|
|
250
250
|
prefixTimeoutRef,
|
|
@@ -285,7 +285,7 @@ export function useAppController() {
|
|
|
285
285
|
setAppMode,
|
|
286
286
|
setViewMode,
|
|
287
287
|
setCursor,
|
|
288
|
-
|
|
288
|
+
setAgentCursor,
|
|
289
289
|
setSearchQuery,
|
|
290
290
|
setAllItems,
|
|
291
291
|
setItems,
|
|
@@ -317,13 +317,13 @@ export function useAppController() {
|
|
|
317
317
|
items,
|
|
318
318
|
selectedPrimaryItem,
|
|
319
319
|
pendingKillSessionName,
|
|
320
|
-
|
|
321
|
-
|
|
320
|
+
agentSessions,
|
|
321
|
+
agentCursor,
|
|
322
322
|
regularSessions,
|
|
323
323
|
setPendingKillSessionName,
|
|
324
324
|
searchQuery,
|
|
325
325
|
allItems,
|
|
326
|
-
|
|
326
|
+
selectedAgentSessionName,
|
|
327
327
|
loadOpencodeStatsForSession,
|
|
328
328
|
setUpdatedVersion,
|
|
329
329
|
setToastMessage,
|
|
@@ -342,10 +342,10 @@ export function useAppController() {
|
|
|
342
342
|
config,
|
|
343
343
|
items,
|
|
344
344
|
regularSessions,
|
|
345
|
-
|
|
345
|
+
agentSessions,
|
|
346
346
|
selectedPrimaryItem,
|
|
347
347
|
cursor,
|
|
348
|
-
|
|
348
|
+
agentCursor,
|
|
349
349
|
searchQuery,
|
|
350
350
|
prefixActive,
|
|
351
351
|
pendingKillSessionName,
|
package/src/app/core-state.ts
CHANGED
|
@@ -11,7 +11,7 @@ export function useAppCoreState() {
|
|
|
11
11
|
const [sessionCandidateItems, setSessionCandidateItems] = useState<Item[]>([])
|
|
12
12
|
const [sessionItems, setSessionItems] = useState<Item[]>([])
|
|
13
13
|
const [cursor, setCursor] = useState(0)
|
|
14
|
-
const [
|
|
14
|
+
const [agentCursor, setAgentCursor] = useState(0)
|
|
15
15
|
const [searchQuery, setSearchQuery] = useState('')
|
|
16
16
|
const [message, setMessage] = useState('')
|
|
17
17
|
const [renameTarget, setRenameTarget] = useState('')
|
|
@@ -43,8 +43,8 @@ export function useAppCoreState() {
|
|
|
43
43
|
setSessionItems,
|
|
44
44
|
cursor,
|
|
45
45
|
setCursor,
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
agentCursor,
|
|
47
|
+
setAgentCursor,
|
|
48
48
|
searchQuery,
|
|
49
49
|
setSearchQuery,
|
|
50
50
|
message,
|
package/src/app/data.ts
CHANGED
|
@@ -5,13 +5,13 @@ import { clearMatchIndices } from '../search'
|
|
|
5
5
|
import { listTmuxSessions } from '../tmux'
|
|
6
6
|
import { getProjectItems, getSessionCandidateItems } from '../tmux/projects'
|
|
7
7
|
import { filterHiddenSessions } from '../tmux/workflows'
|
|
8
|
-
import {
|
|
8
|
+
import { isAgentSessionItem } from '../agents/session-name'
|
|
9
9
|
import type { Config, Item } from '../types'
|
|
10
10
|
|
|
11
11
|
export type Measure = <T>(name: string, fn: () => Promise<T>) => Promise<T>
|
|
12
12
|
|
|
13
13
|
export function getSessionSelectionIndex(nextItems: Item[], selection?: string | null): number {
|
|
14
|
-
const regularItems = nextItems.filter(item => !
|
|
14
|
+
const regularItems = nextItems.filter(item => !isAgentSessionItem(item))
|
|
15
15
|
if (regularItems.length === 0 || !selection) {
|
|
16
16
|
return 0
|
|
17
17
|
}
|
package/src/app/derived.ts
CHANGED
|
@@ -13,8 +13,8 @@ import { splitVisibleSessions } from './view'
|
|
|
13
13
|
|
|
14
14
|
interface SessionCommandState {
|
|
15
15
|
regularSessions: Item[]
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
agentSessions: Item[]
|
|
17
|
+
selectedAgentSessionName: string | undefined
|
|
18
18
|
selectedPrimaryItem: Item | undefined
|
|
19
19
|
filteredCommandEntries: CommandEntry[]
|
|
20
20
|
}
|
|
@@ -29,28 +29,28 @@ export function getSessionCommandState(
|
|
|
29
29
|
viewMode: ViewMode,
|
|
30
30
|
items: Item[],
|
|
31
31
|
cursor: number,
|
|
32
|
-
|
|
32
|
+
agentCursor: number,
|
|
33
33
|
config: Config | null,
|
|
34
34
|
commandsSearchQuery: string
|
|
35
35
|
): SessionCommandState {
|
|
36
36
|
const sessionSplit =
|
|
37
37
|
viewMode === ViewMode.Sessions &&
|
|
38
|
-
(appMode === AppMode.Normal || appMode === AppMode.
|
|
38
|
+
(appMode === AppMode.Normal || appMode === AppMode.AgentsManage)
|
|
39
39
|
? splitVisibleSessions(items)
|
|
40
|
-
: { regularSessions: items,
|
|
40
|
+
: { regularSessions: items, agentSessions: [] }
|
|
41
41
|
|
|
42
42
|
const selectedPrimaryItem =
|
|
43
43
|
viewMode === ViewMode.Sessions && appMode === AppMode.Normal
|
|
44
44
|
? sessionSplit.regularSessions[cursor]
|
|
45
|
-
:
|
|
45
|
+
: viewMode === ViewMode.Sessions && appMode === AppMode.AgentsManage
|
|
46
|
+
? sessionSplit.agentSessions[agentCursor]
|
|
47
|
+
: items[cursor]
|
|
46
48
|
|
|
47
49
|
return {
|
|
48
50
|
regularSessions: sessionSplit.regularSessions,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
appMode === AppMode.
|
|
52
|
-
? sessionSplit.opencodeSessions[opencodeCursor]?.title
|
|
53
|
-
: undefined,
|
|
51
|
+
agentSessions: sessionSplit.agentSessions,
|
|
52
|
+
selectedAgentSessionName:
|
|
53
|
+
appMode === AppMode.AgentsManage ? sessionSplit.agentSessions[agentCursor]?.title : undefined,
|
|
54
54
|
selectedPrimaryItem,
|
|
55
55
|
filteredCommandEntries: filterCommandEntries(
|
|
56
56
|
getCommandEntries(appMode, config?.keybindMode, config?.prefixKey, selectedPrimaryItem),
|
package/src/app/effects.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useEffect, useRef, type Dispatch, type MutableRefObject, type SetStateAction } from 'react'
|
|
2
|
+
import { isOpencodeSessionName } from '../opencode/session-name'
|
|
2
3
|
import { checkAndUpdate, updateEvents } from '../update'
|
|
3
4
|
import { showTemporaryToast } from './notifications'
|
|
4
5
|
import { clearMatchIndices, filterAndSortItems } from '../search'
|
|
@@ -219,8 +220,8 @@ export function usePendingKillReset(
|
|
|
219
220
|
pendingKillSessionName: string | null,
|
|
220
221
|
appMode: AppMode,
|
|
221
222
|
viewMode: ViewMode,
|
|
222
|
-
|
|
223
|
-
|
|
223
|
+
agentSessions: Item[],
|
|
224
|
+
agentCursor: number,
|
|
224
225
|
regularSessions: Item[],
|
|
225
226
|
cursor: number,
|
|
226
227
|
setPendingKillSessionName: Dispatch<SetStateAction<string | null>>
|
|
@@ -231,8 +232,8 @@ export function usePendingKillReset(
|
|
|
231
232
|
}
|
|
232
233
|
|
|
233
234
|
const selectedSessionName =
|
|
234
|
-
appMode === AppMode.
|
|
235
|
-
?
|
|
235
|
+
appMode === AppMode.AgentsManage
|
|
236
|
+
? agentSessions[agentCursor]?.title
|
|
236
237
|
: viewMode === ViewMode.Sessions
|
|
237
238
|
? regularSessions[cursor]?.title
|
|
238
239
|
: undefined
|
|
@@ -243,8 +244,8 @@ export function usePendingKillReset(
|
|
|
243
244
|
}, [
|
|
244
245
|
appMode,
|
|
245
246
|
cursor,
|
|
246
|
-
|
|
247
|
-
|
|
247
|
+
agentCursor,
|
|
248
|
+
agentSessions,
|
|
248
249
|
pendingKillSessionName,
|
|
249
250
|
regularSessions,
|
|
250
251
|
setPendingKillSessionName,
|
|
@@ -333,27 +334,27 @@ export function useNewSessionFileSearch(
|
|
|
333
334
|
}
|
|
334
335
|
|
|
335
336
|
export function useOpencodeStatsPolling(
|
|
336
|
-
|
|
337
|
+
selectedAgentSessionName: string | undefined,
|
|
337
338
|
loadOpencodeStatsForSession: (sessionName: string) => Promise<unknown>
|
|
338
339
|
) {
|
|
339
340
|
const loadStatsRef = useRef(loadOpencodeStatsForSession)
|
|
340
341
|
loadStatsRef.current = loadOpencodeStatsForSession
|
|
341
342
|
|
|
342
343
|
useEffect(() => {
|
|
343
|
-
if (!
|
|
344
|
+
if (!selectedAgentSessionName || !isOpencodeSessionName(selectedAgentSessionName)) {
|
|
344
345
|
return
|
|
345
346
|
}
|
|
346
347
|
|
|
347
|
-
void loadStatsRef.current(
|
|
348
|
+
void loadStatsRef.current(selectedAgentSessionName)
|
|
348
349
|
|
|
349
350
|
const interval = setInterval(() => {
|
|
350
|
-
void loadStatsRef.current(
|
|
351
|
+
void loadStatsRef.current(selectedAgentSessionName)
|
|
351
352
|
}, 2000)
|
|
352
353
|
|
|
353
354
|
return () => {
|
|
354
355
|
clearInterval(interval)
|
|
355
356
|
}
|
|
356
|
-
}, [
|
|
357
|
+
}, [selectedAgentSessionName])
|
|
357
358
|
}
|
|
358
359
|
|
|
359
360
|
interface UseAppBehaviorsOptions {
|
|
@@ -380,13 +381,13 @@ interface UseAppBehaviorsOptions {
|
|
|
380
381
|
items: Item[]
|
|
381
382
|
selectedPrimaryItem: Item | undefined
|
|
382
383
|
pendingKillSessionName: string | null
|
|
383
|
-
|
|
384
|
-
|
|
384
|
+
agentSessions: Item[]
|
|
385
|
+
agentCursor: number
|
|
385
386
|
regularSessions: Item[]
|
|
386
387
|
setPendingKillSessionName: Dispatch<SetStateAction<string | null>>
|
|
387
388
|
searchQuery: string
|
|
388
389
|
allItems: Item[]
|
|
389
|
-
|
|
390
|
+
selectedAgentSessionName: string | undefined
|
|
390
391
|
loadOpencodeStatsForSession: (sessionName: string) => Promise<unknown>
|
|
391
392
|
setUpdatedVersion: Dispatch<SetStateAction<string | null>>
|
|
392
393
|
setToastMessage: Dispatch<SetStateAction<string>>
|
|
@@ -438,8 +439,8 @@ export function useAppBehaviors(options: UseAppBehaviorsOptions) {
|
|
|
438
439
|
options.pendingKillSessionName,
|
|
439
440
|
options.appMode,
|
|
440
441
|
options.viewMode,
|
|
441
|
-
options.
|
|
442
|
-
options.
|
|
442
|
+
options.agentSessions,
|
|
443
|
+
options.agentCursor,
|
|
443
444
|
options.regularSessions,
|
|
444
445
|
options.cursor,
|
|
445
446
|
options.setPendingKillSessionName
|
|
@@ -459,5 +460,5 @@ export function useAppBehaviors(options: UseAppBehaviorsOptions) {
|
|
|
459
460
|
options.setItems,
|
|
460
461
|
options.setCursor
|
|
461
462
|
)
|
|
462
|
-
useOpencodeStatsPolling(options.
|
|
463
|
+
useOpencodeStatsPolling(options.selectedAgentSessionName, options.loadOpencodeStatsForSession)
|
|
463
464
|
}
|
package/src/app/handlers.ts
CHANGED
|
@@ -210,9 +210,9 @@ export async function executeAppCommand(
|
|
|
210
210
|
interface CreateAppHandlersOptions extends SharedHandlerOptions {
|
|
211
211
|
appMode: AppMode
|
|
212
212
|
viewMode: ViewMode
|
|
213
|
-
|
|
213
|
+
agentCursor: number
|
|
214
214
|
regularSessions: Item[]
|
|
215
|
-
|
|
215
|
+
agentSessions: Item[]
|
|
216
216
|
selectedPrimaryItem?: Item
|
|
217
217
|
sessionCandidateItems: Item[]
|
|
218
218
|
projectSourceItems: Item[]
|
|
@@ -226,7 +226,7 @@ interface CreateAppHandlersOptions extends SharedHandlerOptions {
|
|
|
226
226
|
setItems: (items: Item[]) => void
|
|
227
227
|
setCursor: (cursor: number) => void
|
|
228
228
|
setSearchQuery: (value: string) => void
|
|
229
|
-
|
|
229
|
+
setAgentCursor: (cursor: number) => void
|
|
230
230
|
setPendingKillSessionName: (sessionName: string | null) => void
|
|
231
231
|
saveConfig: (config: Config) => Promise<void>
|
|
232
232
|
setConfig: (config: Config) => void
|
|
@@ -330,9 +330,9 @@ export function createAppHandlers(options: CreateAppHandlersOptions) {
|
|
|
330
330
|
appMode: options.appMode,
|
|
331
331
|
viewMode: options.viewMode,
|
|
332
332
|
cursor: options.cursor,
|
|
333
|
-
|
|
333
|
+
agentCursor: options.agentCursor,
|
|
334
334
|
regularSessions: options.regularSessions,
|
|
335
|
-
|
|
335
|
+
agentSessions: options.agentSessions,
|
|
336
336
|
selectedPrimaryItem: options.selectedPrimaryItem,
|
|
337
337
|
sessionCandidateItems: options.sessionCandidateItems,
|
|
338
338
|
projectSourceItems: options.projectSourceItems,
|
|
@@ -347,7 +347,7 @@ export function createAppHandlers(options: CreateAppHandlersOptions) {
|
|
|
347
347
|
setItems: options.setItems,
|
|
348
348
|
setCursor: options.setCursor,
|
|
349
349
|
setSearchQuery: options.setSearchQuery,
|
|
350
|
-
|
|
350
|
+
setAgentCursor: options.setAgentCursor,
|
|
351
351
|
refreshItems: forceViewMode => options.refreshItems(forceViewMode),
|
|
352
352
|
handleLastSession: handleLastSessionWrapper,
|
|
353
353
|
handleRootSession: handleRootSessionWrapper,
|
package/src/app/keyboard.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { ModalState } from './modals'
|
|
|
5
5
|
import {
|
|
6
6
|
handleNewSessionMode,
|
|
7
7
|
handleNormalMode,
|
|
8
|
-
|
|
8
|
+
handleAgentsManageMode,
|
|
9
9
|
handleSearchMode,
|
|
10
10
|
type KeyboardHandlerContext,
|
|
11
11
|
} from '../handlers/keyboard'
|
|
@@ -20,12 +20,12 @@ interface UseAppKeyboardOptions {
|
|
|
20
20
|
config: Config | null
|
|
21
21
|
items: Item[]
|
|
22
22
|
regularSessions: Item[]
|
|
23
|
-
|
|
23
|
+
agentSessions: Item[]
|
|
24
24
|
sessionItems: Item[]
|
|
25
25
|
sessionCandidateItems: Item[]
|
|
26
26
|
projectSourceItems: Item[]
|
|
27
27
|
cursor: number
|
|
28
|
-
|
|
28
|
+
agentCursor: number
|
|
29
29
|
searchQuery: string
|
|
30
30
|
prefixActive: boolean
|
|
31
31
|
prefixTimeoutRef: MutableRefObject<NodeJS.Timeout | null>
|
|
@@ -66,7 +66,7 @@ interface UseAppKeyboardOptions {
|
|
|
66
66
|
setAppMode: Dispatch<SetStateAction<AppMode>>
|
|
67
67
|
setViewMode: Dispatch<SetStateAction<ViewMode>>
|
|
68
68
|
setCursor: Dispatch<SetStateAction<number>>
|
|
69
|
-
|
|
69
|
+
setAgentCursor: Dispatch<SetStateAction<number>>
|
|
70
70
|
setSearchQuery: Dispatch<SetStateAction<string>>
|
|
71
71
|
setAllItems: Dispatch<SetStateAction<Item[]>>
|
|
72
72
|
setItems: Dispatch<SetStateAction<Item[]>>
|
|
@@ -80,9 +80,9 @@ export function useAppKeyboard(options: UseAppKeyboardOptions) {
|
|
|
80
80
|
viewMode: options.viewMode,
|
|
81
81
|
items: options.items,
|
|
82
82
|
regularSessions: options.regularSessions,
|
|
83
|
-
|
|
83
|
+
agentSessions: options.agentSessions,
|
|
84
84
|
cursor: options.cursor,
|
|
85
|
-
|
|
85
|
+
agentCursor: options.agentCursor,
|
|
86
86
|
searchQuery: options.searchQuery,
|
|
87
87
|
prefixKey: options.config?.prefixKey,
|
|
88
88
|
projectItems:
|
|
@@ -95,7 +95,7 @@ export function useAppKeyboard(options: UseAppKeyboardOptions) {
|
|
|
95
95
|
setAppMode: options.setAppMode,
|
|
96
96
|
setViewMode: options.setViewMode,
|
|
97
97
|
setCursor: options.setCursor,
|
|
98
|
-
|
|
98
|
+
setAgentCursor: options.setAgentCursor,
|
|
99
99
|
setSearchQuery: options.setSearchQuery,
|
|
100
100
|
setAllItems: options.setAllItems,
|
|
101
101
|
setItems: options.setItems,
|
|
@@ -156,8 +156,8 @@ export function useAppKeyboard(options: UseAppKeyboardOptions) {
|
|
|
156
156
|
} else {
|
|
157
157
|
handleNewSessionMode(key, keyboardContext, keybindMode)
|
|
158
158
|
}
|
|
159
|
-
} else if (options.appMode === AppMode.
|
|
160
|
-
|
|
159
|
+
} else if (options.appMode === AppMode.AgentsManage) {
|
|
160
|
+
handleAgentsManageMode(key, keyboardContext, keybindMode)
|
|
161
161
|
}
|
|
162
162
|
})
|
|
163
163
|
}
|
package/src/app/screen.tsx
CHANGED
|
@@ -8,12 +8,13 @@ import {
|
|
|
8
8
|
getStatusLabel,
|
|
9
9
|
} from './view'
|
|
10
10
|
import { syncTextareaValue } from './textarea'
|
|
11
|
+
import { isOpencodeSessionItem } from '../opencode/session-name'
|
|
11
12
|
import { AppMode, ViewMode, type Config, type Item, type ThemeColors } from '../types'
|
|
12
13
|
import { isGitHubURL } from '../util/github'
|
|
13
14
|
import { shouldShowDetailPanel } from '../util/terminal'
|
|
14
15
|
import SearchInput from '../ui/SearchInput'
|
|
15
16
|
import SessionList from '../ui/SessionList'
|
|
16
|
-
import
|
|
17
|
+
import AgentSessionGroup from '../ui/AgentSessionGroup'
|
|
17
18
|
import ItemList from '../ui/ItemList'
|
|
18
19
|
import OpencodeStatsPanel from '../ui/OpencodeStatsPanel'
|
|
19
20
|
import SessionDetailsPanel from '../ui/SessionDetailsPanel'
|
|
@@ -28,10 +29,10 @@ interface Props {
|
|
|
28
29
|
config: Config | null
|
|
29
30
|
items: Item[]
|
|
30
31
|
regularSessions: Item[]
|
|
31
|
-
|
|
32
|
+
agentSessions: Item[]
|
|
32
33
|
selectedPrimaryItem?: Item
|
|
33
34
|
cursor: number
|
|
34
|
-
|
|
35
|
+
agentCursor: number
|
|
35
36
|
searchQuery: string
|
|
36
37
|
prefixActive: boolean
|
|
37
38
|
pendingKillSessionName: string | null
|
|
@@ -54,10 +55,10 @@ export function AppScreen({
|
|
|
54
55
|
config,
|
|
55
56
|
items,
|
|
56
57
|
regularSessions,
|
|
57
|
-
|
|
58
|
+
agentSessions,
|
|
58
59
|
selectedPrimaryItem,
|
|
59
60
|
cursor,
|
|
60
|
-
|
|
61
|
+
agentCursor,
|
|
61
62
|
searchQuery,
|
|
62
63
|
prefixActive,
|
|
63
64
|
pendingKillSessionName,
|
|
@@ -78,6 +79,12 @@ export function AppScreen({
|
|
|
78
79
|
const activeSessions = items.filter(item => item.isSession && item.isAttached).length
|
|
79
80
|
const maxVisibleItems = Math.max(8, rows - (appMode === AppMode.NewSession ? 10 : 12))
|
|
80
81
|
const versionLabel = formatVersionBadge(CURRENT_VERSION, updatedVersion)
|
|
82
|
+
const selectedAgentSession = agentSessions[agentCursor]
|
|
83
|
+
const showOpencodeStats =
|
|
84
|
+
viewMode === ViewMode.Sessions &&
|
|
85
|
+
appMode === AppMode.AgentsManage &&
|
|
86
|
+
selectedAgentSession !== undefined &&
|
|
87
|
+
isOpencodeSessionItem(selectedAgentSession)
|
|
81
88
|
const footerHint = getFooterHint(appMode, config?.prefixKey)
|
|
82
89
|
|
|
83
90
|
return (
|
|
@@ -134,7 +141,7 @@ export function AppScreen({
|
|
|
134
141
|
flexShrink: 0,
|
|
135
142
|
marginTop:
|
|
136
143
|
viewMode === ViewMode.Sessions &&
|
|
137
|
-
(appMode === AppMode.Normal || appMode === AppMode.
|
|
144
|
+
(appMode === AppMode.Normal || appMode === AppMode.AgentsManage)
|
|
138
145
|
? 1
|
|
139
146
|
: 0,
|
|
140
147
|
}}
|
|
@@ -144,7 +151,7 @@ export function AppScreen({
|
|
|
144
151
|
{getEmptyStateMessage(appMode, searchQuery, isGitHubURL(searchQuery))}
|
|
145
152
|
</text>
|
|
146
153
|
) : viewMode === ViewMode.Sessions &&
|
|
147
|
-
(appMode === AppMode.Normal || appMode === AppMode.
|
|
154
|
+
(appMode === AppMode.Normal || appMode === AppMode.AgentsManage) ? (
|
|
148
155
|
<>
|
|
149
156
|
<SessionList
|
|
150
157
|
items={regularSessions}
|
|
@@ -155,10 +162,10 @@ export function AppScreen({
|
|
|
155
162
|
pendingKillSessionName={pendingKillSessionName}
|
|
156
163
|
/>
|
|
157
164
|
|
|
158
|
-
<
|
|
159
|
-
sessions={
|
|
165
|
+
<AgentSessionGroup
|
|
166
|
+
sessions={agentSessions}
|
|
160
167
|
appMode={appMode}
|
|
161
|
-
cursor={
|
|
168
|
+
cursor={agentCursor}
|
|
162
169
|
icons={config?.icons}
|
|
163
170
|
pendingKillSessionName={pendingKillSessionName}
|
|
164
171
|
/>
|
|
@@ -178,8 +185,8 @@ export function AppScreen({
|
|
|
178
185
|
</box>
|
|
179
186
|
|
|
180
187
|
{shouldShowDetailPanel(columns, appMode === AppMode.NewSession) &&
|
|
181
|
-
(
|
|
182
|
-
<OpencodeStatsPanel selectedItem={
|
|
188
|
+
(showOpencodeStats ? (
|
|
189
|
+
<OpencodeStatsPanel selectedItem={selectedAgentSession} />
|
|
183
190
|
) : (
|
|
184
191
|
<SessionDetailsPanel selectedItem={selectedPrimaryItem} config={config} />
|
|
185
192
|
))}
|
package/src/app/view.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { isAgentSessionItem } from '../agents/session-name'
|
|
1
2
|
import { getPanelStyle } from '../styles/theme'
|
|
2
|
-
import { isOpencodeSessionItem } from '../opencode/session-name'
|
|
3
3
|
import { AppMode, ViewMode, type ThemeColors } from '../types'
|
|
4
4
|
|
|
5
5
|
export function splitVisibleSessions<T extends { isSession: boolean; title: string }>(
|
|
6
6
|
items: readonly T[]
|
|
7
7
|
) {
|
|
8
8
|
return {
|
|
9
|
-
regularSessions: items.filter(item => !
|
|
10
|
-
|
|
9
|
+
regularSessions: items.filter(item => !isAgentSessionItem(item)),
|
|
10
|
+
agentSessions: items.filter(isAgentSessionItem),
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -20,8 +20,8 @@ export function getAppTitle(appMode: AppMode, viewMode: ViewMode): string {
|
|
|
20
20
|
return 'New Session'
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
if (appMode === AppMode.
|
|
24
|
-
return '
|
|
23
|
+
if (appMode === AppMode.AgentsManage) {
|
|
24
|
+
return 'Agent Sessions'
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
return viewMode === ViewMode.Projects ? 'Projects' : 'Sessions'
|
|
@@ -58,7 +58,7 @@ export function getStatusLabel(
|
|
|
58
58
|
export function getFooterHint(appMode: AppMode, prefixKey?: string): string {
|
|
59
59
|
const prefixLabel = prefixKey ? `${prefixKey} ...` : 'direct keys'
|
|
60
60
|
|
|
61
|
-
if (appMode === AppMode.
|
|
61
|
+
if (appMode === AppMode.AgentsManage) {
|
|
62
62
|
return `o back d kill ctrl+p commands ${prefixLabel}`
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -70,7 +70,7 @@ export function getFooterHint(appMode: AppMode, prefixKey?: string): string {
|
|
|
70
70
|
return 'enter select esc cancel'
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
return `enter select i search n new o
|
|
73
|
+
return `enter select i search n new o agents d kill ctrl+p commands ${prefixLabel}`
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
export function getEmptyStateMessage(
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isOpencodeSessionName } from '../../opencode/session-name'
|
|
1
2
|
import { AppMode, type KeybindMode } from '../../types'
|
|
2
3
|
import { clampCursorIndex } from '../../ui/list-window'
|
|
3
4
|
import {
|
|
@@ -9,7 +10,13 @@ import {
|
|
|
9
10
|
type KeyboardInput,
|
|
10
11
|
} from './shared'
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
function loadStatsIfOpencode(ctx: KeyboardHandlerContext, sessionName: string) {
|
|
14
|
+
if (isOpencodeSessionName(sessionName)) {
|
|
15
|
+
void ctx.loadOpencodeStatsForSession(sessionName)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function handleAgentsManageMode(
|
|
13
20
|
key: KeyboardInput,
|
|
14
21
|
ctx: KeyboardHandlerContext,
|
|
15
22
|
keybindMode: KeybindMode = 'vim'
|
|
@@ -32,14 +39,14 @@ export function handleOpencodeManageMode(
|
|
|
32
39
|
ctx.setAppMode(AppMode.Normal)
|
|
33
40
|
return
|
|
34
41
|
case 'd':
|
|
35
|
-
if (ctx.
|
|
36
|
-
ctx.requestKillSession(ctx.
|
|
42
|
+
if (ctx.agentSessions[ctx.agentCursor]) {
|
|
43
|
+
ctx.requestKillSession(ctx.agentSessions[ctx.agentCursor].title)
|
|
37
44
|
}
|
|
38
45
|
return
|
|
39
46
|
case 'r':
|
|
40
|
-
if (ctx.
|
|
47
|
+
if (ctx.agentSessions[ctx.agentCursor]) {
|
|
41
48
|
ctx.clearPendingKill()
|
|
42
|
-
ctx.openRenameModal(ctx.
|
|
49
|
+
ctx.openRenameModal(ctx.agentSessions[ctx.agentCursor].title)
|
|
43
50
|
}
|
|
44
51
|
return
|
|
45
52
|
}
|
|
@@ -60,10 +67,10 @@ export function handleOpencodeManageMode(
|
|
|
60
67
|
|
|
61
68
|
if (keyName === 'down' || (!isStandard && keyName === 'j')) {
|
|
62
69
|
ctx.clearPendingKill()
|
|
63
|
-
ctx.
|
|
64
|
-
const next = clampCursorIndex(ctx.
|
|
65
|
-
if (next !== cursor && ctx.
|
|
66
|
-
|
|
70
|
+
ctx.setAgentCursor(cursor => {
|
|
71
|
+
const next = clampCursorIndex(ctx.agentSessions.length, cursor + 1)
|
|
72
|
+
if (next !== cursor && ctx.agentSessions[next]) {
|
|
73
|
+
loadStatsIfOpencode(ctx, ctx.agentSessions[next].title)
|
|
67
74
|
}
|
|
68
75
|
return next
|
|
69
76
|
})
|
|
@@ -72,10 +79,10 @@ export function handleOpencodeManageMode(
|
|
|
72
79
|
|
|
73
80
|
if (keyName === 'up' || (!isStandard && keyName === 'k')) {
|
|
74
81
|
ctx.clearPendingKill()
|
|
75
|
-
ctx.
|
|
76
|
-
const next = clampCursorIndex(ctx.
|
|
77
|
-
if (next !== cursor && ctx.
|
|
78
|
-
|
|
82
|
+
ctx.setAgentCursor(cursor => {
|
|
83
|
+
const next = clampCursorIndex(ctx.agentSessions.length, cursor - 1)
|
|
84
|
+
if (next !== cursor && ctx.agentSessions[next]) {
|
|
85
|
+
loadStatsIfOpencode(ctx, ctx.agentSessions[next].title)
|
|
79
86
|
}
|
|
80
87
|
return next
|
|
81
88
|
})
|
|
@@ -83,16 +90,16 @@ export function handleOpencodeManageMode(
|
|
|
83
90
|
}
|
|
84
91
|
|
|
85
92
|
if (!isStandard && keyName === 'd') {
|
|
86
|
-
if (ctx.
|
|
87
|
-
ctx.requestKillSession(ctx.
|
|
93
|
+
if (ctx.agentSessions[ctx.agentCursor]) {
|
|
94
|
+
ctx.requestKillSession(ctx.agentSessions[ctx.agentCursor].title)
|
|
88
95
|
}
|
|
89
96
|
return
|
|
90
97
|
}
|
|
91
98
|
|
|
92
99
|
if (!ctx.prefixKey && !isStandard && keyName === 'r') {
|
|
93
|
-
if (ctx.
|
|
100
|
+
if (ctx.agentSessions[ctx.agentCursor]) {
|
|
94
101
|
ctx.clearPendingKill()
|
|
95
|
-
ctx.openRenameModal(ctx.
|
|
102
|
+
ctx.openRenameModal(ctx.agentSessions[ctx.agentCursor].title)
|
|
96
103
|
}
|
|
97
104
|
return
|
|
98
105
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { KeyboardHandlerContext, KeyboardInput } from './shared'
|
|
2
2
|
export { handleNormalMode } from './normal'
|
|
3
|
-
export {
|
|
3
|
+
export { handleAgentsManageMode } from './agents'
|
|
4
4
|
export { handleSearchMode } from './search'
|
|
5
5
|
export { handleNewSessionMode } from './new-session'
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isOpencodeSessionName } from '../../opencode/session-name'
|
|
1
2
|
import { AppMode, ViewMode, type KeybindMode } from '../../types'
|
|
2
3
|
import { clampCursorIndex } from '../../ui/list-window'
|
|
3
4
|
import { requestShutdown } from '../../util/shutdown'
|
|
@@ -98,10 +99,13 @@ export function handleNormalMode(
|
|
|
98
99
|
|
|
99
100
|
if (!isStandard && keyName === 'o') {
|
|
100
101
|
ctx.clearPendingKill()
|
|
101
|
-
if (ctx.viewMode === ViewMode.Sessions && ctx.
|
|
102
|
-
ctx.setAppMode(AppMode.
|
|
103
|
-
ctx.
|
|
104
|
-
|
|
102
|
+
if (ctx.viewMode === ViewMode.Sessions && ctx.agentSessions.length > 0) {
|
|
103
|
+
ctx.setAppMode(AppMode.AgentsManage)
|
|
104
|
+
ctx.setAgentCursor(0)
|
|
105
|
+
const firstAgent = ctx.agentSessions[0].title
|
|
106
|
+
if (isOpencodeSessionName(firstAgent)) {
|
|
107
|
+
void ctx.loadOpencodeStatsForSession(firstAgent)
|
|
108
|
+
}
|
|
105
109
|
}
|
|
106
110
|
return
|
|
107
111
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isOpencodeSessionName } from '../../opencode/session-name'
|
|
1
2
|
import { AppMode, ViewMode, type KeybindMode } from '../../types'
|
|
2
3
|
import { clampCursorIndex } from '../../ui/list-window'
|
|
3
4
|
import { requestShutdown } from '../../util/shutdown'
|
|
@@ -35,10 +36,13 @@ export function handleSearchMode(
|
|
|
35
36
|
return
|
|
36
37
|
case 'o':
|
|
37
38
|
ctx.clearPendingKill()
|
|
38
|
-
if (ctx.viewMode === ViewMode.Sessions && ctx.
|
|
39
|
-
ctx.setAppMode(AppMode.
|
|
40
|
-
ctx.
|
|
41
|
-
|
|
39
|
+
if (ctx.viewMode === ViewMode.Sessions && ctx.agentSessions.length > 0) {
|
|
40
|
+
ctx.setAppMode(AppMode.AgentsManage)
|
|
41
|
+
ctx.setAgentCursor(0)
|
|
42
|
+
const firstAgent = ctx.agentSessions[0].title
|
|
43
|
+
if (isOpencodeSessionName(firstAgent)) {
|
|
44
|
+
void ctx.loadOpencodeStatsForSession(firstAgent)
|
|
45
|
+
}
|
|
42
46
|
}
|
|
43
47
|
return
|
|
44
48
|
case 's':
|
|
@@ -12,9 +12,9 @@ export interface KeyboardHandlerContext {
|
|
|
12
12
|
viewMode: ViewMode
|
|
13
13
|
items: Item[]
|
|
14
14
|
regularSessions: Item[]
|
|
15
|
-
|
|
15
|
+
agentSessions: Item[]
|
|
16
16
|
cursor: number
|
|
17
|
-
|
|
17
|
+
agentCursor: number
|
|
18
18
|
searchQuery: string
|
|
19
19
|
prefixKey?: string
|
|
20
20
|
projectItems: Item[]
|
|
@@ -24,7 +24,7 @@ export interface KeyboardHandlerContext {
|
|
|
24
24
|
setAppMode: (mode: AppMode) => void
|
|
25
25
|
setViewMode: (mode: ViewMode) => void
|
|
26
26
|
setCursor: Dispatch<SetStateAction<number>>
|
|
27
|
-
|
|
27
|
+
setAgentCursor: Dispatch<SetStateAction<number>>
|
|
28
28
|
setSearchQuery: (query: string) => void
|
|
29
29
|
setAllItems: Dispatch<SetStateAction<Item[]>>
|
|
30
30
|
setItems: Dispatch<SetStateAction<Item[]>>
|
package/src/items/order.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Item, SortOrder } from '../types'
|
|
2
|
-
import {
|
|
2
|
+
import { isAgentSessionItem } from '../agents/session-name'
|
|
3
3
|
import { getLiveSessionSortKey } from '../util/path-display'
|
|
4
4
|
|
|
5
5
|
export type SessionSection = 'pinned' | 'live' | 'configured'
|
|
@@ -62,8 +62,8 @@ export function orderSessionItems(
|
|
|
62
62
|
pinnedSessions: readonly string[] = []
|
|
63
63
|
): Item[] {
|
|
64
64
|
const itemsWithPinnedState = applyPinnedState(items, pinnedSessions)
|
|
65
|
-
const
|
|
66
|
-
const regularItems = itemsWithPinnedState.filter(item => !
|
|
65
|
+
const agentItems = itemsWithPinnedState.filter(isAgentSessionItem).sort(compareByTitle)
|
|
66
|
+
const regularItems = itemsWithPinnedState.filter(item => !isAgentSessionItem(item))
|
|
67
67
|
const { pinnedItems, remainingItems } = splitPinnedItems(regularItems, pinnedSessions)
|
|
68
68
|
|
|
69
69
|
const orderedRegularItems =
|
|
@@ -79,7 +79,7 @@ export function orderSessionItems(
|
|
|
79
79
|
})
|
|
80
80
|
: sortByGroup(remainingItems, ['live', 'configured'])
|
|
81
81
|
|
|
82
|
-
return [...pinnedItems, ...orderedRegularItems, ...
|
|
82
|
+
return [...pinnedItems, ...orderedRegularItems, ...agentItems]
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
export function orderProjectItems(items: Item[], sortOrder: SortOrder = 'live-first'): Item[] {
|
package/src/types/index.ts
CHANGED
|
@@ -12,7 +12,7 @@ interface Props {
|
|
|
12
12
|
pendingKillSessionName?: string | null
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export default function
|
|
15
|
+
export default function AgentSessionGroup({
|
|
16
16
|
sessions,
|
|
17
17
|
appMode,
|
|
18
18
|
cursor,
|
|
@@ -22,7 +22,7 @@ export default function OpencodeSessionGroup({
|
|
|
22
22
|
const theme = useTheme()
|
|
23
23
|
if (sessions.length === 0) return null
|
|
24
24
|
|
|
25
|
-
const header = formatSectionHeader(theme, '
|
|
25
|
+
const header = formatSectionHeader(theme, 'agents', icons)
|
|
26
26
|
|
|
27
27
|
return (
|
|
28
28
|
<>
|
|
@@ -31,11 +31,11 @@ export default function OpencodeSessionGroup({
|
|
|
31
31
|
</text>
|
|
32
32
|
{sessions.map((item, i) => {
|
|
33
33
|
const pendingKill = item.title === pendingKillSessionName
|
|
34
|
-
const selected = appMode === AppModeEnum.
|
|
34
|
+
const selected = appMode === AppModeEnum.AgentsManage && i === cursor
|
|
35
35
|
|
|
36
36
|
return (
|
|
37
37
|
<box
|
|
38
|
-
key={`
|
|
38
|
+
key={`agent-${i}`}
|
|
39
39
|
style={{
|
|
40
40
|
flexDirection: 'row',
|
|
41
41
|
justifyContent: 'space-between',
|
package/src/ui/CommandsModal.tsx
CHANGED
|
@@ -16,7 +16,7 @@ export type CommandId =
|
|
|
16
16
|
| 'last-session'
|
|
17
17
|
| 'root-session'
|
|
18
18
|
| 'edit-target'
|
|
19
|
-
| 'open-
|
|
19
|
+
| 'open-agents'
|
|
20
20
|
| 'refresh'
|
|
21
21
|
| 'back'
|
|
22
22
|
|
|
@@ -51,7 +51,7 @@ export function getCommandEntries(
|
|
|
51
51
|
prefixKey ? prefixed(prefixKey, suffix) : fallback
|
|
52
52
|
const prefixCategory = prefixKey ? `Prefix ${prefixKey}` : 'Prefix'
|
|
53
53
|
|
|
54
|
-
if (appMode === AppMode.
|
|
54
|
+
if (appMode === AppMode.AgentsManage) {
|
|
55
55
|
return [
|
|
56
56
|
{ id: 'back', category: 'Direct', title: 'Back', keybind: 'esc' },
|
|
57
57
|
{ id: 'kill-session', category: 'Direct', title: 'Kill session', keybind: 'd' },
|
|
@@ -68,7 +68,7 @@ export function getCommandEntries(
|
|
|
68
68
|
return [
|
|
69
69
|
{ id: 'search', category: 'Direct', title: 'Search', keybind: 'i' },
|
|
70
70
|
{ id: 'new-session', category: 'Direct', title: 'New session', keybind: 'n' },
|
|
71
|
-
{ id: 'open-
|
|
71
|
+
{ id: 'open-agents', category: 'Direct', title: 'Open agent sessions', keybind: 'o' },
|
|
72
72
|
{ id: 'kill-session', category: 'Direct', title: 'Kill session', keybind: 'd' },
|
|
73
73
|
...(selectedItem && (selectedItem.isSession || selectedItem.itemKind === 'configured')
|
|
74
74
|
? [
|
package/src/ui/item-icon.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { isAgentSessionItem } from '../agents/session-name'
|
|
1
2
|
import type { SessionSection } from '../items/order'
|
|
2
|
-
import { isOpencodeSessionItem } from '../opencode/session-name'
|
|
3
3
|
import type { IconConfig, Item, ThemeColors } from '../types'
|
|
4
4
|
|
|
5
5
|
export interface ItemIconPresentation {
|
|
@@ -45,8 +45,7 @@ export function getItemIconPresentation(
|
|
|
45
45
|
|
|
46
46
|
if (item.isSession) {
|
|
47
47
|
return {
|
|
48
|
-
glyph:
|
|
49
|
-
item.icon ?? (isOpencodeSessionItem(item) ? resolvedIcons.opencode : resolvedIcons.tmux),
|
|
48
|
+
glyph: item.icon ?? (isAgentSessionItem(item) ? resolvedIcons.opencode : resolvedIcons.tmux),
|
|
50
49
|
color: item.isAttached ? theme.active : theme.inactive,
|
|
51
50
|
}
|
|
52
51
|
}
|
|
@@ -66,7 +65,7 @@ export function getItemIconPresentation(
|
|
|
66
65
|
|
|
67
66
|
export function getSessionSectionPresentation(
|
|
68
67
|
theme: ThemeColors,
|
|
69
|
-
section: SessionSection | '
|
|
68
|
+
section: SessionSection | 'agents',
|
|
70
69
|
icons?: IconConfig
|
|
71
70
|
): ItemIconPresentation & { label: string } {
|
|
72
71
|
const resolvedIcons = getIconConfig(icons)
|
|
@@ -76,8 +75,8 @@ export function getSessionSectionPresentation(
|
|
|
76
75
|
return { glyph: '', color: theme.accent, label: 'Pinned' }
|
|
77
76
|
case 'configured':
|
|
78
77
|
return { glyph: resolvedIcons.configured, color: theme.action, label: 'Configured' }
|
|
79
|
-
case '
|
|
80
|
-
return { glyph: resolvedIcons.opencode, color: theme.action, label: '
|
|
78
|
+
case 'agents':
|
|
79
|
+
return { glyph: resolvedIcons.opencode, color: theme.action, label: 'Agents' }
|
|
81
80
|
case 'live':
|
|
82
81
|
return { glyph: resolvedIcons.tmux, color: theme.action, label: 'Live' }
|
|
83
82
|
}
|
|
@@ -85,7 +84,7 @@ export function getSessionSectionPresentation(
|
|
|
85
84
|
|
|
86
85
|
export function formatSectionHeader(
|
|
87
86
|
theme: ThemeColors,
|
|
88
|
-
section: SessionSection | '
|
|
87
|
+
section: SessionSection | 'agents',
|
|
89
88
|
icons?: IconConfig
|
|
90
89
|
): ItemIconPresentation & { text: string } {
|
|
91
90
|
const presentation = getSessionSectionPresentation(theme, section, icons)
|