mux-sesh 1.10.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +133 -86
- package/bin/mux-sesh +45 -17
- package/bin/platform.sh +139 -0
- package/bin/postinstall +22 -0
- package/package.json +27 -38
- package/src/agents/index.ts +0 -1
- package/src/agents/session-name.ts +0 -24
- package/src/app/commands.ts +0 -138
- package/src/app/controller.ts +0 -437
- package/src/app/controls.ts +0 -123
- package/src/app/core-state.ts +0 -75
- package/src/app/data.ts +0 -130
- package/src/app/derived.ts +0 -77
- package/src/app/effects.ts +0 -650
- package/src/app/handlers.ts +0 -406
- package/src/app/keyboard.ts +0 -165
- package/src/app/modal-keyboard.ts +0 -137
- package/src/app/modal-state.ts +0 -53
- package/src/app/modals-layer.tsx +0 -159
- package/src/app/modals.ts +0 -108
- package/src/app/notifications.ts +0 -21
- package/src/app/opencode.ts +0 -49
- package/src/app/operations.ts +0 -31
- package/src/app/runtime.ts +0 -79
- package/src/app/screen.tsx +0 -240
- package/src/app/state.ts +0 -178
- package/src/app/textarea.ts +0 -16
- package/src/app/view.ts +0 -101
- package/src/app.tsx +0 -50
- package/src/config/index.ts +0 -475
- package/src/config/listed-sessions.ts +0 -33
- package/src/config/paths.ts +0 -13
- package/src/config/session-rules.ts +0 -100
- package/src/config/store.ts +0 -33
- package/src/files/target.ts +0 -96
- package/src/handlers/action-helpers.ts +0 -83
- package/src/handlers/actions.ts +0 -216
- package/src/handlers/keyboard/agents.ts +0 -134
- package/src/handlers/keyboard/index.ts +0 -5
- package/src/handlers/keyboard/new-session.ts +0 -58
- package/src/handlers/keyboard/normal.ts +0 -220
- package/src/handlers/keyboard/search.ts +0 -118
- package/src/handlers/keyboard/shared.ts +0 -117
- package/src/herdr/backend.ts +0 -357
- package/src/herdr/protocol.ts +0 -268
- package/src/index.tsx +0 -23
- package/src/items/order.ts +0 -95
- package/src/multiplexer/backend.ts +0 -43
- package/src/multiplexer/command.ts +0 -48
- package/src/multiplexer/index.ts +0 -21
- package/src/multiplexer/items.ts +0 -66
- package/src/multiplexer/resolve.ts +0 -109
- package/src/multiplexer/tmux-backend.ts +0 -87
- package/src/multiplexer/types.ts +0 -93
- package/src/opencode/constants.ts +0 -7
- package/src/opencode/index.ts +0 -20
- package/src/opencode/parser.ts +0 -45
- package/src/opencode/session-name.ts +0 -13
- package/src/opencode/session.ts +0 -146
- package/src/opencode/sqlite.ts +0 -447
- package/src/opencode/stats.ts +0 -26
- package/src/opencode/tokens.ts +0 -116
- package/src/opencode/types.ts +0 -33
- package/src/preview/project.ts +0 -362
- package/src/projects/session-links.ts +0 -52
- package/src/search/fff.ts +0 -224
- package/src/search/index.ts +0 -198
- package/src/settings.ts +0 -465
- package/src/styles/omarchy.ts +0 -295
- package/src/styles/opencode-themes-a.ts +0 -1442
- package/src/styles/opencode-themes-b.ts +0 -1212
- package/src/styles/opencode-tui-colors.ts +0 -1784
- package/src/styles/terminal-palette.ts +0 -156
- package/src/styles/theme-follow.ts +0 -94
- package/src/styles/theme.tsx +0 -311
- package/src/tmux/actions.ts +0 -145
- package/src/tmux/details.ts +0 -104
- package/src/tmux/helpers.ts +0 -35
- package/src/tmux/index.ts +0 -10
- package/src/tmux/list.ts +0 -31
- package/src/tmux/project-discovery.ts +0 -116
- package/src/tmux/project-loader.ts +0 -92
- package/src/tmux/project-zoxide.ts +0 -128
- package/src/tmux/projects.ts +0 -38
- package/src/tmux/workflows.ts +0 -26
- package/src/types/index.ts +0 -221
- package/src/ui/AgentSessionGroup.tsx +0 -93
- package/src/ui/CommandsModal.tsx +0 -246
- package/src/ui/ErrorScreen.tsx +0 -102
- package/src/ui/HighlightedText.tsx +0 -60
- package/src/ui/ItemList.tsx +0 -119
- package/src/ui/Modal.tsx +0 -48
- package/src/ui/OpencodeStatsPanel.tsx +0 -233
- package/src/ui/RenameModal.tsx +0 -42
- package/src/ui/SearchInput.tsx +0 -43
- package/src/ui/SessionDetailsPanel.tsx +0 -273
- package/src/ui/SessionList.tsx +0 -119
- package/src/ui/SettingEditorModal.tsx +0 -55
- package/src/ui/SettingOptionsModal.tsx +0 -95
- package/src/ui/SettingsModal.tsx +0 -102
- package/src/ui/Toast.tsx +0 -34
- package/src/ui/VersionBadge.tsx +0 -45
- package/src/ui/item-icon.ts +0 -110
- package/src/ui/list-window.ts +0 -35
- package/src/ui/session-meta.ts +0 -10
- package/src/ui/text-columns.ts +0 -17
- package/src/ui/use-textarea-focus.ts +0 -29
- package/src/update/events.ts +0 -28
- package/src/update/index.ts +0 -91
- package/src/update/installation.ts +0 -161
- package/src/update/version.ts +0 -33
- package/src/util/ansi.ts +0 -3
- package/src/util/browser.ts +0 -37
- package/src/util/clipboard.ts +0 -22
- package/src/util/errors.ts +0 -170
- package/src/util/github.ts +0 -100
- package/src/util/glob.ts +0 -51
- package/src/util/path-display.ts +0 -98
- package/src/util/perf.ts +0 -23
- package/src/util/shell.ts +0 -3
- package/src/util/shutdown.ts +0 -111
- package/src/util/terminal.ts +0 -28
- package/src/util/time.ts +0 -48
- package/tsconfig.json +0 -25
package/src/types/index.ts
DELETED
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
import type { OpencodeStats } from '../opencode/types'
|
|
2
|
-
import type { AgentStatus, BackendKind, BackendPreference, HerdrAgentTarget } from '../multiplexer'
|
|
3
|
-
|
|
4
|
-
export type { AgentStatus, BackendKind, BackendPreference } from '../multiplexer'
|
|
5
|
-
|
|
6
|
-
export enum AppMode {
|
|
7
|
-
Normal,
|
|
8
|
-
Search,
|
|
9
|
-
NewSession,
|
|
10
|
-
AgentsManage,
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export enum ViewMode {
|
|
14
|
-
Sessions,
|
|
15
|
-
Projects,
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export type KeybindMode = 'vim' | 'standard'
|
|
19
|
-
export type ZoxideMode = 'off' | 'rank' | 'merge'
|
|
20
|
-
export type ItemKind = BackendKind | 'configured' | 'project' | 'file'
|
|
21
|
-
export type SortOrder = 'live-first' | 'configured-first' | 'zoxide-first' | 'alphabetical'
|
|
22
|
-
|
|
23
|
-
export interface IconConfig {
|
|
24
|
-
tmux: string
|
|
25
|
-
herdr: string
|
|
26
|
-
configured: string
|
|
27
|
-
project: string
|
|
28
|
-
opencode: string
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export type ThemeColorScheme = 'light' | 'dark' | 'system'
|
|
32
|
-
|
|
33
|
-
export interface ThemePalette {
|
|
34
|
-
neutral: string
|
|
35
|
-
ink: string
|
|
36
|
-
primary: string
|
|
37
|
-
success: string
|
|
38
|
-
warning: string
|
|
39
|
-
error: string
|
|
40
|
-
info: string
|
|
41
|
-
accent?: string
|
|
42
|
-
interactive?: string
|
|
43
|
-
diffAdd?: string
|
|
44
|
-
diffDelete?: string
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface ThemeVariant {
|
|
48
|
-
palette: ThemePalette
|
|
49
|
-
overrides?: Record<string, string>
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export interface DesktopTheme {
|
|
53
|
-
name: string
|
|
54
|
-
id: string
|
|
55
|
-
light: ThemeVariant
|
|
56
|
-
dark: ThemeVariant
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export interface ThemeColors {
|
|
60
|
-
background: string
|
|
61
|
-
surface: string
|
|
62
|
-
surfaceAlt: string
|
|
63
|
-
surfaceModal: string
|
|
64
|
-
overlay: string
|
|
65
|
-
border: string
|
|
66
|
-
borderMuted: string
|
|
67
|
-
text: string
|
|
68
|
-
textMuted: string
|
|
69
|
-
textSubtle: string
|
|
70
|
-
primary: string
|
|
71
|
-
secondary: string
|
|
72
|
-
accent: string
|
|
73
|
-
active: string
|
|
74
|
-
inactive: string
|
|
75
|
-
key: string
|
|
76
|
-
action: string
|
|
77
|
-
separator: string
|
|
78
|
-
program: string
|
|
79
|
-
fileTree: string
|
|
80
|
-
danger: string
|
|
81
|
-
dangerSurface: string
|
|
82
|
-
selection: string
|
|
83
|
-
selectionText: string
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export interface ThemeDefinition {
|
|
87
|
-
name?: string
|
|
88
|
-
light: ThemeVariant
|
|
89
|
-
dark: ThemeVariant
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export interface SessionDefaults {
|
|
93
|
-
startupCommand?: string
|
|
94
|
-
previewCommand?: string
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export interface ProjectProfile {
|
|
98
|
-
path: string
|
|
99
|
-
sessionName?: string
|
|
100
|
-
startupCommand?: string
|
|
101
|
-
previewCommand?: string
|
|
102
|
-
listed?: boolean
|
|
103
|
-
icon?: string
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export interface ProjectWildcard {
|
|
107
|
-
pattern: string
|
|
108
|
-
sessionName?: string
|
|
109
|
-
startupCommand?: string
|
|
110
|
-
previewCommand?: string
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export type OpencodeSessionStats = OpencodeStats
|
|
114
|
-
|
|
115
|
-
export type OpencodeStatsState =
|
|
116
|
-
| { status: 'loading' }
|
|
117
|
-
| { status: 'ready'; stats: OpencodeSessionStats }
|
|
118
|
-
| { status: 'missing'; message: string }
|
|
119
|
-
| { status: 'error'; message: string }
|
|
120
|
-
|
|
121
|
-
export interface SearchMatchMetadata {
|
|
122
|
-
titleIndices?: number[]
|
|
123
|
-
descIndices?: number[]
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export interface Item {
|
|
127
|
-
title: string
|
|
128
|
-
desc: string
|
|
129
|
-
path: string
|
|
130
|
-
isSession: boolean
|
|
131
|
-
itemKind?: ItemKind
|
|
132
|
-
sessionId?: string
|
|
133
|
-
backend?: BackendKind
|
|
134
|
-
target?: HerdrAgentTarget
|
|
135
|
-
workspaceTitle?: string
|
|
136
|
-
agentStatus?: AgentStatus
|
|
137
|
-
icon?: string
|
|
138
|
-
isPinned?: boolean
|
|
139
|
-
isAttached?: boolean
|
|
140
|
-
linkedSessionName?: string
|
|
141
|
-
linkedSessionId?: string
|
|
142
|
-
linkedSessionBackend?: BackendKind
|
|
143
|
-
linkedSessionAttached?: boolean
|
|
144
|
-
windowCount?: string
|
|
145
|
-
createdAt?: number
|
|
146
|
-
lastActivity?: number
|
|
147
|
-
opencodeState?: OpencodeStatsState
|
|
148
|
-
searchMatch?: SearchMatchMetadata
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export interface Config {
|
|
152
|
-
backend?: BackendPreference
|
|
153
|
-
projectPaths: string[]
|
|
154
|
-
reposPath: string
|
|
155
|
-
editor: string
|
|
156
|
-
editorCmd: string
|
|
157
|
-
keybindMode?: KeybindMode
|
|
158
|
-
prefixKey?: string
|
|
159
|
-
autoUpdate?: boolean
|
|
160
|
-
dirLength?: number
|
|
161
|
-
hiddenSessions?: string[]
|
|
162
|
-
pinnedSessions?: string[]
|
|
163
|
-
zoxideMode?: ZoxideMode
|
|
164
|
-
sortOrder?: SortOrder
|
|
165
|
-
theme?: string
|
|
166
|
-
colorScheme?: ThemeColorScheme
|
|
167
|
-
themes?: Record<string, ThemeDefinition>
|
|
168
|
-
icons?: IconConfig
|
|
169
|
-
defaultSession?: SessionDefaults
|
|
170
|
-
projects?: ProjectProfile[]
|
|
171
|
-
wildcards?: ProjectWildcard[]
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
export interface WindowInfo {
|
|
175
|
-
index: string
|
|
176
|
-
name: string
|
|
177
|
-
currentPath: string
|
|
178
|
-
currentCommand: string
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
export interface SessionDetails {
|
|
182
|
-
name: string
|
|
183
|
-
isAttached: boolean
|
|
184
|
-
windowCount: string
|
|
185
|
-
windows: WindowInfo[]
|
|
186
|
-
panePreviewLines?: string[]
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
export interface SearchResult {
|
|
190
|
-
item: Item
|
|
191
|
-
score: number
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
export interface FuzzyMatch {
|
|
195
|
-
score: number
|
|
196
|
-
indices: number[]
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
export type InstallMethod = 'npm' | 'bun' | 'brew' | 'source' | 'unknown'
|
|
200
|
-
|
|
201
|
-
export type UpdateEvent =
|
|
202
|
-
| {
|
|
203
|
-
kind: 'updated'
|
|
204
|
-
currentVersion: string
|
|
205
|
-
version: string
|
|
206
|
-
installMethod: InstallMethod
|
|
207
|
-
}
|
|
208
|
-
| {
|
|
209
|
-
kind: 'available'
|
|
210
|
-
currentVersion: string
|
|
211
|
-
version: string
|
|
212
|
-
installMethod: InstallMethod
|
|
213
|
-
}
|
|
214
|
-
| {
|
|
215
|
-
kind: 'failed'
|
|
216
|
-
currentVersion: string
|
|
217
|
-
version: string
|
|
218
|
-
installMethod: InstallMethod
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
export type UpdateEventListener = (event: UpdateEvent) => void
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { useTheme } from '../styles/theme'
|
|
2
|
-
import type { IconConfig, Item, AppMode } from '../types'
|
|
3
|
-
import { AppMode as AppModeEnum } from '../types'
|
|
4
|
-
import { formatSectionHeader } from './item-icon'
|
|
5
|
-
import { getItemKey } from '../multiplexer/items'
|
|
6
|
-
import { getSessionMeta } from './session-meta'
|
|
7
|
-
import { getVisibleWindow } from './list-window'
|
|
8
|
-
|
|
9
|
-
interface Props {
|
|
10
|
-
sessions: Item[]
|
|
11
|
-
appMode: AppMode
|
|
12
|
-
cursor: number
|
|
13
|
-
maxItems?: number
|
|
14
|
-
icons?: IconConfig
|
|
15
|
-
pendingKillSessionName?: string | null
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default function AgentSessionGroup({
|
|
19
|
-
sessions,
|
|
20
|
-
appMode,
|
|
21
|
-
cursor,
|
|
22
|
-
maxItems = 20,
|
|
23
|
-
icons,
|
|
24
|
-
pendingKillSessionName,
|
|
25
|
-
}: Props) {
|
|
26
|
-
const theme = useTheme()
|
|
27
|
-
if (sessions.length === 0) return null
|
|
28
|
-
|
|
29
|
-
const header = formatSectionHeader(theme, 'agents', icons)
|
|
30
|
-
const visibleWindow = getVisibleWindow(sessions, cursor, maxItems)
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<>
|
|
34
|
-
<text style={{ fg: theme.textSubtle, marginTop: 2, marginBottom: 1 }}>
|
|
35
|
-
<span style={{ fg: header.color }}>{header.text}</span>
|
|
36
|
-
</text>
|
|
37
|
-
{visibleWindow.items.map((item, i) => {
|
|
38
|
-
const absoluteIndex = visibleWindow.startIndex + i
|
|
39
|
-
const pendingKill = getItemKey(item) === pendingKillSessionName
|
|
40
|
-
const selected = appMode === AppModeEnum.AgentsManage && absoluteIndex === cursor
|
|
41
|
-
const itemMeta = getSessionMeta(item)
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<box
|
|
45
|
-
key={getItemKey(item)}
|
|
46
|
-
style={{
|
|
47
|
-
flexDirection: 'row',
|
|
48
|
-
justifyContent: 'space-between',
|
|
49
|
-
backgroundColor: pendingKill
|
|
50
|
-
? theme.dangerSurface
|
|
51
|
-
: selected
|
|
52
|
-
? theme.surfaceAlt
|
|
53
|
-
: 'transparent',
|
|
54
|
-
paddingLeft: 1,
|
|
55
|
-
paddingRight: 1,
|
|
56
|
-
}}
|
|
57
|
-
>
|
|
58
|
-
<text>
|
|
59
|
-
<span style={{ fg: selected ? theme.primary : theme.textSubtle }}>
|
|
60
|
-
{selected ? '› ' : ' '}
|
|
61
|
-
</span>
|
|
62
|
-
<span
|
|
63
|
-
style={{
|
|
64
|
-
fg: item.isAttached ? theme.active : theme.inactive,
|
|
65
|
-
}}
|
|
66
|
-
>
|
|
67
|
-
{item.isAttached ? '●' : '○'}
|
|
68
|
-
</span>{' '}
|
|
69
|
-
<span style={{ fg: theme.text }}>{item.title}</span>
|
|
70
|
-
</text>
|
|
71
|
-
|
|
72
|
-
<text
|
|
73
|
-
style={{
|
|
74
|
-
fg: pendingKill
|
|
75
|
-
? theme.danger
|
|
76
|
-
: item.agentStatus === 'blocked'
|
|
77
|
-
? theme.danger
|
|
78
|
-
: item.agentStatus === 'working'
|
|
79
|
-
? theme.active
|
|
80
|
-
: theme.textSubtle,
|
|
81
|
-
}}
|
|
82
|
-
>
|
|
83
|
-
{pendingKill
|
|
84
|
-
? `press d again to ${item.itemKind === 'herdr' ? 'close' : 'kill'}`
|
|
85
|
-
: itemMeta}
|
|
86
|
-
</text>
|
|
87
|
-
</box>
|
|
88
|
-
)
|
|
89
|
-
})}
|
|
90
|
-
<box style={{ marginBottom: 1 }} />
|
|
91
|
-
</>
|
|
92
|
-
)
|
|
93
|
-
}
|
package/src/ui/CommandsModal.tsx
DELETED
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
import type { TextareaRenderable } from '@opentui/core'
|
|
2
|
-
import { isHerdrAgentItem } from '../multiplexer/items'
|
|
3
|
-
import { useTheme } from '../styles/theme'
|
|
4
|
-
import { useTextareaFocus } from './use-textarea-focus'
|
|
5
|
-
import { AppMode, type Item, type KeybindMode } from '../types'
|
|
6
|
-
import Modal from './Modal'
|
|
7
|
-
|
|
8
|
-
export type CommandId =
|
|
9
|
-
| 'search'
|
|
10
|
-
| 'new-session'
|
|
11
|
-
| 'open-settings'
|
|
12
|
-
| 'open-themes'
|
|
13
|
-
| 'view-projects'
|
|
14
|
-
| 'view-sessions'
|
|
15
|
-
| 'rename-session'
|
|
16
|
-
| 'kill-session'
|
|
17
|
-
| 'toggle-pin-session'
|
|
18
|
-
| 'last-session'
|
|
19
|
-
| 'root-session'
|
|
20
|
-
| 'edit-target'
|
|
21
|
-
| 'open-agents'
|
|
22
|
-
| 'refresh'
|
|
23
|
-
| 'back'
|
|
24
|
-
|
|
25
|
-
export interface CommandEntry {
|
|
26
|
-
id: CommandId
|
|
27
|
-
category: string
|
|
28
|
-
title: string
|
|
29
|
-
keybind: string
|
|
30
|
-
keywords?: string
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
interface Props {
|
|
34
|
-
columns: number
|
|
35
|
-
themeId: string
|
|
36
|
-
entries: CommandEntry[]
|
|
37
|
-
cursor: number
|
|
38
|
-
searchQuery: string
|
|
39
|
-
textareaRef: { current: TextareaRenderable | null }
|
|
40
|
-
onContentChange: () => void
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function prefixed(prefixKey: string | undefined, suffix: string): string {
|
|
44
|
-
return `${prefixKey ?? 'ctrl+x'} ${suffix}`
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function getCommandEntries(
|
|
48
|
-
appMode: AppMode,
|
|
49
|
-
keybindMode: KeybindMode = 'vim',
|
|
50
|
-
prefixKey: string | undefined,
|
|
51
|
-
selectedItem?: Item
|
|
52
|
-
): CommandEntry[] {
|
|
53
|
-
const commandKey = (suffix: string, fallback: string) =>
|
|
54
|
-
prefixKey ? prefixed(prefixKey, suffix) : fallback
|
|
55
|
-
const prefixCategory = prefixKey ? `Prefix ${prefixKey}` : 'Prefix'
|
|
56
|
-
|
|
57
|
-
if (appMode === AppMode.AgentsManage) {
|
|
58
|
-
const canManageSession = !isHerdrAgentItem(selectedItem)
|
|
59
|
-
return [
|
|
60
|
-
{ id: 'back', category: 'Direct', title: 'Back', keybind: 'esc' },
|
|
61
|
-
...(canManageSession
|
|
62
|
-
? [{ id: 'kill-session' as const, category: 'Direct', title: 'Kill session', keybind: 'd' }]
|
|
63
|
-
: []),
|
|
64
|
-
{ id: 'open-settings', category: 'Direct', title: 'Settings', keybind: 'ctrl+p' },
|
|
65
|
-
{
|
|
66
|
-
id: 'open-themes',
|
|
67
|
-
category: 'Direct',
|
|
68
|
-
title: 'Themes',
|
|
69
|
-
keybind: 'ctrl+p',
|
|
70
|
-
keywords: 'theme color scheme appearance',
|
|
71
|
-
},
|
|
72
|
-
...(canManageSession
|
|
73
|
-
? [
|
|
74
|
-
{
|
|
75
|
-
id: 'rename-session' as const,
|
|
76
|
-
category: prefixCategory,
|
|
77
|
-
title: 'Rename session',
|
|
78
|
-
keybind: commandKey('r', 'r'),
|
|
79
|
-
},
|
|
80
|
-
]
|
|
81
|
-
: []),
|
|
82
|
-
]
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return [
|
|
86
|
-
{ id: 'search', category: 'Direct', title: 'Search', keybind: 'i' },
|
|
87
|
-
{ id: 'new-session', category: 'Direct', title: 'New session', keybind: 'n' },
|
|
88
|
-
{ id: 'open-agents', category: 'Direct', title: 'Open agent sessions', keybind: 'o' },
|
|
89
|
-
{ id: 'kill-session', category: 'Direct', title: 'Kill session', keybind: 'd' },
|
|
90
|
-
...(selectedItem && (selectedItem.isSession || selectedItem.itemKind === 'configured')
|
|
91
|
-
? [
|
|
92
|
-
{
|
|
93
|
-
id: 'toggle-pin-session' as const,
|
|
94
|
-
category: 'Direct',
|
|
95
|
-
title: selectedItem.isPinned ? 'Unpin session' : 'Pin session',
|
|
96
|
-
keybind: 'ctrl+f',
|
|
97
|
-
},
|
|
98
|
-
]
|
|
99
|
-
: []),
|
|
100
|
-
{ id: 'open-settings', category: 'Direct', title: 'Open settings', keybind: 'ctrl+p' },
|
|
101
|
-
{
|
|
102
|
-
id: 'open-themes',
|
|
103
|
-
category: 'Direct',
|
|
104
|
-
title: 'Themes',
|
|
105
|
-
keybind: 'ctrl+p',
|
|
106
|
-
keywords: 'theme color scheme appearance',
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
id: 'view-projects',
|
|
110
|
-
category: prefixCategory,
|
|
111
|
-
title: 'Show projects',
|
|
112
|
-
keybind: commandKey('p', 'p'),
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
id: 'view-sessions',
|
|
116
|
-
category: prefixCategory,
|
|
117
|
-
title: 'Show sessions',
|
|
118
|
-
keybind: commandKey('s', 's'),
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
id: 'rename-session',
|
|
122
|
-
category: prefixCategory,
|
|
123
|
-
title: 'Rename session',
|
|
124
|
-
keybind: commandKey('r', 'r'),
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
id: 'last-session',
|
|
128
|
-
category: prefixCategory,
|
|
129
|
-
title: 'Last session',
|
|
130
|
-
keybind: commandKey('l', 'l'),
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
id: 'root-session',
|
|
134
|
-
category: prefixCategory,
|
|
135
|
-
title: 'Root session',
|
|
136
|
-
keybind: commandKey('g', 'g'),
|
|
137
|
-
},
|
|
138
|
-
...(selectedItem?.itemKind === 'configured'
|
|
139
|
-
? [
|
|
140
|
-
{
|
|
141
|
-
id: 'edit-target' as const,
|
|
142
|
-
category: prefixCategory,
|
|
143
|
-
title: 'Edit target',
|
|
144
|
-
keybind: commandKey('e', 'e'),
|
|
145
|
-
},
|
|
146
|
-
]
|
|
147
|
-
: []),
|
|
148
|
-
{
|
|
149
|
-
id: 'refresh',
|
|
150
|
-
category: prefixCategory,
|
|
151
|
-
title: 'Refresh',
|
|
152
|
-
keybind: commandKey('shift+r', 'R'),
|
|
153
|
-
},
|
|
154
|
-
]
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
export function filterCommandEntries(entries: CommandEntry[], query: string): CommandEntry[] {
|
|
158
|
-
const normalizedQuery = query.trim().toLowerCase()
|
|
159
|
-
|
|
160
|
-
if (!normalizedQuery) {
|
|
161
|
-
return entries
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
return entries.filter(entry => {
|
|
165
|
-
const haystack =
|
|
166
|
-
`${entry.category} ${entry.title} ${entry.keybind} ${entry.keywords ?? ''}`.toLowerCase()
|
|
167
|
-
return haystack.includes(normalizedQuery)
|
|
168
|
-
})
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
export default function CommandsModal({
|
|
172
|
-
columns,
|
|
173
|
-
themeId,
|
|
174
|
-
entries,
|
|
175
|
-
cursor,
|
|
176
|
-
searchQuery,
|
|
177
|
-
textareaRef,
|
|
178
|
-
onContentChange,
|
|
179
|
-
}: Props) {
|
|
180
|
-
const theme = useTheme()
|
|
181
|
-
useTextareaFocus(textareaRef, [])
|
|
182
|
-
|
|
183
|
-
return (
|
|
184
|
-
<Modal
|
|
185
|
-
title="Commands"
|
|
186
|
-
description={themeId}
|
|
187
|
-
footer="↑/↓ navigate enter run esc close"
|
|
188
|
-
columns={columns}
|
|
189
|
-
preferredWidth={68}
|
|
190
|
-
>
|
|
191
|
-
<box
|
|
192
|
-
style={{
|
|
193
|
-
backgroundColor: theme.surfaceAlt,
|
|
194
|
-
paddingLeft: 1,
|
|
195
|
-
paddingRight: 1,
|
|
196
|
-
marginBottom: 1,
|
|
197
|
-
}}
|
|
198
|
-
>
|
|
199
|
-
<textarea
|
|
200
|
-
ref={textareaRef}
|
|
201
|
-
initialValue={searchQuery}
|
|
202
|
-
onContentChange={onContentChange}
|
|
203
|
-
focused
|
|
204
|
-
placeholder="Search"
|
|
205
|
-
/>
|
|
206
|
-
</box>
|
|
207
|
-
|
|
208
|
-
<box style={{ flexDirection: 'column' }}>
|
|
209
|
-
{entries.length === 0 ? (
|
|
210
|
-
<text style={{ fg: theme.textMuted }}>No commands found</text>
|
|
211
|
-
) : (
|
|
212
|
-
entries.map((row, index) => {
|
|
213
|
-
const showCategory = index === 0 || entries[index - 1]?.category !== row.category
|
|
214
|
-
const selected = index === cursor
|
|
215
|
-
|
|
216
|
-
return (
|
|
217
|
-
<box key={`${row.category}:${row.id}`} style={{ flexDirection: 'column' }}>
|
|
218
|
-
{showCategory && (
|
|
219
|
-
<text style={{ fg: theme.accent, marginTop: index === 0 ? 0 : 1 }}>
|
|
220
|
-
{row.category}
|
|
221
|
-
</text>
|
|
222
|
-
)}
|
|
223
|
-
<box
|
|
224
|
-
style={{
|
|
225
|
-
flexDirection: 'row',
|
|
226
|
-
justifyContent: 'space-between',
|
|
227
|
-
backgroundColor: selected ? theme.selection : 'transparent',
|
|
228
|
-
paddingLeft: 1,
|
|
229
|
-
paddingRight: 1,
|
|
230
|
-
}}
|
|
231
|
-
>
|
|
232
|
-
<text style={{ fg: selected ? theme.selectionText : theme.text }}>
|
|
233
|
-
{row.title}
|
|
234
|
-
</text>
|
|
235
|
-
<text style={{ fg: selected ? theme.selectionText : theme.textMuted }}>
|
|
236
|
-
{row.keybind}
|
|
237
|
-
</text>
|
|
238
|
-
</box>
|
|
239
|
-
</box>
|
|
240
|
-
)
|
|
241
|
-
})
|
|
242
|
-
)}
|
|
243
|
-
</box>
|
|
244
|
-
</Modal>
|
|
245
|
-
)
|
|
246
|
-
}
|
package/src/ui/ErrorScreen.tsx
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import type { ScrollBoxRenderable } from '@opentui/core'
|
|
2
|
-
import { useKeyboard, useTerminalDimensions } from '@opentui/react'
|
|
3
|
-
import { useMemo, useRef, useState } from 'react'
|
|
4
|
-
import { openBrowser } from '../util/browser'
|
|
5
|
-
import { writeClipboard } from '../util/clipboard'
|
|
6
|
-
import { buildIssueUrl, describeFailure, formatDiagnostics } from '../util/errors'
|
|
7
|
-
import { requestShutdown } from '../util/shutdown'
|
|
8
|
-
|
|
9
|
-
interface Props {
|
|
10
|
-
error: unknown
|
|
11
|
-
onRetry: () => void
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function ErrorScreen({ error, onRetry }: Props) {
|
|
15
|
-
const { width, height } = useTerminalDimensions()
|
|
16
|
-
const diagnostics = useMemo(() => formatDiagnostics(error), [error])
|
|
17
|
-
const issueUrl = useMemo(() => buildIssueUrl(error, diagnostics), [error, diagnostics])
|
|
18
|
-
const failure = useMemo(() => describeFailure(error), [error])
|
|
19
|
-
const [status, setStatus] = useState('')
|
|
20
|
-
const scrollRef = useRef<ScrollBoxRenderable | null>(null)
|
|
21
|
-
|
|
22
|
-
const copy = () => {
|
|
23
|
-
setStatus(
|
|
24
|
-
writeClipboard(diagnostics)
|
|
25
|
-
? 'Diagnostics copied'
|
|
26
|
-
: 'Clipboard unavailable; use terminal selection'
|
|
27
|
-
)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const openIssue = () => {
|
|
31
|
-
setStatus('Opening prefilled GitHub issue...')
|
|
32
|
-
void openBrowser(issueUrl).then(opened => {
|
|
33
|
-
setStatus(
|
|
34
|
-
opened
|
|
35
|
-
? 'Opened prefilled issue in your browser'
|
|
36
|
-
: 'Could not open browser; report URL copied'
|
|
37
|
-
)
|
|
38
|
-
if (!opened) writeClipboard(issueUrl.toString())
|
|
39
|
-
})
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
useKeyboard(key => {
|
|
43
|
-
if ((key.ctrl && key.name === 'c') || key.name === 'q' || key.name === 'escape') {
|
|
44
|
-
void requestShutdown(1)
|
|
45
|
-
return
|
|
46
|
-
}
|
|
47
|
-
if (key.name === 'c') copy()
|
|
48
|
-
else if (key.name === 'o') openIssue()
|
|
49
|
-
else if (key.name === 'r') onRetry()
|
|
50
|
-
else if (key.name === 'up' || key.name === 'k') scrollRef.current?.scrollBy(-1)
|
|
51
|
-
else if (key.name === 'down' || key.name === 'j') scrollRef.current?.scrollBy(1)
|
|
52
|
-
else if (key.name === 'pageup') scrollRef.current?.scrollBy(-Math.max(1, height - 12))
|
|
53
|
-
else if (key.name === 'pagedown') scrollRef.current?.scrollBy(Math.max(1, height - 12))
|
|
54
|
-
else if (key.name === 'home') scrollRef.current?.scrollTo(0)
|
|
55
|
-
else if (key.name === 'end') scrollRef.current?.scrollTo(scrollRef.current.scrollHeight)
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
const contentWidth = Math.max(24, Math.min(100, width - 4))
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<box
|
|
62
|
-
style={{
|
|
63
|
-
width,
|
|
64
|
-
height,
|
|
65
|
-
backgroundColor: '#0a0a0a',
|
|
66
|
-
flexDirection: 'column',
|
|
67
|
-
alignItems: 'center',
|
|
68
|
-
paddingTop: 1,
|
|
69
|
-
paddingBottom: 1,
|
|
70
|
-
}}
|
|
71
|
-
>
|
|
72
|
-
<box style={{ width: contentWidth, flexDirection: 'column', flexGrow: 1, gap: 1 }}>
|
|
73
|
-
<text style={{ fg: '#e06c75' }}>mux-sesh crashed</text>
|
|
74
|
-
<text style={{ fg: '#eeeeee' }}>{failure.message || 'An unexpected error occurred.'}</text>
|
|
75
|
-
<text style={{ fg: '#808080' }}>
|
|
76
|
-
c copy diagnostics · o open GitHub issue · r retry · q/esc/ctrl+c quit
|
|
77
|
-
</text>
|
|
78
|
-
{status ? <text style={{ fg: '#7fd88f' }}>{status}</text> : null}
|
|
79
|
-
<box
|
|
80
|
-
style={{
|
|
81
|
-
flexGrow: 1,
|
|
82
|
-
minHeight: 3,
|
|
83
|
-
border: true,
|
|
84
|
-
borderStyle: 'rounded',
|
|
85
|
-
borderColor: '#3c3c3c',
|
|
86
|
-
paddingLeft: 1,
|
|
87
|
-
paddingRight: 1,
|
|
88
|
-
}}
|
|
89
|
-
>
|
|
90
|
-
<scrollbox
|
|
91
|
-
ref={scrollRef}
|
|
92
|
-
style={{ flexGrow: 1 }}
|
|
93
|
-
verticalScrollbarOptions={{ visible: true }}
|
|
94
|
-
>
|
|
95
|
-
<text style={{ fg: '#b0b0b0' }}>{diagnostics}</text>
|
|
96
|
-
</scrollbox>
|
|
97
|
-
</box>
|
|
98
|
-
<text style={{ fg: '#808080' }}>↑/↓, j/k, PgUp/PgDn scroll · GitHub opens unsubmitted</text>
|
|
99
|
-
</box>
|
|
100
|
-
</box>
|
|
101
|
-
)
|
|
102
|
-
}
|