mux-sesh 1.6.3 → 1.7.0
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 +90 -59
- package/package.json +7 -5
- package/src/app/commands.ts +120 -0
- package/src/app/controller.ts +397 -0
- package/src/app/controls.ts +121 -0
- package/src/app/core-state.ts +71 -0
- package/src/app/data.ts +90 -0
- package/src/app/derived.ts +77 -0
- package/src/app/effects.ts +392 -0
- package/src/app/handlers.ts +325 -0
- package/src/app/keyboard.ts +161 -0
- package/src/app/modal-keyboard.ts +118 -0
- package/src/app/modal-state.ts +50 -0
- package/src/app/modals-layer.tsx +159 -0
- package/src/app/modals.ts +108 -0
- package/src/app/notifications.ts +21 -0
- package/src/app/opencode.ts +49 -0
- package/src/app/operations.ts +31 -0
- package/src/app/runtime.ts +76 -0
- package/src/app/screen.tsx +217 -0
- package/src/app/state.ts +166 -0
- package/src/app/textarea.ts +16 -0
- package/src/app/view.ts +89 -0
- package/src/app.tsx +7 -1101
- package/src/config/index.ts +36 -42
- package/src/config/listed-sessions.ts +2 -5
- package/src/config/paths.ts +13 -0
- package/src/config/session-rules.ts +10 -11
- package/src/config/store.ts +26 -0
- package/src/handlers/action-helpers.ts +50 -0
- package/src/handlers/actions.ts +34 -65
- package/src/handlers/keyboard/index.ts +5 -0
- package/src/handlers/keyboard/new-session.ts +57 -0
- package/src/handlers/keyboard/normal.ts +201 -0
- package/src/handlers/keyboard/opencode.ts +104 -0
- package/src/handlers/keyboard/search.ts +113 -0
- package/src/handlers/keyboard/shared.ts +116 -0
- package/src/items/order.ts +21 -2
- package/src/opencode/sqlite.ts +21 -6
- package/src/preview/project.ts +41 -15
- package/src/search/index.ts +4 -1
- package/src/settings.ts +294 -297
- package/src/styles/opencode-themes-a.ts +1442 -1
- package/src/styles/opencode-themes-b.ts +1212 -1
- package/src/styles/opencode-tui-colors.ts +1784 -1
- package/src/styles/theme.tsx +2 -1
- package/src/tmux/actions.ts +103 -0
- package/src/tmux/details.ts +123 -0
- package/src/tmux/helpers.ts +35 -0
- package/src/tmux/index.ts +10 -286
- package/src/tmux/list.ts +31 -0
- package/src/tmux/project-discovery.ts +113 -0
- package/src/tmux/project-loader.ts +74 -0
- package/src/tmux/project-zoxide.ts +128 -0
- package/src/tmux/projects.ts +23 -261
- package/src/types/index.ts +0 -1
- package/src/ui/CommandsModal.tsx +87 -22
- package/src/ui/HighlightedText.tsx +1 -5
- package/src/ui/ItemList.tsx +26 -11
- package/src/ui/Modal.tsx +8 -1
- package/src/ui/OpencodeSessionGroup.tsx +20 -9
- package/src/ui/OpencodeStatsPanel.tsx +48 -15
- package/src/ui/RenameModal.tsx +17 -17
- package/src/ui/SearchInput.tsx +1 -20
- package/src/ui/SessionDetailsPanel.tsx +43 -15
- package/src/ui/SessionList.tsx +25 -4
- package/src/ui/SettingEditorModal.tsx +15 -9
- package/src/ui/SettingOptionsModal.tsx +30 -12
- package/src/ui/SettingsModal.tsx +20 -14
- package/src/ui/VersionBadge.tsx +3 -1
- package/src/ui/item-icon.ts +5 -1
- package/src/ui/list-window.ts +5 -1
- package/src/ui/text-columns.ts +17 -0
- package/src/ui/use-textarea-focus.ts +26 -0
- package/src/update/index.ts +10 -2
- package/src/update/installation.ts +6 -2
- package/src/util/ansi.ts +3 -0
- package/src/util/glob.ts +5 -1
- package/src/util/path-display.ts +98 -0
- package/src/components/KeybindHelp.tsx +0 -289
- package/src/handlers/keyboard.ts +0 -654
- package/src/ui/SessionStats.tsx +0 -32
package/src/ui/CommandsModal.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TextareaRenderable } from '@opentui/core'
|
|
2
|
-
import { useEffect } from 'react'
|
|
3
2
|
import { useTheme } from '../styles/theme'
|
|
3
|
+
import { useTextareaFocus } from './use-textarea-focus'
|
|
4
4
|
import { AppMode, type Item, type KeybindMode } from '../types'
|
|
5
5
|
import Modal from './Modal'
|
|
6
6
|
|
|
@@ -46,7 +46,8 @@ export function getCommandEntries(
|
|
|
46
46
|
prefixKey: string | undefined,
|
|
47
47
|
selectedItem?: Item
|
|
48
48
|
): CommandEntry[] {
|
|
49
|
-
const commandKey = (suffix: string, fallback: string) =>
|
|
49
|
+
const commandKey = (suffix: string, fallback: string) =>
|
|
50
|
+
prefixKey ? prefixed(prefixKey, suffix) : fallback
|
|
50
51
|
const prefixCategory = prefixKey ? `Prefix ${prefixKey}` : 'Prefix'
|
|
51
52
|
|
|
52
53
|
if (appMode === AppMode.OpencodeManage) {
|
|
@@ -54,7 +55,12 @@ export function getCommandEntries(
|
|
|
54
55
|
{ id: 'back', category: 'Direct', title: 'Back', keybind: 'esc' },
|
|
55
56
|
{ id: 'kill-session', category: 'Direct', title: 'Kill session', keybind: 'd' },
|
|
56
57
|
{ id: 'open-settings', category: 'Direct', title: 'Open settings', keybind: 'ctrl+p' },
|
|
57
|
-
{
|
|
58
|
+
{
|
|
59
|
+
id: 'rename-session',
|
|
60
|
+
category: prefixCategory,
|
|
61
|
+
title: 'Rename session',
|
|
62
|
+
keybind: commandKey('r', 'r'),
|
|
63
|
+
},
|
|
58
64
|
]
|
|
59
65
|
}
|
|
60
66
|
|
|
@@ -64,15 +70,52 @@ export function getCommandEntries(
|
|
|
64
70
|
{ id: 'open-opencode', category: 'Direct', title: 'Open OpenCode sessions', keybind: 'o' },
|
|
65
71
|
{ id: 'kill-session', category: 'Direct', title: 'Kill session', keybind: 'd' },
|
|
66
72
|
{ id: 'open-settings', category: 'Direct', title: 'Open settings', keybind: 'ctrl+p' },
|
|
67
|
-
{
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
{
|
|
74
|
+
id: 'view-projects',
|
|
75
|
+
category: prefixCategory,
|
|
76
|
+
title: 'Show projects',
|
|
77
|
+
keybind: commandKey('p', 'p'),
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: 'view-sessions',
|
|
81
|
+
category: prefixCategory,
|
|
82
|
+
title: 'Show sessions',
|
|
83
|
+
keybind: commandKey('s', 's'),
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: 'rename-session',
|
|
87
|
+
category: prefixCategory,
|
|
88
|
+
title: 'Rename session',
|
|
89
|
+
keybind: commandKey('r', 'r'),
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: 'last-session',
|
|
93
|
+
category: prefixCategory,
|
|
94
|
+
title: 'Last session',
|
|
95
|
+
keybind: commandKey('l', 'l'),
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: 'root-session',
|
|
99
|
+
category: prefixCategory,
|
|
100
|
+
title: 'Root session',
|
|
101
|
+
keybind: commandKey('g', 'g'),
|
|
102
|
+
},
|
|
72
103
|
...(selectedItem?.itemKind === 'configured'
|
|
73
|
-
? [
|
|
104
|
+
? [
|
|
105
|
+
{
|
|
106
|
+
id: 'edit-target' as const,
|
|
107
|
+
category: prefixCategory,
|
|
108
|
+
title: 'Edit target',
|
|
109
|
+
keybind: commandKey('e', 'e'),
|
|
110
|
+
},
|
|
111
|
+
]
|
|
74
112
|
: []),
|
|
75
|
-
{
|
|
113
|
+
{
|
|
114
|
+
id: 'refresh',
|
|
115
|
+
category: prefixCategory,
|
|
116
|
+
title: 'Refresh',
|
|
117
|
+
keybind: commandKey('shift+r', 'R'),
|
|
118
|
+
},
|
|
76
119
|
]
|
|
77
120
|
}
|
|
78
121
|
|
|
@@ -99,17 +142,31 @@ export default function CommandsModal({
|
|
|
99
142
|
onContentChange,
|
|
100
143
|
}: Props) {
|
|
101
144
|
const theme = useTheme()
|
|
102
|
-
|
|
103
|
-
useEffect(() => {
|
|
104
|
-
queueMicrotask(() => {
|
|
105
|
-
textareaRef.current?.focus()
|
|
106
|
-
})
|
|
107
|
-
}, [textareaRef])
|
|
145
|
+
useTextareaFocus(textareaRef, [])
|
|
108
146
|
|
|
109
147
|
return (
|
|
110
|
-
<Modal
|
|
111
|
-
|
|
112
|
-
|
|
148
|
+
<Modal
|
|
149
|
+
title="Commands"
|
|
150
|
+
description={themeId}
|
|
151
|
+
footer="↑/↓ navigate enter run esc close"
|
|
152
|
+
columns={columns}
|
|
153
|
+
preferredWidth={68}
|
|
154
|
+
>
|
|
155
|
+
<box
|
|
156
|
+
style={{
|
|
157
|
+
backgroundColor: theme.surfaceAlt,
|
|
158
|
+
paddingLeft: 1,
|
|
159
|
+
paddingRight: 1,
|
|
160
|
+
marginBottom: 1,
|
|
161
|
+
}}
|
|
162
|
+
>
|
|
163
|
+
<textarea
|
|
164
|
+
ref={textareaRef}
|
|
165
|
+
initialValue={searchQuery}
|
|
166
|
+
onContentChange={onContentChange}
|
|
167
|
+
focused
|
|
168
|
+
placeholder="Search"
|
|
169
|
+
/>
|
|
113
170
|
</box>
|
|
114
171
|
|
|
115
172
|
<box style={{ flexDirection: 'column' }}>
|
|
@@ -122,7 +179,11 @@ export default function CommandsModal({
|
|
|
122
179
|
|
|
123
180
|
return (
|
|
124
181
|
<box key={`${row.category}:${row.id}`} style={{ flexDirection: 'column' }}>
|
|
125
|
-
{showCategory &&
|
|
182
|
+
{showCategory && (
|
|
183
|
+
<text style={{ fg: theme.accent, marginTop: index === 0 ? 0 : 1 }}>
|
|
184
|
+
{row.category}
|
|
185
|
+
</text>
|
|
186
|
+
)}
|
|
126
187
|
<box
|
|
127
188
|
style={{
|
|
128
189
|
flexDirection: 'row',
|
|
@@ -132,8 +193,12 @@ export default function CommandsModal({
|
|
|
132
193
|
paddingRight: 1,
|
|
133
194
|
}}
|
|
134
195
|
>
|
|
135
|
-
<text style={{ fg: selected ? theme.selectionText : theme.text }}>
|
|
136
|
-
|
|
196
|
+
<text style={{ fg: selected ? theme.selectionText : theme.text }}>
|
|
197
|
+
{row.title}
|
|
198
|
+
</text>
|
|
199
|
+
<text style={{ fg: selected ? theme.selectionText : theme.textMuted }}>
|
|
200
|
+
{row.keybind}
|
|
201
|
+
</text>
|
|
137
202
|
</box>
|
|
138
203
|
</box>
|
|
139
204
|
)
|
|
@@ -10,11 +10,7 @@ interface Props {
|
|
|
10
10
|
* Renders text with highlighted characters at specified indices
|
|
11
11
|
* Used for fuzzy search match visualization (like fzf/telescope)
|
|
12
12
|
*/
|
|
13
|
-
export default function HighlightedText({
|
|
14
|
-
text,
|
|
15
|
-
matchIndices = [],
|
|
16
|
-
highlightColor,
|
|
17
|
-
}: Props) {
|
|
13
|
+
export default function HighlightedText({ text, matchIndices = [], highlightColor }: Props) {
|
|
18
14
|
const theme = useTheme()
|
|
19
15
|
const resolvedHighlightColor = highlightColor ?? theme.action
|
|
20
16
|
|
package/src/ui/ItemList.tsx
CHANGED
|
@@ -48,36 +48,51 @@ export default function ItemList({
|
|
|
48
48
|
style={{
|
|
49
49
|
flexDirection: 'row',
|
|
50
50
|
justifyContent: 'space-between',
|
|
51
|
-
backgroundColor: pendingKill
|
|
51
|
+
backgroundColor: pendingKill
|
|
52
|
+
? theme.dangerSurface
|
|
53
|
+
: selected
|
|
54
|
+
? theme.surfaceAlt
|
|
55
|
+
: 'transparent',
|
|
52
56
|
paddingLeft: 1,
|
|
53
57
|
paddingRight: 1,
|
|
54
58
|
}}
|
|
55
59
|
>
|
|
56
60
|
<text>
|
|
57
|
-
<span style={{ fg: selected ? theme.primary : theme.textSubtle }}>
|
|
61
|
+
<span style={{ fg: selected ? theme.primary : theme.textSubtle }}>
|
|
62
|
+
{selected ? '› ' : ' '}
|
|
63
|
+
</span>
|
|
58
64
|
{item.isSession ? (
|
|
59
65
|
<>
|
|
60
|
-
<span style={{ fg: item.isAttached ? theme.active : theme.inactive }}>
|
|
66
|
+
<span style={{ fg: item.isAttached ? theme.active : theme.inactive }}>
|
|
67
|
+
{item.isAttached ? '●' : '○'}
|
|
68
|
+
</span>{' '}
|
|
61
69
|
{isSearching && hasTitleMatch ? (
|
|
62
70
|
<HighlightedText text={item.title} matchIndices={titleMatchIndices} />
|
|
63
71
|
) : (
|
|
64
72
|
<span style={{ fg: theme.text }}>{item.title}</span>
|
|
65
73
|
)}
|
|
74
|
+
{item.desc ? (
|
|
75
|
+
<span style={{ fg: theme.textSubtle }}>{` ${item.desc}`}</span>
|
|
76
|
+
) : null}
|
|
66
77
|
</>
|
|
67
78
|
) : (
|
|
68
79
|
<>
|
|
69
80
|
<span style={{ fg: icon.color }}>{icon.glyph}</span>{' '}
|
|
70
|
-
{
|
|
71
|
-
isSearching && hasDescMatch ? (
|
|
72
|
-
<HighlightedText text={item.desc} matchIndices={descMatchIndices} />
|
|
73
|
-
) : (
|
|
74
|
-
<span style={{ fg: theme.text }}>{item.desc}</span>
|
|
75
|
-
)
|
|
76
|
-
) : isSearching && hasTitleMatch ? (
|
|
81
|
+
{isSearching && hasTitleMatch ? (
|
|
77
82
|
<HighlightedText text={item.title} matchIndices={titleMatchIndices} />
|
|
78
83
|
) : (
|
|
79
84
|
<span style={{ fg: theme.text }}>{item.title}</span>
|
|
80
85
|
)}
|
|
86
|
+
{item.desc ? (
|
|
87
|
+
<>
|
|
88
|
+
<span style={{ fg: theme.textSubtle }}>{' '}</span>
|
|
89
|
+
{isSearching && hasDescMatch ? (
|
|
90
|
+
<HighlightedText text={item.desc} matchIndices={descMatchIndices} />
|
|
91
|
+
) : (
|
|
92
|
+
<span style={{ fg: theme.textSubtle }}>{item.desc}</span>
|
|
93
|
+
)}
|
|
94
|
+
</>
|
|
95
|
+
) : null}
|
|
81
96
|
</>
|
|
82
97
|
)}
|
|
83
98
|
</text>
|
|
@@ -89,7 +104,7 @@ export default function ItemList({
|
|
|
89
104
|
: `(${item.windowCount})`
|
|
90
105
|
: appMode === AppMode.NewSession
|
|
91
106
|
? `${sessionStatusLabel}${linkedSessionLabel}`
|
|
92
|
-
:
|
|
107
|
+
: ''}
|
|
93
108
|
</text>
|
|
94
109
|
</box>
|
|
95
110
|
)
|
package/src/ui/Modal.tsx
CHANGED
|
@@ -11,7 +11,14 @@ interface Props {
|
|
|
11
11
|
children: ReactNode
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export default function Modal({
|
|
14
|
+
export default function Modal({
|
|
15
|
+
title,
|
|
16
|
+
description,
|
|
17
|
+
footer,
|
|
18
|
+
columns,
|
|
19
|
+
preferredWidth,
|
|
20
|
+
children,
|
|
21
|
+
}: Props) {
|
|
15
22
|
const theme = useTheme()
|
|
16
23
|
|
|
17
24
|
return (
|
|
@@ -12,7 +12,13 @@ interface Props {
|
|
|
12
12
|
pendingKillSessionName?: string | null
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export default function OpencodeSessionGroup({
|
|
15
|
+
export default function OpencodeSessionGroup({
|
|
16
|
+
sessions,
|
|
17
|
+
appMode,
|
|
18
|
+
cursor,
|
|
19
|
+
icons,
|
|
20
|
+
pendingKillSessionName,
|
|
21
|
+
}: Props) {
|
|
16
22
|
const theme = useTheme()
|
|
17
23
|
if (sessions.length === 0) return null
|
|
18
24
|
|
|
@@ -33,18 +39,19 @@ export default function OpencodeSessionGroup({ sessions, appMode, cursor, icons,
|
|
|
33
39
|
style={{
|
|
34
40
|
flexDirection: 'row',
|
|
35
41
|
justifyContent: 'space-between',
|
|
36
|
-
backgroundColor:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
: 'transparent',
|
|
42
|
+
backgroundColor: pendingKill
|
|
43
|
+
? theme.dangerSurface
|
|
44
|
+
: selected
|
|
45
|
+
? theme.surfaceAlt
|
|
46
|
+
: 'transparent',
|
|
42
47
|
paddingLeft: 1,
|
|
43
48
|
paddingRight: 1,
|
|
44
49
|
}}
|
|
45
50
|
>
|
|
46
51
|
<text>
|
|
47
|
-
<span style={{ fg: selected ? theme.primary : theme.textSubtle }}>
|
|
52
|
+
<span style={{ fg: selected ? theme.primary : theme.textSubtle }}>
|
|
53
|
+
{selected ? '› ' : ' '}
|
|
54
|
+
</span>
|
|
48
55
|
<span
|
|
49
56
|
style={{
|
|
50
57
|
fg: item.isAttached ? theme.active : theme.inactive,
|
|
@@ -56,7 +63,11 @@ export default function OpencodeSessionGroup({ sessions, appMode, cursor, icons,
|
|
|
56
63
|
</text>
|
|
57
64
|
|
|
58
65
|
<text style={{ fg: pendingKill ? theme.danger : theme.textSubtle }}>
|
|
59
|
-
{pendingKill
|
|
66
|
+
{pendingKill
|
|
67
|
+
? 'press d again to kill'
|
|
68
|
+
: item.createdAt
|
|
69
|
+
? formatSessionAge(item.createdAt)
|
|
70
|
+
: ''}
|
|
60
71
|
</text>
|
|
61
72
|
</box>
|
|
62
73
|
)
|
|
@@ -32,7 +32,8 @@ export default function OpencodeStatsPanel({ selectedItem }: Props) {
|
|
|
32
32
|
setGlobalStatsState({ status: 'ready', stats })
|
|
33
33
|
}
|
|
34
34
|
} catch (error) {
|
|
35
|
-
const message =
|
|
35
|
+
const message =
|
|
36
|
+
error instanceof Error ? error.message : 'Failed to load global OpenCode stats'
|
|
36
37
|
if (!disposed) {
|
|
37
38
|
setGlobalStatsState({ status: 'error', message })
|
|
38
39
|
}
|
|
@@ -56,7 +57,9 @@ export default function OpencodeStatsPanel({ selectedItem }: Props) {
|
|
|
56
57
|
const lastMessageTokens = sessionStats?.lastMessageTokens ?? 0
|
|
57
58
|
const contextLimit = sessionStats?.contextLimit ?? 200000
|
|
58
59
|
const contextPercentage =
|
|
59
|
-
lastMessageTokens > 0 && contextLimit > 0
|
|
60
|
+
lastMessageTokens > 0 && contextLimit > 0
|
|
61
|
+
? Math.round((lastMessageTokens / contextLimit) * 100)
|
|
62
|
+
: 0
|
|
60
63
|
const sessionCost = sessionStats?.sessionTotalCost ?? 0
|
|
61
64
|
|
|
62
65
|
const panelStyle = {
|
|
@@ -78,7 +81,8 @@ export default function OpencodeStatsPanel({ selectedItem }: Props) {
|
|
|
78
81
|
{sessionState?.status === 'ready' ? (
|
|
79
82
|
<>
|
|
80
83
|
<text>
|
|
81
|
-
Messages:
|
|
84
|
+
Messages:{' '}
|
|
85
|
+
<span style={{ fg: theme.active }}>{sessionState.stats.messageCount ?? 0}</span>
|
|
82
86
|
</text>
|
|
83
87
|
<text>
|
|
84
88
|
Cost: <span style={{ fg: theme.action }}>${sessionCost.toFixed(2)}</span>
|
|
@@ -102,30 +106,50 @@ export default function OpencodeStatsPanel({ selectedItem }: Props) {
|
|
|
102
106
|
{globalStatsState.status === 'ready' ? (
|
|
103
107
|
<>
|
|
104
108
|
<text>
|
|
105
|
-
Sessions:
|
|
109
|
+
Sessions:{' '}
|
|
110
|
+
<span style={{ fg: theme.active }}>
|
|
111
|
+
{globalStatsState.stats.totalSessions ?? 0}
|
|
112
|
+
</span>
|
|
106
113
|
</text>
|
|
107
114
|
<text>
|
|
108
|
-
Messages:
|
|
115
|
+
Messages:{' '}
|
|
116
|
+
<span style={{ fg: theme.active }}>
|
|
117
|
+
{globalStatsState.stats.totalMessages ?? 0}
|
|
118
|
+
</span>
|
|
109
119
|
</text>
|
|
110
120
|
<text>
|
|
111
|
-
Total Cost:
|
|
121
|
+
Total Cost:{' '}
|
|
122
|
+
<span style={{ fg: theme.action }}>
|
|
123
|
+
{globalStatsState.stats.totalCost ?? '$0.00'}
|
|
124
|
+
</span>
|
|
112
125
|
</text>
|
|
113
126
|
<text>
|
|
114
|
-
Cost/Day:
|
|
127
|
+
Cost/Day:{' '}
|
|
128
|
+
<span style={{ fg: theme.text }}>
|
|
129
|
+
{globalStatsState.stats.costPerDay ?? '$0.00'}
|
|
130
|
+
</span>
|
|
115
131
|
</text>
|
|
116
132
|
|
|
117
133
|
<text style={{ fg: theme.key, marginTop: 1, marginBottom: 1 }}>Token Usage</text>
|
|
118
134
|
<text>
|
|
119
|
-
Input:
|
|
135
|
+
Input:{' '}
|
|
136
|
+
<span style={{ fg: theme.text }}>{globalStatsState.stats.inputTokens ?? '0'}</span>
|
|
120
137
|
</text>
|
|
121
138
|
<text>
|
|
122
|
-
Output:
|
|
139
|
+
Output:{' '}
|
|
140
|
+
<span style={{ fg: theme.text }}>{globalStatsState.stats.outputTokens ?? '0'}</span>
|
|
123
141
|
</text>
|
|
124
142
|
<text>
|
|
125
|
-
Cache Read:
|
|
143
|
+
Cache Read:{' '}
|
|
144
|
+
<span style={{ fg: theme.inactive }}>
|
|
145
|
+
{globalStatsState.stats.cacheRead ?? '0'}
|
|
146
|
+
</span>
|
|
126
147
|
</text>
|
|
127
148
|
<text>
|
|
128
|
-
Cache Write:
|
|
149
|
+
Cache Write:{' '}
|
|
150
|
+
<span style={{ fg: theme.inactive }}>
|
|
151
|
+
{globalStatsState.stats.cacheWrite ?? '0'}
|
|
152
|
+
</span>
|
|
129
153
|
</text>
|
|
130
154
|
</>
|
|
131
155
|
) : globalStatsState.status === 'error' ? (
|
|
@@ -149,7 +173,9 @@ export default function OpencodeStatsPanel({ selectedItem }: Props) {
|
|
|
149
173
|
</text>
|
|
150
174
|
)}
|
|
151
175
|
|
|
152
|
-
{sessionStats.directory &&
|
|
176
|
+
{sessionStats.directory && (
|
|
177
|
+
<text style={{ marginBottom: 1, fg: theme.fileTree }}>{sessionStats.directory}</text>
|
|
178
|
+
)}
|
|
153
179
|
|
|
154
180
|
{sessionStats.sessionCount !== undefined && (
|
|
155
181
|
<text>
|
|
@@ -165,7 +191,8 @@ export default function OpencodeStatsPanel({ selectedItem }: Props) {
|
|
|
165
191
|
|
|
166
192
|
{sessionStats.filesModified !== undefined && sessionStats.filesModified > 0 && (
|
|
167
193
|
<text>
|
|
168
|
-
Files Modified:
|
|
194
|
+
Files Modified:{' '}
|
|
195
|
+
<span style={{ fg: theme.action }}>{sessionStats.filesModified}</span>
|
|
169
196
|
</text>
|
|
170
197
|
)}
|
|
171
198
|
|
|
@@ -177,13 +204,19 @@ export default function OpencodeStatsPanel({ selectedItem }: Props) {
|
|
|
177
204
|
|
|
178
205
|
{sessionStats.createdAt && (
|
|
179
206
|
<text style={{ marginTop: 1 }}>
|
|
180
|
-
Created:
|
|
207
|
+
Created:{' '}
|
|
208
|
+
<span style={{ fg: theme.inactive }}>
|
|
209
|
+
{formatSessionAge(sessionStats.createdAt)}
|
|
210
|
+
</span>
|
|
181
211
|
</text>
|
|
182
212
|
)}
|
|
183
213
|
|
|
184
214
|
{sessionStats.updatedAt && (
|
|
185
215
|
<text>
|
|
186
|
-
Updated:
|
|
216
|
+
Updated:{' '}
|
|
217
|
+
<span style={{ fg: theme.inactive }}>
|
|
218
|
+
{formatSessionAge(sessionStats.updatedAt)}
|
|
219
|
+
</span>
|
|
187
220
|
</text>
|
|
188
221
|
)}
|
|
189
222
|
</box>
|
package/src/ui/RenameModal.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TextareaRenderable } from '@opentui/core'
|
|
2
|
-
import { useEffect } from 'react'
|
|
3
2
|
import { useTheme } from '../styles/theme'
|
|
4
3
|
import Modal from './Modal'
|
|
4
|
+
import { useTextareaFocus } from './use-textarea-focus'
|
|
5
5
|
|
|
6
6
|
interface Props {
|
|
7
7
|
target: string
|
|
@@ -11,31 +11,31 @@ interface Props {
|
|
|
11
11
|
onContentChange: () => void
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export default function RenameModal({
|
|
14
|
+
export default function RenameModal({
|
|
15
|
+
target,
|
|
16
|
+
initialValue,
|
|
17
|
+
columns,
|
|
18
|
+
textareaRef,
|
|
19
|
+
onContentChange,
|
|
20
|
+
}: Props) {
|
|
15
21
|
const theme = useTheme()
|
|
16
|
-
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
queueMicrotask(() => {
|
|
19
|
-
const textarea = textareaRef.current
|
|
20
|
-
if (!textarea) {
|
|
21
|
-
return
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
textarea.focus()
|
|
25
|
-
textarea.gotoLineEnd()
|
|
26
|
-
})
|
|
27
|
-
}, [target, textareaRef])
|
|
22
|
+
useTextareaFocus(textareaRef, [target], { gotoLineEnd: true })
|
|
28
23
|
|
|
29
24
|
return (
|
|
30
25
|
<Modal
|
|
31
|
-
title=
|
|
26
|
+
title="Rename Session"
|
|
32
27
|
description={`Update ${target}`}
|
|
33
|
-
footer=
|
|
28
|
+
footer="Enter apply"
|
|
34
29
|
columns={columns}
|
|
35
30
|
preferredWidth={60}
|
|
36
31
|
>
|
|
37
32
|
<box style={{ backgroundColor: theme.surfaceAlt, height: 3 }}>
|
|
38
|
-
<textarea
|
|
33
|
+
<textarea
|
|
34
|
+
ref={textareaRef}
|
|
35
|
+
initialValue={initialValue}
|
|
36
|
+
onContentChange={onContentChange}
|
|
37
|
+
focused
|
|
38
|
+
/>
|
|
39
39
|
</box>
|
|
40
40
|
</Modal>
|
|
41
41
|
)
|
package/src/ui/SearchInput.tsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { TextareaRenderable } from '@opentui/core'
|
|
2
|
-
import { useEffect } from 'react'
|
|
3
2
|
import { useTheme } from '../styles/theme'
|
|
4
3
|
import { AppMode } from '../types'
|
|
5
4
|
|
|
@@ -22,25 +21,7 @@ export default function SearchInput({
|
|
|
22
21
|
const placeholder =
|
|
23
22
|
appMode === AppMode.NewSession
|
|
24
23
|
? 'Type project name, GitHub URL, or custom session name...'
|
|
25
|
-
:
|
|
26
|
-
? 'Enter new session name...'
|
|
27
|
-
: 'Type to search...'
|
|
28
|
-
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
if (appMode !== AppMode.Rename) {
|
|
31
|
-
return
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
queueMicrotask(() => {
|
|
35
|
-
const textarea = textareaRef.current
|
|
36
|
-
if (!textarea) {
|
|
37
|
-
return
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
textarea.focus()
|
|
41
|
-
textarea.gotoLineEnd()
|
|
42
|
-
})
|
|
43
|
-
}, [appMode, textareaRef])
|
|
24
|
+
: 'Type to search...'
|
|
44
25
|
|
|
45
26
|
return (
|
|
46
27
|
<box
|
|
@@ -52,29 +52,40 @@ function ProjectPreviewView({ preview }: { preview: ProjectPreview }) {
|
|
|
52
52
|
<text style={{ fg: theme.fileTree, marginTop: 1 }}>{preview.path}</text>
|
|
53
53
|
|
|
54
54
|
<box style={{ flexDirection: 'column', marginTop: 1 }}>
|
|
55
|
-
<MetaRow label=
|
|
56
|
-
{preview.gitBranch &&
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
<MetaRow label="Source" value={formatSourceLabel(preview.source)} color={theme.action} />
|
|
56
|
+
{preview.gitBranch && (
|
|
57
|
+
<MetaRow label="Branch" value={preview.gitBranch} color={theme.active} />
|
|
58
|
+
)}
|
|
59
|
+
{preview.startupCommand && (
|
|
60
|
+
<MetaRow label="Startup" value={preview.startupCommand} color={theme.program} />
|
|
61
|
+
)}
|
|
62
|
+
{preview.previewCommand && (
|
|
63
|
+
<MetaRow label="Preview" value={preview.previewCommand} color={theme.action} />
|
|
64
|
+
)}
|
|
59
65
|
</box>
|
|
60
66
|
|
|
61
67
|
{preview.linkedSession && (
|
|
62
68
|
<box style={{ flexDirection: 'column', marginTop: 1 }}>
|
|
63
69
|
<SectionLabel>Live session</SectionLabel>
|
|
64
70
|
<MetaRow
|
|
65
|
-
label=
|
|
71
|
+
label="Status"
|
|
66
72
|
value={preview.linkedSession.isAttached ? 'attached' : 'detached'}
|
|
67
73
|
color={preview.linkedSession.isAttached ? theme.active : theme.textMuted}
|
|
68
74
|
/>
|
|
69
|
-
<MetaRow label=
|
|
75
|
+
<MetaRow label="Windows" value={String(preview.linkedSession.windowCount)} />
|
|
70
76
|
</box>
|
|
71
77
|
)}
|
|
72
78
|
|
|
73
79
|
<SectionLabel>{preview.previewLabel}</SectionLabel>
|
|
74
|
-
{preview.previewNotice &&
|
|
80
|
+
{preview.previewNotice && (
|
|
81
|
+
<text style={{ fg: theme.textSubtle, marginTop: 1 }}>{preview.previewNotice}</text>
|
|
82
|
+
)}
|
|
75
83
|
<box style={{ flexDirection: 'column', marginTop: 1 }}>
|
|
76
84
|
{preview.previewLines.slice(0, 12).map((line, index) => (
|
|
77
|
-
<text
|
|
85
|
+
<text
|
|
86
|
+
key={`${preview.previewKind}:${index}:${line}`}
|
|
87
|
+
style={{ fg: line.endsWith('/') ? theme.fileTree : theme.textMuted }}
|
|
88
|
+
>
|
|
78
89
|
{line}
|
|
79
90
|
</text>
|
|
80
91
|
))}
|
|
@@ -91,8 +102,12 @@ function SessionDetailsView({ details }: { details: SessionDetails }) {
|
|
|
91
102
|
<text style={{ fg: theme.secondary }}>{details.name}</text>
|
|
92
103
|
|
|
93
104
|
<box style={{ flexDirection: 'column', marginTop: 1 }}>
|
|
94
|
-
<MetaRow
|
|
95
|
-
|
|
105
|
+
<MetaRow
|
|
106
|
+
label="Status"
|
|
107
|
+
value={details.isAttached ? 'active' : 'inactive'}
|
|
108
|
+
color={details.isAttached ? theme.active : theme.textMuted}
|
|
109
|
+
/>
|
|
110
|
+
<MetaRow label="Windows" value={String(details.windowCount)} />
|
|
96
111
|
</box>
|
|
97
112
|
|
|
98
113
|
<SectionLabel>Windows</SectionLabel>
|
|
@@ -101,10 +116,17 @@ function SessionDetailsView({ details }: { details: SessionDetails }) {
|
|
|
101
116
|
<text style={{ fg: theme.textMuted }}>No windows found</text>
|
|
102
117
|
) : (
|
|
103
118
|
details.windows.map(win => (
|
|
104
|
-
<box
|
|
105
|
-
|
|
119
|
+
<box
|
|
120
|
+
key={`${win.index}:${win.name}`}
|
|
121
|
+
style={{ flexDirection: 'column', marginBottom: 1 }}
|
|
122
|
+
>
|
|
123
|
+
<text style={{ fg: theme.text }}>
|
|
124
|
+
{win.index}: {win.name}
|
|
125
|
+
</text>
|
|
106
126
|
{win.currentPath && <text style={{ fg: theme.fileTree }}>{win.currentPath}</text>}
|
|
107
|
-
{win.currentCommand &&
|
|
127
|
+
{win.currentCommand && (
|
|
128
|
+
<text style={{ fg: theme.textSubtle }}>{win.currentCommand}</text>
|
|
129
|
+
)}
|
|
108
130
|
</box>
|
|
109
131
|
))
|
|
110
132
|
)}
|
|
@@ -157,7 +179,11 @@ export default function SessionDetailsPanel({ selectedItem, config }: Props) {
|
|
|
157
179
|
return
|
|
158
180
|
}
|
|
159
181
|
|
|
160
|
-
const details = await getProjectPreview(
|
|
182
|
+
const details = await getProjectPreview(
|
|
183
|
+
selectedItem.path,
|
|
184
|
+
config,
|
|
185
|
+
selectedItem.linkedSessionName
|
|
186
|
+
)
|
|
161
187
|
if (!cancelled) {
|
|
162
188
|
setDetailState({ status: 'project', details })
|
|
163
189
|
}
|
|
@@ -188,7 +214,9 @@ export default function SessionDetailsPanel({ selectedItem, config }: Props) {
|
|
|
188
214
|
{detailState.status === 'idle' ? (
|
|
189
215
|
<>
|
|
190
216
|
<text style={{ fg: theme.textMuted }}>Nothing selected</text>
|
|
191
|
-
<text style={{ fg: theme.textSubtle, marginTop: 1 }}>
|
|
217
|
+
<text style={{ fg: theme.textSubtle, marginTop: 1 }}>
|
|
218
|
+
Pick a session or project to see details.
|
|
219
|
+
</text>
|
|
192
220
|
</>
|
|
193
221
|
) : detailState.status === 'loading' ? (
|
|
194
222
|
<>
|