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
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react'
|
|
2
|
-
import { getFilePreview, getProjectPreview, type ProjectPreview } from '../preview/project'
|
|
3
|
-
import { isFileItem } from '../files/target'
|
|
4
|
-
import { getDetailPanelStyle, useTheme } from '../styles/theme'
|
|
5
|
-
import type { Config, Item } from '../types'
|
|
6
|
-
import type { MultiplexerBackend, WorkspaceDetails, WorkspaceRef } from '../multiplexer'
|
|
7
|
-
import { getWorkspaceRef, isLiveSessionItem } from '../multiplexer/items'
|
|
8
|
-
|
|
9
|
-
interface Props {
|
|
10
|
-
selectedItem?: Item
|
|
11
|
-
config: Config | null
|
|
12
|
-
backend: MultiplexerBackend | null
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
type DetailState =
|
|
16
|
-
| { status: 'idle' }
|
|
17
|
-
| { status: 'loading' }
|
|
18
|
-
| { status: 'session'; details: WorkspaceDetails }
|
|
19
|
-
| { status: 'project'; details: ProjectPreview }
|
|
20
|
-
| { status: 'error'; message: string }
|
|
21
|
-
|
|
22
|
-
function formatSourceLabel(source: ProjectPreview['source']): string {
|
|
23
|
-
switch (source) {
|
|
24
|
-
case 'project':
|
|
25
|
-
return 'Project rule'
|
|
26
|
-
case 'wildcard':
|
|
27
|
-
return 'Wildcard rule'
|
|
28
|
-
case 'default':
|
|
29
|
-
return 'Default rule'
|
|
30
|
-
case 'file':
|
|
31
|
-
return 'File target'
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function MetaRow(props: { label: string; value: string; color?: string }) {
|
|
36
|
-
const theme = useTheme()
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<text>
|
|
40
|
-
<span style={{ fg: theme.textSubtle }}>{props.label}</span>{' '}
|
|
41
|
-
<span style={{ fg: props.color ?? theme.textMuted }}>{props.value}</span>
|
|
42
|
-
</text>
|
|
43
|
-
)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function SectionLabel(props: { children: string }) {
|
|
47
|
-
const theme = useTheme()
|
|
48
|
-
return <text style={{ fg: theme.textSubtle, marginTop: 1 }}>{props.children}</text>
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function ProjectPreviewView({ preview }: { preview: ProjectPreview }) {
|
|
52
|
-
const theme = useTheme()
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<box style={{ flexDirection: 'column' }}>
|
|
56
|
-
<text style={{ fg: theme.secondary }}>{preview.sessionName}</text>
|
|
57
|
-
<text style={{ fg: theme.fileTree, marginTop: 1 }}>{preview.path}</text>
|
|
58
|
-
|
|
59
|
-
<box style={{ flexDirection: 'column', marginTop: 1 }}>
|
|
60
|
-
<MetaRow label="Source" value={formatSourceLabel(preview.source)} color={theme.action} />
|
|
61
|
-
{preview.gitBranch && (
|
|
62
|
-
<MetaRow label="Branch" value={preview.gitBranch} color={theme.active} />
|
|
63
|
-
)}
|
|
64
|
-
{preview.startupCommand && (
|
|
65
|
-
<MetaRow label="Startup" value={preview.startupCommand} color={theme.program} />
|
|
66
|
-
)}
|
|
67
|
-
{preview.previewCommand && (
|
|
68
|
-
<MetaRow label="Preview" value={preview.previewCommand} color={theme.action} />
|
|
69
|
-
)}
|
|
70
|
-
</box>
|
|
71
|
-
|
|
72
|
-
{preview.linkedSession && (
|
|
73
|
-
<box style={{ flexDirection: 'column', marginTop: 1 }}>
|
|
74
|
-
<SectionLabel>Live session</SectionLabel>
|
|
75
|
-
<MetaRow
|
|
76
|
-
label="Status"
|
|
77
|
-
value={preview.linkedSession.isActive ? 'active' : 'inactive'}
|
|
78
|
-
color={preview.linkedSession.isActive ? theme.active : theme.textMuted}
|
|
79
|
-
/>
|
|
80
|
-
<MetaRow
|
|
81
|
-
label={preview.linkedSession.unitLabel}
|
|
82
|
-
value={String(preview.linkedSession.units.length)}
|
|
83
|
-
/>
|
|
84
|
-
</box>
|
|
85
|
-
)}
|
|
86
|
-
|
|
87
|
-
<SectionLabel>{preview.previewLabel}</SectionLabel>
|
|
88
|
-
{preview.previewNotice && (
|
|
89
|
-
<text style={{ fg: theme.textSubtle, marginTop: 1 }}>{preview.previewNotice}</text>
|
|
90
|
-
)}
|
|
91
|
-
<box style={{ flexDirection: 'column', marginTop: 1 }}>
|
|
92
|
-
{preview.previewLines.slice(0, 12).map((line, index) => (
|
|
93
|
-
<text
|
|
94
|
-
key={`${preview.previewKind}:${index}:${line}`}
|
|
95
|
-
style={{ fg: line.endsWith('/') ? theme.fileTree : theme.textMuted }}
|
|
96
|
-
>
|
|
97
|
-
{line}
|
|
98
|
-
</text>
|
|
99
|
-
))}
|
|
100
|
-
</box>
|
|
101
|
-
</box>
|
|
102
|
-
)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function SessionDetailsView({ details }: { details: WorkspaceDetails }) {
|
|
106
|
-
const theme = useTheme()
|
|
107
|
-
|
|
108
|
-
return (
|
|
109
|
-
<box style={{ flexDirection: 'column' }}>
|
|
110
|
-
<text style={{ fg: theme.secondary }}>{details.workspace.title}</text>
|
|
111
|
-
|
|
112
|
-
<box style={{ flexDirection: 'column', marginTop: 1 }}>
|
|
113
|
-
<MetaRow
|
|
114
|
-
label="Status"
|
|
115
|
-
value={details.isActive ? 'active' : 'inactive'}
|
|
116
|
-
color={details.isActive ? theme.active : theme.textMuted}
|
|
117
|
-
/>
|
|
118
|
-
<MetaRow label={details.unitLabel} value={String(details.units.length)} />
|
|
119
|
-
</box>
|
|
120
|
-
|
|
121
|
-
<SectionLabel>{details.unitLabel}</SectionLabel>
|
|
122
|
-
<box style={{ flexDirection: 'column', marginTop: 1 }}>
|
|
123
|
-
{details.units.length === 0 ? (
|
|
124
|
-
<text style={{ fg: theme.textMuted }}>No {details.unitLabel.toLowerCase()} found</text>
|
|
125
|
-
) : (
|
|
126
|
-
details.units.map(unit => (
|
|
127
|
-
<box key={unit.id} style={{ flexDirection: 'column', marginBottom: 1 }}>
|
|
128
|
-
<text style={{ fg: theme.text }}>{unit.name}</text>
|
|
129
|
-
{unit.currentPath && <text style={{ fg: theme.fileTree }}>{unit.currentPath}</text>}
|
|
130
|
-
{unit.currentCommand && (
|
|
131
|
-
<text style={{ fg: theme.textSubtle }}>{unit.currentCommand}</text>
|
|
132
|
-
)}
|
|
133
|
-
</box>
|
|
134
|
-
))
|
|
135
|
-
)}
|
|
136
|
-
</box>
|
|
137
|
-
|
|
138
|
-
{details.agents.length > 0 && (
|
|
139
|
-
<>
|
|
140
|
-
<SectionLabel>Agents</SectionLabel>
|
|
141
|
-
<box style={{ flexDirection: 'column', marginTop: 1 }}>
|
|
142
|
-
{details.agents.map(agent => (
|
|
143
|
-
<box key={agent.paneId} style={{ flexDirection: 'column', marginBottom: 1 }}>
|
|
144
|
-
<text style={{ fg: theme.action }}>
|
|
145
|
-
{agent.name} · {agent.status}
|
|
146
|
-
</text>
|
|
147
|
-
{agent.cwd && <text style={{ fg: theme.fileTree }}>{agent.cwd}</text>}
|
|
148
|
-
</box>
|
|
149
|
-
))}
|
|
150
|
-
</box>
|
|
151
|
-
</>
|
|
152
|
-
)}
|
|
153
|
-
|
|
154
|
-
{details.previewLines && details.previewLines.length > 0 && (
|
|
155
|
-
<>
|
|
156
|
-
<SectionLabel>Preview</SectionLabel>
|
|
157
|
-
<box style={{ flexDirection: 'column', marginTop: 1 }}>
|
|
158
|
-
{details.previewLines.map((line, index) => (
|
|
159
|
-
<text
|
|
160
|
-
key={`${details.workspace.id}:preview:${index}`}
|
|
161
|
-
style={{ fg: theme.textMuted }}
|
|
162
|
-
>
|
|
163
|
-
{line}
|
|
164
|
-
</text>
|
|
165
|
-
))}
|
|
166
|
-
</box>
|
|
167
|
-
</>
|
|
168
|
-
)}
|
|
169
|
-
</box>
|
|
170
|
-
)
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
export default function SessionDetailsPanel({ selectedItem, config, backend }: Props) {
|
|
174
|
-
const theme = useTheme()
|
|
175
|
-
const [detailState, setDetailState] = useState<DetailState>({ status: 'idle' })
|
|
176
|
-
|
|
177
|
-
useEffect(() => {
|
|
178
|
-
let cancelled = false
|
|
179
|
-
|
|
180
|
-
async function loadDetails() {
|
|
181
|
-
if (!selectedItem) {
|
|
182
|
-
setDetailState({ status: 'idle' })
|
|
183
|
-
return
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
setDetailState({ status: 'loading' })
|
|
187
|
-
|
|
188
|
-
try {
|
|
189
|
-
if (isLiveSessionItem(selectedItem)) {
|
|
190
|
-
if (!backend) throw new Error('Multiplexer backend is not loaded yet')
|
|
191
|
-
const details = await backend.details(getWorkspaceRef(selectedItem))
|
|
192
|
-
if (!cancelled) {
|
|
193
|
-
setDetailState({ status: 'session', details })
|
|
194
|
-
}
|
|
195
|
-
return
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
if (!config) {
|
|
199
|
-
if (!cancelled) {
|
|
200
|
-
setDetailState({ status: 'error', message: 'Config is not loaded yet' })
|
|
201
|
-
}
|
|
202
|
-
return
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
const linkedWorkspace: WorkspaceRef | undefined =
|
|
206
|
-
selectedItem.linkedSessionId && selectedItem.linkedSessionBackend
|
|
207
|
-
? {
|
|
208
|
-
backend: selectedItem.linkedSessionBackend,
|
|
209
|
-
id: selectedItem.linkedSessionId,
|
|
210
|
-
title: selectedItem.linkedSessionName ?? selectedItem.linkedSessionId,
|
|
211
|
-
}
|
|
212
|
-
: undefined
|
|
213
|
-
const details = isFileItem(selectedItem)
|
|
214
|
-
? await getFilePreview(selectedItem.path, config, linkedWorkspace, workspace => {
|
|
215
|
-
if (!backend) throw new Error('Multiplexer backend is not loaded yet')
|
|
216
|
-
return backend.details(workspace)
|
|
217
|
-
})
|
|
218
|
-
: await getProjectPreview(selectedItem.path, config, linkedWorkspace, workspace => {
|
|
219
|
-
if (!backend) throw new Error('Multiplexer backend is not loaded yet')
|
|
220
|
-
return backend.details(workspace)
|
|
221
|
-
})
|
|
222
|
-
if (!cancelled) {
|
|
223
|
-
setDetailState({ status: 'project', details })
|
|
224
|
-
}
|
|
225
|
-
} catch (error) {
|
|
226
|
-
const message = error instanceof Error ? error.message : 'Unable to load details'
|
|
227
|
-
if (!cancelled) {
|
|
228
|
-
setDetailState({ status: 'error', message })
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
void loadDetails()
|
|
234
|
-
|
|
235
|
-
return () => {
|
|
236
|
-
cancelled = true
|
|
237
|
-
}
|
|
238
|
-
}, [backend, config, selectedItem])
|
|
239
|
-
|
|
240
|
-
const panelStyle = {
|
|
241
|
-
...getDetailPanelStyle(theme),
|
|
242
|
-
flexGrow: 1,
|
|
243
|
-
flexShrink: 1,
|
|
244
|
-
minWidth: 40,
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
return (
|
|
248
|
-
<box style={panelStyle}>
|
|
249
|
-
{detailState.status === 'idle' ? (
|
|
250
|
-
<>
|
|
251
|
-
<text style={{ fg: theme.textMuted }}>Nothing selected</text>
|
|
252
|
-
<text style={{ fg: theme.textSubtle, marginTop: 1 }}>
|
|
253
|
-
Pick a session or project to see details.
|
|
254
|
-
</text>
|
|
255
|
-
</>
|
|
256
|
-
) : detailState.status === 'loading' ? (
|
|
257
|
-
<>
|
|
258
|
-
<text style={{ fg: theme.secondary }}>{selectedItem?.title ?? 'Details'}</text>
|
|
259
|
-
<text style={{ fg: theme.textSubtle, marginTop: 1 }}>Loading…</text>
|
|
260
|
-
</>
|
|
261
|
-
) : detailState.status === 'error' ? (
|
|
262
|
-
<>
|
|
263
|
-
<text style={{ fg: theme.secondary }}>{selectedItem?.title ?? 'Details'}</text>
|
|
264
|
-
<text style={{ fg: theme.danger, marginTop: 1 }}>{detailState.message}</text>
|
|
265
|
-
</>
|
|
266
|
-
) : detailState.status === 'session' ? (
|
|
267
|
-
<SessionDetailsView details={detailState.details} />
|
|
268
|
-
) : (
|
|
269
|
-
<ProjectPreviewView preview={detailState.details} />
|
|
270
|
-
)}
|
|
271
|
-
</box>
|
|
272
|
-
)
|
|
273
|
-
}
|
package/src/ui/SessionList.tsx
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { useTheme } from '../styles/theme'
|
|
2
|
-
import type { IconConfig, Item } from '../types'
|
|
3
|
-
import { getSessionSection } from '../items/order'
|
|
4
|
-
import { getItemKey } from '../multiplexer/items'
|
|
5
|
-
import HighlightedText from './HighlightedText'
|
|
6
|
-
import { formatSectionHeader, getItemIconPresentation } from './item-icon'
|
|
7
|
-
import { getVisibleWindow } from './list-window'
|
|
8
|
-
import { getMutedLabelColumnWidth, getMutedLabelSpacer } from './text-columns'
|
|
9
|
-
import { getSessionMeta } from './session-meta'
|
|
10
|
-
|
|
11
|
-
interface Props {
|
|
12
|
-
items: Item[]
|
|
13
|
-
cursor: number
|
|
14
|
-
maxItems?: number
|
|
15
|
-
searchQuery?: string
|
|
16
|
-
icons?: IconConfig
|
|
17
|
-
pendingKillSessionName?: string | null
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default function SessionList({
|
|
21
|
-
items,
|
|
22
|
-
cursor,
|
|
23
|
-
maxItems = 20,
|
|
24
|
-
searchQuery = '',
|
|
25
|
-
icons,
|
|
26
|
-
pendingKillSessionName,
|
|
27
|
-
}: Props) {
|
|
28
|
-
const theme = useTheme()
|
|
29
|
-
const isSearching = searchQuery.trim().length > 0
|
|
30
|
-
const visibleWindow = getVisibleWindow(items, cursor, maxItems)
|
|
31
|
-
const mutedLabelColumnWidth = getMutedLabelColumnWidth(items)
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<>
|
|
35
|
-
{visibleWindow.items.map((item, i) => {
|
|
36
|
-
const absoluteIndex = visibleWindow.startIndex + i
|
|
37
|
-
const matchIndices = item.searchMatch?.titleIndices
|
|
38
|
-
const itemMeta = getSessionMeta(item)
|
|
39
|
-
const icon = getItemIconPresentation(theme, item, icons)
|
|
40
|
-
const currentSection = getSessionSection(item)
|
|
41
|
-
const previousItem = absoluteIndex > 0 ? items[absoluteIndex - 1] : undefined
|
|
42
|
-
const previousSection = previousItem ? getSessionSection(previousItem) : undefined
|
|
43
|
-
const showSectionHeader = i === 0 || currentSection !== previousSection
|
|
44
|
-
const sectionHeader = formatSectionHeader(theme, currentSection, icons, item.backend)
|
|
45
|
-
const pendingKill = getItemKey(item) === pendingKillSessionName
|
|
46
|
-
const selected = absoluteIndex === cursor
|
|
47
|
-
const mutedLabelSpacer =
|
|
48
|
-
item.isSession && item.desc ? getMutedLabelSpacer(item.title, mutedLabelColumnWidth) : ''
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<box
|
|
52
|
-
key={item.isSession ? getItemKey(item) : `${getItemKey(item)}:${item.path}`}
|
|
53
|
-
style={{ flexDirection: 'column' }}
|
|
54
|
-
>
|
|
55
|
-
{showSectionHeader && (
|
|
56
|
-
<text
|
|
57
|
-
style={{
|
|
58
|
-
fg: theme.textSubtle,
|
|
59
|
-
marginTop: absoluteIndex === 0 ? 0 : 1,
|
|
60
|
-
marginBottom: 1,
|
|
61
|
-
}}
|
|
62
|
-
>
|
|
63
|
-
<span style={{ fg: sectionHeader.color }}>{sectionHeader.text}</span>
|
|
64
|
-
</text>
|
|
65
|
-
)}
|
|
66
|
-
|
|
67
|
-
<box
|
|
68
|
-
style={{
|
|
69
|
-
flexDirection: 'row',
|
|
70
|
-
justifyContent: 'space-between',
|
|
71
|
-
backgroundColor: pendingKill
|
|
72
|
-
? theme.dangerSurface
|
|
73
|
-
: selected
|
|
74
|
-
? theme.surfaceAlt
|
|
75
|
-
: 'transparent',
|
|
76
|
-
paddingLeft: 1,
|
|
77
|
-
paddingRight: 1,
|
|
78
|
-
}}
|
|
79
|
-
>
|
|
80
|
-
<text>
|
|
81
|
-
<span style={{ fg: selected ? theme.primary : theme.textSubtle }}>
|
|
82
|
-
{selected ? '› ' : ' '}
|
|
83
|
-
</span>
|
|
84
|
-
<span style={{ fg: item.isAttached ? theme.active : theme.inactive }}>
|
|
85
|
-
{item.isAttached ? '●' : '○'}
|
|
86
|
-
</span>
|
|
87
|
-
<span style={{ fg: icon.color }}>{icon.glyph ? ` ${icon.glyph}` : ''}</span>{' '}
|
|
88
|
-
{isSearching && matchIndices && matchIndices.length > 0 ? (
|
|
89
|
-
<HighlightedText text={item.title} matchIndices={matchIndices} />
|
|
90
|
-
) : (
|
|
91
|
-
<span style={{ fg: theme.text }}>{item.title}</span>
|
|
92
|
-
)}
|
|
93
|
-
{item.isSession && item.desc ? (
|
|
94
|
-
<span style={{ fg: theme.textSubtle }}>{`${mutedLabelSpacer}${item.desc}`}</span>
|
|
95
|
-
) : null}
|
|
96
|
-
</text>
|
|
97
|
-
|
|
98
|
-
<text
|
|
99
|
-
style={{
|
|
100
|
-
fg: pendingKill
|
|
101
|
-
? theme.danger
|
|
102
|
-
: item.agentStatus === 'blocked'
|
|
103
|
-
? theme.danger
|
|
104
|
-
: item.agentStatus === 'working'
|
|
105
|
-
? theme.active
|
|
106
|
-
: theme.textSubtle,
|
|
107
|
-
}}
|
|
108
|
-
>
|
|
109
|
-
{pendingKill
|
|
110
|
-
? `press d again to ${item.itemKind === 'herdr' ? 'close' : 'kill'}`
|
|
111
|
-
: itemMeta}
|
|
112
|
-
</text>
|
|
113
|
-
</box>
|
|
114
|
-
</box>
|
|
115
|
-
)
|
|
116
|
-
})}
|
|
117
|
-
</>
|
|
118
|
-
)
|
|
119
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import type { TextareaRenderable } from '@opentui/core'
|
|
2
|
-
import { useTheme } from '../styles/theme'
|
|
3
|
-
import Modal from './Modal'
|
|
4
|
-
import { useTextareaFocus } from './use-textarea-focus'
|
|
5
|
-
|
|
6
|
-
interface Props {
|
|
7
|
-
title: string
|
|
8
|
-
description: string
|
|
9
|
-
value: string
|
|
10
|
-
error?: string
|
|
11
|
-
columns: number
|
|
12
|
-
rows: number
|
|
13
|
-
textareaRef: { current: TextareaRenderable | null }
|
|
14
|
-
onContentChange: () => void
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export default function SettingEditorModal({
|
|
18
|
-
title,
|
|
19
|
-
description,
|
|
20
|
-
value,
|
|
21
|
-
error,
|
|
22
|
-
columns,
|
|
23
|
-
rows,
|
|
24
|
-
textareaRef,
|
|
25
|
-
onContentChange,
|
|
26
|
-
}: Props) {
|
|
27
|
-
const theme = useTheme()
|
|
28
|
-
useTextareaFocus(textareaRef, [])
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<Modal
|
|
32
|
-
title={title}
|
|
33
|
-
description={description}
|
|
34
|
-
footer="Enter apply"
|
|
35
|
-
columns={columns}
|
|
36
|
-
preferredWidth={88}
|
|
37
|
-
>
|
|
38
|
-
{error && <text style={{ fg: theme.danger, marginBottom: 1 }}>{error}</text>}
|
|
39
|
-
|
|
40
|
-
<box
|
|
41
|
-
style={{
|
|
42
|
-
backgroundColor: theme.surfaceAlt,
|
|
43
|
-
height: Math.max(6, rows - 16),
|
|
44
|
-
}}
|
|
45
|
-
>
|
|
46
|
-
<textarea
|
|
47
|
-
ref={textareaRef}
|
|
48
|
-
initialValue={value}
|
|
49
|
-
onContentChange={onContentChange}
|
|
50
|
-
focused
|
|
51
|
-
/>
|
|
52
|
-
</box>
|
|
53
|
-
</Modal>
|
|
54
|
-
)
|
|
55
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import type { TextareaRenderable } from '@opentui/core'
|
|
2
|
-
import { useTheme } from '../styles/theme'
|
|
3
|
-
import type { SettingsOption } from '../settings'
|
|
4
|
-
import Modal from './Modal'
|
|
5
|
-
import { useTextareaFocus } from './use-textarea-focus'
|
|
6
|
-
|
|
7
|
-
interface Props {
|
|
8
|
-
title: string
|
|
9
|
-
description: string
|
|
10
|
-
columns: number
|
|
11
|
-
options: SettingsOption[]
|
|
12
|
-
cursor: number
|
|
13
|
-
searchQuery: string
|
|
14
|
-
textareaRef: { current: TextareaRenderable | null }
|
|
15
|
-
onContentChange: () => void
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default function SettingOptionsModal({
|
|
19
|
-
title,
|
|
20
|
-
description,
|
|
21
|
-
columns,
|
|
22
|
-
options,
|
|
23
|
-
cursor,
|
|
24
|
-
searchQuery,
|
|
25
|
-
textareaRef,
|
|
26
|
-
onContentChange,
|
|
27
|
-
}: Props) {
|
|
28
|
-
const theme = useTheme()
|
|
29
|
-
const selected = options[cursor]
|
|
30
|
-
useTextareaFocus(textareaRef, [])
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<Modal
|
|
34
|
-
title={title}
|
|
35
|
-
description={description}
|
|
36
|
-
footer="↑/↓ navigate enter apply esc back"
|
|
37
|
-
columns={columns}
|
|
38
|
-
preferredWidth={68}
|
|
39
|
-
>
|
|
40
|
-
<box
|
|
41
|
-
style={{
|
|
42
|
-
backgroundColor: theme.surfaceAlt,
|
|
43
|
-
paddingLeft: 1,
|
|
44
|
-
paddingRight: 1,
|
|
45
|
-
marginBottom: 1,
|
|
46
|
-
}}
|
|
47
|
-
>
|
|
48
|
-
<textarea
|
|
49
|
-
ref={textareaRef}
|
|
50
|
-
initialValue={searchQuery}
|
|
51
|
-
onContentChange={onContentChange}
|
|
52
|
-
focused
|
|
53
|
-
placeholder="Filter options"
|
|
54
|
-
/>
|
|
55
|
-
</box>
|
|
56
|
-
|
|
57
|
-
<box style={{ flexDirection: 'column' }}>
|
|
58
|
-
{options.length === 0 ? (
|
|
59
|
-
<text style={{ fg: theme.textMuted }}>No options found</text>
|
|
60
|
-
) : (
|
|
61
|
-
options.map((option, index) => {
|
|
62
|
-
const active = index === cursor
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<box
|
|
66
|
-
key={option.value}
|
|
67
|
-
style={{
|
|
68
|
-
flexDirection: 'row',
|
|
69
|
-
justifyContent: 'space-between',
|
|
70
|
-
backgroundColor: active ? theme.selection : 'transparent',
|
|
71
|
-
paddingLeft: 1,
|
|
72
|
-
paddingRight: 1,
|
|
73
|
-
}}
|
|
74
|
-
>
|
|
75
|
-
<text style={{ fg: active ? theme.selectionText : theme.text }}>
|
|
76
|
-
{option.label}
|
|
77
|
-
</text>
|
|
78
|
-
<text style={{ fg: active ? theme.selectionText : theme.textMuted }}>
|
|
79
|
-
{option.value}
|
|
80
|
-
</text>
|
|
81
|
-
</box>
|
|
82
|
-
)
|
|
83
|
-
})
|
|
84
|
-
)}
|
|
85
|
-
</box>
|
|
86
|
-
|
|
87
|
-
{selected && selected.description && (
|
|
88
|
-
<box style={{ flexDirection: 'column', marginTop: 1 }}>
|
|
89
|
-
<text style={{ fg: theme.accent }}>{selected.label}</text>
|
|
90
|
-
<text style={{ fg: theme.textMuted }}>{selected.description}</text>
|
|
91
|
-
</box>
|
|
92
|
-
)}
|
|
93
|
-
</Modal>
|
|
94
|
-
)
|
|
95
|
-
}
|
package/src/ui/SettingsModal.tsx
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import type { TextareaRenderable } from '@opentui/core'
|
|
2
|
-
import { useTheme } from '../styles/theme'
|
|
3
|
-
import type { SettingsEntry } from '../settings'
|
|
4
|
-
import Modal from './Modal'
|
|
5
|
-
import { useTextareaFocus } from './use-textarea-focus'
|
|
6
|
-
|
|
7
|
-
interface Props {
|
|
8
|
-
configPath: string
|
|
9
|
-
themeName: string
|
|
10
|
-
colorMode: string
|
|
11
|
-
columns: number
|
|
12
|
-
entries: SettingsEntry[]
|
|
13
|
-
cursor: number
|
|
14
|
-
searchQuery: string
|
|
15
|
-
textareaRef: { current: TextareaRenderable | null }
|
|
16
|
-
onContentChange: () => void
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export default function SettingsModal({
|
|
20
|
-
configPath,
|
|
21
|
-
themeName,
|
|
22
|
-
colorMode,
|
|
23
|
-
columns,
|
|
24
|
-
entries,
|
|
25
|
-
cursor,
|
|
26
|
-
searchQuery,
|
|
27
|
-
textareaRef,
|
|
28
|
-
onContentChange,
|
|
29
|
-
}: Props) {
|
|
30
|
-
const theme = useTheme()
|
|
31
|
-
const selected = entries[cursor]
|
|
32
|
-
useTextareaFocus(textareaRef, [])
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<Modal
|
|
36
|
-
title="Settings"
|
|
37
|
-
description="Search for a setting, then open its option or editor screen"
|
|
38
|
-
footer="↑/↓ navigate enter open esc close"
|
|
39
|
-
columns={columns}
|
|
40
|
-
preferredWidth={74}
|
|
41
|
-
>
|
|
42
|
-
<box style={{ flexDirection: 'column', marginBottom: 1 }}>
|
|
43
|
-
<text style={{ fg: theme.textMuted }}>Path: {configPath}</text>
|
|
44
|
-
<text style={{ fg: theme.textMuted }}>
|
|
45
|
-
{themeName} ({colorMode})
|
|
46
|
-
</text>
|
|
47
|
-
</box>
|
|
48
|
-
|
|
49
|
-
<box
|
|
50
|
-
style={{
|
|
51
|
-
backgroundColor: theme.surfaceAlt,
|
|
52
|
-
paddingLeft: 1,
|
|
53
|
-
paddingRight: 1,
|
|
54
|
-
marginBottom: 1,
|
|
55
|
-
}}
|
|
56
|
-
>
|
|
57
|
-
<textarea
|
|
58
|
-
ref={textareaRef}
|
|
59
|
-
initialValue={searchQuery}
|
|
60
|
-
onContentChange={onContentChange}
|
|
61
|
-
focused
|
|
62
|
-
placeholder="Search settings"
|
|
63
|
-
/>
|
|
64
|
-
</box>
|
|
65
|
-
|
|
66
|
-
<box style={{ flexDirection: 'column' }}>
|
|
67
|
-
{entries.length === 0 ? (
|
|
68
|
-
<text style={{ fg: theme.textMuted }}>No settings found</text>
|
|
69
|
-
) : (
|
|
70
|
-
entries.map((entry, index) => {
|
|
71
|
-
const active = index === cursor
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<box
|
|
75
|
-
key={entry.id}
|
|
76
|
-
style={{
|
|
77
|
-
flexDirection: 'row',
|
|
78
|
-
justifyContent: 'space-between',
|
|
79
|
-
backgroundColor: active ? theme.selection : 'transparent',
|
|
80
|
-
paddingLeft: 1,
|
|
81
|
-
paddingRight: 1,
|
|
82
|
-
}}
|
|
83
|
-
>
|
|
84
|
-
<text style={{ fg: active ? theme.selectionText : theme.text }}>{entry.label}</text>
|
|
85
|
-
<text style={{ fg: active ? theme.selectionText : theme.textMuted }}>
|
|
86
|
-
{entry.value}
|
|
87
|
-
</text>
|
|
88
|
-
</box>
|
|
89
|
-
)
|
|
90
|
-
})
|
|
91
|
-
)}
|
|
92
|
-
</box>
|
|
93
|
-
|
|
94
|
-
{selected && (
|
|
95
|
-
<box style={{ flexDirection: 'column', marginTop: 1 }}>
|
|
96
|
-
<text style={{ fg: theme.accent }}>{selected.label}</text>
|
|
97
|
-
<text style={{ fg: theme.textMuted }}>{selected.hint}</text>
|
|
98
|
-
</box>
|
|
99
|
-
)}
|
|
100
|
-
</Modal>
|
|
101
|
-
)
|
|
102
|
-
}
|
package/src/ui/Toast.tsx
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { useTheme } from '../styles/theme'
|
|
2
|
-
|
|
3
|
-
interface ToastProps {
|
|
4
|
-
message: string
|
|
5
|
-
visible: boolean
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export default function Toast({ message, visible }: ToastProps) {
|
|
9
|
-
const theme = useTheme()
|
|
10
|
-
|
|
11
|
-
if (!visible) return null
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<box
|
|
15
|
-
style={{
|
|
16
|
-
position: 'absolute',
|
|
17
|
-
top: 1,
|
|
18
|
-
right: 2,
|
|
19
|
-
}}
|
|
20
|
-
>
|
|
21
|
-
<box
|
|
22
|
-
style={{
|
|
23
|
-
flexDirection: 'row',
|
|
24
|
-
backgroundColor: theme.surface,
|
|
25
|
-
paddingTop: 1,
|
|
26
|
-
}}
|
|
27
|
-
>
|
|
28
|
-
<text style={{ fg: theme.action }}>▎</text>
|
|
29
|
-
<text style={{ fg: theme.text, marginLeft: 1, marginRight: 1 }}>{message}</text>
|
|
30
|
-
<text style={{ fg: theme.action }}>▎</text>
|
|
31
|
-
</box>
|
|
32
|
-
</box>
|
|
33
|
-
)
|
|
34
|
-
}
|