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,60 +0,0 @@
|
|
|
1
|
-
import { useTheme } from '../styles/theme'
|
|
2
|
-
|
|
3
|
-
interface Props {
|
|
4
|
-
text: string
|
|
5
|
-
matchIndices?: number[]
|
|
6
|
-
highlightColor?: string
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Renders text with highlighted characters at specified indices
|
|
11
|
-
* Used for fuzzy search match visualization (like fzf/telescope)
|
|
12
|
-
*/
|
|
13
|
-
export default function HighlightedText({ text, matchIndices = [], highlightColor }: Props) {
|
|
14
|
-
const theme = useTheme()
|
|
15
|
-
const resolvedHighlightColor = highlightColor ?? theme.action
|
|
16
|
-
|
|
17
|
-
// If no matches, return plain text
|
|
18
|
-
if (matchIndices.length === 0) {
|
|
19
|
-
return <>{text}</>
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// Build array of text segments with their highlight status
|
|
23
|
-
const segments: Array<{ text: string; highlighted: boolean }> = []
|
|
24
|
-
let currentSegment = ''
|
|
25
|
-
let isHighlighted = false
|
|
26
|
-
|
|
27
|
-
for (let i = 0; i < text.length; i++) {
|
|
28
|
-
const shouldHighlight = matchIndices.includes(i)
|
|
29
|
-
|
|
30
|
-
// If highlight status changes, start a new segment
|
|
31
|
-
if (shouldHighlight !== isHighlighted) {
|
|
32
|
-
if (currentSegment) {
|
|
33
|
-
segments.push({ text: currentSegment, highlighted: isHighlighted })
|
|
34
|
-
currentSegment = ''
|
|
35
|
-
}
|
|
36
|
-
isHighlighted = shouldHighlight
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
currentSegment += text[i]
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Add the final segment
|
|
43
|
-
if (currentSegment) {
|
|
44
|
-
segments.push({ text: currentSegment, highlighted: isHighlighted })
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
<>
|
|
49
|
-
{segments.map((segment, i) =>
|
|
50
|
-
segment.highlighted ? (
|
|
51
|
-
<span key={i} style={{ fg: resolvedHighlightColor }}>
|
|
52
|
-
{segment.text}
|
|
53
|
-
</span>
|
|
54
|
-
) : (
|
|
55
|
-
<span key={i}>{segment.text}</span>
|
|
56
|
-
)
|
|
57
|
-
)}
|
|
58
|
-
</>
|
|
59
|
-
)
|
|
60
|
-
}
|
package/src/ui/ItemList.tsx
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { useTheme } from '../styles/theme'
|
|
2
|
-
import { AppMode, type IconConfig } from '../types'
|
|
3
|
-
import HighlightedText from './HighlightedText'
|
|
4
|
-
import { getItemIconPresentation } from './item-icon'
|
|
5
|
-
import { getVisibleWindow } from './list-window'
|
|
6
|
-
import type { Item } from '../types'
|
|
7
|
-
import { getItemKey } from '../multiplexer/items'
|
|
8
|
-
|
|
9
|
-
interface Props {
|
|
10
|
-
items: Item[]
|
|
11
|
-
cursor: number
|
|
12
|
-
appMode: AppMode
|
|
13
|
-
maxItems?: number
|
|
14
|
-
searchQuery?: string
|
|
15
|
-
icons?: IconConfig
|
|
16
|
-
pendingKillSessionName?: string | null
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export default function ItemList({
|
|
20
|
-
items,
|
|
21
|
-
cursor,
|
|
22
|
-
appMode,
|
|
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
|
-
|
|
32
|
-
return (
|
|
33
|
-
<>
|
|
34
|
-
{visibleWindow.items.map((item, i) => {
|
|
35
|
-
const absoluteIndex = visibleWindow.startIndex + i
|
|
36
|
-
const titleMatchIndices = item.searchMatch?.titleIndices
|
|
37
|
-
const descMatchIndices = item.searchMatch?.descIndices
|
|
38
|
-
const hasTitleMatch = titleMatchIndices && titleMatchIndices.length > 0
|
|
39
|
-
const hasDescMatch = descMatchIndices && descMatchIndices.length > 0
|
|
40
|
-
const icon = getItemIconPresentation(theme, item, icons)
|
|
41
|
-
const sessionStatusLabel = item.linkedSessionName
|
|
42
|
-
? 'attach'
|
|
43
|
-
: item.itemKind === 'file'
|
|
44
|
-
? 'open'
|
|
45
|
-
: 'create'
|
|
46
|
-
const linkedSessionLabel = item.linkedSessionName ? ` -> ${item.linkedSessionName}` : ''
|
|
47
|
-
const pendingKill = item.isSession && getItemKey(item) === pendingKillSessionName
|
|
48
|
-
const selected = absoluteIndex === cursor
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<box
|
|
52
|
-
key={`${getItemKey(item)}:${item.path}`}
|
|
53
|
-
style={{
|
|
54
|
-
flexDirection: 'row',
|
|
55
|
-
justifyContent: 'space-between',
|
|
56
|
-
backgroundColor: pendingKill
|
|
57
|
-
? theme.dangerSurface
|
|
58
|
-
: selected
|
|
59
|
-
? theme.surfaceAlt
|
|
60
|
-
: 'transparent',
|
|
61
|
-
paddingLeft: 1,
|
|
62
|
-
paddingRight: 1,
|
|
63
|
-
}}
|
|
64
|
-
>
|
|
65
|
-
<text>
|
|
66
|
-
<span style={{ fg: selected ? theme.primary : theme.textSubtle }}>
|
|
67
|
-
{selected ? '› ' : ' '}
|
|
68
|
-
</span>
|
|
69
|
-
{item.isSession ? (
|
|
70
|
-
<>
|
|
71
|
-
<span style={{ fg: item.isAttached ? theme.active : theme.inactive }}>
|
|
72
|
-
{item.isAttached ? '●' : '○'}
|
|
73
|
-
</span>{' '}
|
|
74
|
-
{isSearching && hasTitleMatch ? (
|
|
75
|
-
<HighlightedText text={item.title} matchIndices={titleMatchIndices} />
|
|
76
|
-
) : (
|
|
77
|
-
<span style={{ fg: theme.text }}>{item.title}</span>
|
|
78
|
-
)}
|
|
79
|
-
{item.desc ? (
|
|
80
|
-
<span style={{ fg: theme.textSubtle }}>{` ${item.desc}`}</span>
|
|
81
|
-
) : null}
|
|
82
|
-
</>
|
|
83
|
-
) : (
|
|
84
|
-
<>
|
|
85
|
-
<span style={{ fg: icon.color }}>{icon.glyph}</span>{' '}
|
|
86
|
-
{isSearching && hasTitleMatch ? (
|
|
87
|
-
<HighlightedText text={item.title} matchIndices={titleMatchIndices} />
|
|
88
|
-
) : (
|
|
89
|
-
<span style={{ fg: theme.text }}>{item.title}</span>
|
|
90
|
-
)}
|
|
91
|
-
{item.desc ? (
|
|
92
|
-
<>
|
|
93
|
-
<span style={{ fg: theme.textSubtle }}>{' '}</span>
|
|
94
|
-
{isSearching && hasDescMatch ? (
|
|
95
|
-
<HighlightedText text={item.desc} matchIndices={descMatchIndices} />
|
|
96
|
-
) : (
|
|
97
|
-
<span style={{ fg: theme.textSubtle }}>{item.desc}</span>
|
|
98
|
-
)}
|
|
99
|
-
</>
|
|
100
|
-
) : null}
|
|
101
|
-
</>
|
|
102
|
-
)}
|
|
103
|
-
</text>
|
|
104
|
-
|
|
105
|
-
<text style={{ fg: pendingKill ? theme.danger : theme.textSubtle }}>
|
|
106
|
-
{item.isSession
|
|
107
|
-
? pendingKill
|
|
108
|
-
? 'press d again to kill'
|
|
109
|
-
: `(${item.windowCount})`
|
|
110
|
-
: appMode === AppMode.NewSession
|
|
111
|
-
? `${sessionStatusLabel}${linkedSessionLabel}`
|
|
112
|
-
: ''}
|
|
113
|
-
</text>
|
|
114
|
-
</box>
|
|
115
|
-
)
|
|
116
|
-
})}
|
|
117
|
-
</>
|
|
118
|
-
)
|
|
119
|
-
}
|
package/src/ui/Modal.tsx
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react'
|
|
2
|
-
import { RGBA } from '@opentui/core'
|
|
3
|
-
import { getModalStyle, useTheme } from '../styles/theme'
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
title: string
|
|
7
|
-
description?: string
|
|
8
|
-
footer?: string
|
|
9
|
-
columns: number
|
|
10
|
-
preferredWidth?: number
|
|
11
|
-
children: ReactNode
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export default function Modal({
|
|
15
|
-
title,
|
|
16
|
-
description,
|
|
17
|
-
footer,
|
|
18
|
-
columns,
|
|
19
|
-
preferredWidth,
|
|
20
|
-
children,
|
|
21
|
-
}: Props) {
|
|
22
|
-
const theme = useTheme()
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<box
|
|
26
|
-
style={{
|
|
27
|
-
position: 'absolute',
|
|
28
|
-
top: 0,
|
|
29
|
-
left: 0,
|
|
30
|
-
width: '100%',
|
|
31
|
-
height: '100%',
|
|
32
|
-
justifyContent: 'center',
|
|
33
|
-
alignItems: 'center',
|
|
34
|
-
backgroundColor: RGBA.fromInts(0, 0, 0, 150),
|
|
35
|
-
}}
|
|
36
|
-
>
|
|
37
|
-
<box style={getModalStyle(theme, columns, preferredWidth)}>
|
|
38
|
-
<box style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
39
|
-
<text style={{ fg: theme.text }}>{title}</text>
|
|
40
|
-
<text style={{ fg: theme.textMuted }}>esc</text>
|
|
41
|
-
</box>
|
|
42
|
-
{description && <text style={{ fg: theme.textMuted, marginTop: 1 }}>{description}</text>}
|
|
43
|
-
<box style={{ flexDirection: 'column', marginTop: 1 }}>{children}</box>
|
|
44
|
-
{footer && <text style={{ fg: theme.textMuted, marginTop: 1 }}>{footer}</text>}
|
|
45
|
-
</box>
|
|
46
|
-
</box>
|
|
47
|
-
)
|
|
48
|
-
}
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react'
|
|
2
|
-
import { formatSessionAge } from '../opencode'
|
|
3
|
-
import { getGlobalOpencodeStats } from '../opencode/parser'
|
|
4
|
-
import type { OpencodeStats } from '../opencode'
|
|
5
|
-
import { getDetailPanelStyle, useTheme } from '../styles/theme'
|
|
6
|
-
import type { Item } from '../types'
|
|
7
|
-
|
|
8
|
-
interface Props {
|
|
9
|
-
selectedItem?: Item
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
type GlobalStatsState =
|
|
13
|
-
| { status: 'loading' }
|
|
14
|
-
| { status: 'ready'; stats: OpencodeStats }
|
|
15
|
-
| { status: 'error'; message: string }
|
|
16
|
-
|
|
17
|
-
function formatNumber(value: number): string {
|
|
18
|
-
return value.toLocaleString()
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export default function OpencodeStatsPanel({ selectedItem }: Props) {
|
|
22
|
-
const theme = useTheme()
|
|
23
|
-
const [globalStatsState, setGlobalStatsState] = useState<GlobalStatsState>({ status: 'loading' })
|
|
24
|
-
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
let disposed = false
|
|
27
|
-
|
|
28
|
-
async function loadGlobalStats() {
|
|
29
|
-
try {
|
|
30
|
-
const stats = await getGlobalOpencodeStats()
|
|
31
|
-
if (!disposed) {
|
|
32
|
-
setGlobalStatsState({ status: 'ready', stats })
|
|
33
|
-
}
|
|
34
|
-
} catch (error) {
|
|
35
|
-
const message =
|
|
36
|
-
error instanceof Error ? error.message : 'Failed to load global OpenCode stats'
|
|
37
|
-
if (!disposed) {
|
|
38
|
-
setGlobalStatsState({ status: 'error', message })
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
void loadGlobalStats()
|
|
44
|
-
|
|
45
|
-
const interval = setInterval(() => {
|
|
46
|
-
void loadGlobalStats()
|
|
47
|
-
}, 5000)
|
|
48
|
-
|
|
49
|
-
return () => {
|
|
50
|
-
disposed = true
|
|
51
|
-
clearInterval(interval)
|
|
52
|
-
}
|
|
53
|
-
}, [])
|
|
54
|
-
|
|
55
|
-
const sessionState = selectedItem?.opencodeState
|
|
56
|
-
const sessionStats = sessionState?.status === 'ready' ? sessionState.stats : null
|
|
57
|
-
const lastMessageTokens = sessionStats?.lastMessageTokens ?? 0
|
|
58
|
-
const contextLimit = sessionStats?.contextLimit ?? 200000
|
|
59
|
-
const contextPercentage =
|
|
60
|
-
lastMessageTokens > 0 && contextLimit > 0
|
|
61
|
-
? Math.round((lastMessageTokens / contextLimit) * 100)
|
|
62
|
-
: 0
|
|
63
|
-
const sessionCost = sessionStats?.sessionTotalCost ?? 0
|
|
64
|
-
|
|
65
|
-
const panelStyle = {
|
|
66
|
-
...getDetailPanelStyle(theme),
|
|
67
|
-
flexGrow: 1,
|
|
68
|
-
flexShrink: 1,
|
|
69
|
-
minWidth: 40,
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return (
|
|
73
|
-
<box style={panelStyle}>
|
|
74
|
-
<box style={{ alignItems: 'center', justifyContent: 'center', marginBottom: 2 }}>
|
|
75
|
-
<text style={{ fg: theme.primary, marginBottom: 1 }}> OpenCode Stats</text>
|
|
76
|
-
</box>
|
|
77
|
-
|
|
78
|
-
<box style={{ flexDirection: 'row', marginBottom: 2 }}>
|
|
79
|
-
<box style={{ flexDirection: 'column', marginLeft: 2, width: '50%' }}>
|
|
80
|
-
<text style={{ fg: theme.key, marginBottom: 1 }}>Current Session</text>
|
|
81
|
-
{sessionState?.status === 'ready' ? (
|
|
82
|
-
<>
|
|
83
|
-
<text>
|
|
84
|
-
Messages:{' '}
|
|
85
|
-
<span style={{ fg: theme.active }}>{sessionState.stats.messageCount ?? 0}</span>
|
|
86
|
-
</text>
|
|
87
|
-
<text>
|
|
88
|
-
Cost: <span style={{ fg: theme.action }}>${sessionCost.toFixed(2)}</span>
|
|
89
|
-
</text>
|
|
90
|
-
<text style={{ marginTop: 1 }}>
|
|
91
|
-
Context: <span style={{ fg: theme.text }}>{formatNumber(lastMessageTokens)}</span>
|
|
92
|
-
<span style={{ fg: theme.action }}>/{contextPercentage}%</span>
|
|
93
|
-
</text>
|
|
94
|
-
</>
|
|
95
|
-
) : sessionState?.status === 'error' ? (
|
|
96
|
-
<text style={{ fg: theme.action }}>{sessionState.message}</text>
|
|
97
|
-
) : sessionState?.status === 'missing' ? (
|
|
98
|
-
<text style={{ fg: theme.inactive }}>{sessionState.message}</text>
|
|
99
|
-
) : (
|
|
100
|
-
<text style={{ fg: theme.inactive }}>Loading stats...</text>
|
|
101
|
-
)}
|
|
102
|
-
</box>
|
|
103
|
-
|
|
104
|
-
<box style={{ flexDirection: 'column', marginLeft: 2 }}>
|
|
105
|
-
<text style={{ fg: theme.key, marginBottom: 1 }}>Global Overview</text>
|
|
106
|
-
{globalStatsState.status === 'ready' ? (
|
|
107
|
-
<>
|
|
108
|
-
<text>
|
|
109
|
-
Sessions:{' '}
|
|
110
|
-
<span style={{ fg: theme.active }}>
|
|
111
|
-
{globalStatsState.stats.totalSessions ?? 0}
|
|
112
|
-
</span>
|
|
113
|
-
</text>
|
|
114
|
-
<text>
|
|
115
|
-
Messages:{' '}
|
|
116
|
-
<span style={{ fg: theme.active }}>
|
|
117
|
-
{globalStatsState.stats.totalMessages ?? 0}
|
|
118
|
-
</span>
|
|
119
|
-
</text>
|
|
120
|
-
<text>
|
|
121
|
-
Total Cost:{' '}
|
|
122
|
-
<span style={{ fg: theme.action }}>
|
|
123
|
-
{globalStatsState.stats.totalCost ?? '$0.00'}
|
|
124
|
-
</span>
|
|
125
|
-
</text>
|
|
126
|
-
<text>
|
|
127
|
-
Cost/Day:{' '}
|
|
128
|
-
<span style={{ fg: theme.text }}>
|
|
129
|
-
{globalStatsState.stats.costPerDay ?? '$0.00'}
|
|
130
|
-
</span>
|
|
131
|
-
</text>
|
|
132
|
-
|
|
133
|
-
<text style={{ fg: theme.key, marginTop: 1, marginBottom: 1 }}>Token Usage</text>
|
|
134
|
-
<text>
|
|
135
|
-
Input:{' '}
|
|
136
|
-
<span style={{ fg: theme.text }}>{globalStatsState.stats.inputTokens ?? '0'}</span>
|
|
137
|
-
</text>
|
|
138
|
-
<text>
|
|
139
|
-
Output:{' '}
|
|
140
|
-
<span style={{ fg: theme.text }}>{globalStatsState.stats.outputTokens ?? '0'}</span>
|
|
141
|
-
</text>
|
|
142
|
-
<text>
|
|
143
|
-
Cache Read:{' '}
|
|
144
|
-
<span style={{ fg: theme.inactive }}>
|
|
145
|
-
{globalStatsState.stats.cacheRead ?? '0'}
|
|
146
|
-
</span>
|
|
147
|
-
</text>
|
|
148
|
-
<text>
|
|
149
|
-
Cache Write:{' '}
|
|
150
|
-
<span style={{ fg: theme.inactive }}>
|
|
151
|
-
{globalStatsState.stats.cacheWrite ?? '0'}
|
|
152
|
-
</span>
|
|
153
|
-
</text>
|
|
154
|
-
</>
|
|
155
|
-
) : globalStatsState.status === 'error' ? (
|
|
156
|
-
<text style={{ fg: theme.action }}>{globalStatsState.message}</text>
|
|
157
|
-
) : (
|
|
158
|
-
<text style={{ fg: theme.inactive }}>Loading stats...</text>
|
|
159
|
-
)}
|
|
160
|
-
</box>
|
|
161
|
-
</box>
|
|
162
|
-
|
|
163
|
-
{sessionStats && (
|
|
164
|
-
<>
|
|
165
|
-
<box style={{ alignItems: 'center', justifyContent: 'center', marginTop: 1 }}>
|
|
166
|
-
<text style={{ fg: theme.primary, marginBottom: 1 }}> Session Details</text>
|
|
167
|
-
</box>
|
|
168
|
-
|
|
169
|
-
<box style={{ flexDirection: 'column', marginLeft: 2 }}>
|
|
170
|
-
{sessionStats.title && (
|
|
171
|
-
<text style={{ marginBottom: 1 }}>
|
|
172
|
-
<span style={{ fg: theme.key }}>Title:</span> {sessionStats.title}
|
|
173
|
-
</text>
|
|
174
|
-
)}
|
|
175
|
-
|
|
176
|
-
{sessionStats.directory && (
|
|
177
|
-
<text style={{ marginBottom: 1, fg: theme.fileTree }}>{sessionStats.directory}</text>
|
|
178
|
-
)}
|
|
179
|
-
|
|
180
|
-
{sessionStats.sessionCount !== undefined && (
|
|
181
|
-
<text>
|
|
182
|
-
Sessions: <span style={{ fg: theme.active }}>{sessionStats.sessionCount}</span>
|
|
183
|
-
</text>
|
|
184
|
-
)}
|
|
185
|
-
|
|
186
|
-
{sessionStats.messageCount !== undefined && (
|
|
187
|
-
<text>
|
|
188
|
-
Messages: <span style={{ fg: theme.active }}>{sessionStats.messageCount}</span>
|
|
189
|
-
</text>
|
|
190
|
-
)}
|
|
191
|
-
|
|
192
|
-
{sessionStats.filesModified !== undefined && sessionStats.filesModified > 0 && (
|
|
193
|
-
<text>
|
|
194
|
-
Files Modified:{' '}
|
|
195
|
-
<span style={{ fg: theme.action }}>{sessionStats.filesModified}</span>
|
|
196
|
-
</text>
|
|
197
|
-
)}
|
|
198
|
-
|
|
199
|
-
{sessionStats.mostRecentTitle && (
|
|
200
|
-
<text style={{ marginTop: 1 }}>
|
|
201
|
-
<span style={{ fg: theme.key }}>Most Recent:</span> {sessionStats.mostRecentTitle}
|
|
202
|
-
</text>
|
|
203
|
-
)}
|
|
204
|
-
|
|
205
|
-
{sessionStats.createdAt && (
|
|
206
|
-
<text style={{ marginTop: 1 }}>
|
|
207
|
-
Created:{' '}
|
|
208
|
-
<span style={{ fg: theme.inactive }}>
|
|
209
|
-
{formatSessionAge(sessionStats.createdAt)}
|
|
210
|
-
</span>
|
|
211
|
-
</text>
|
|
212
|
-
)}
|
|
213
|
-
|
|
214
|
-
{sessionStats.updatedAt && (
|
|
215
|
-
<text>
|
|
216
|
-
Updated:{' '}
|
|
217
|
-
<span style={{ fg: theme.inactive }}>
|
|
218
|
-
{formatSessionAge(sessionStats.updatedAt)}
|
|
219
|
-
</span>
|
|
220
|
-
</text>
|
|
221
|
-
)}
|
|
222
|
-
</box>
|
|
223
|
-
</>
|
|
224
|
-
)}
|
|
225
|
-
|
|
226
|
-
{!selectedItem && (
|
|
227
|
-
<box style={{ marginTop: 2, marginLeft: 2 }}>
|
|
228
|
-
<text style={{ fg: theme.inactive }}>No session data found</text>
|
|
229
|
-
</box>
|
|
230
|
-
)}
|
|
231
|
-
</box>
|
|
232
|
-
)
|
|
233
|
-
}
|
package/src/ui/RenameModal.tsx
DELETED
|
@@ -1,42 +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
|
-
target: string
|
|
8
|
-
initialValue: string
|
|
9
|
-
columns: number
|
|
10
|
-
textareaRef: { current: TextareaRenderable | null }
|
|
11
|
-
onContentChange: () => void
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export default function RenameModal({
|
|
15
|
-
target,
|
|
16
|
-
initialValue,
|
|
17
|
-
columns,
|
|
18
|
-
textareaRef,
|
|
19
|
-
onContentChange,
|
|
20
|
-
}: Props) {
|
|
21
|
-
const theme = useTheme()
|
|
22
|
-
useTextareaFocus(textareaRef, [target], { gotoLineEnd: true })
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<Modal
|
|
26
|
-
title="Rename Session"
|
|
27
|
-
description={`Update ${target}`}
|
|
28
|
-
footer="Enter apply"
|
|
29
|
-
columns={columns}
|
|
30
|
-
preferredWidth={60}
|
|
31
|
-
>
|
|
32
|
-
<box style={{ backgroundColor: theme.surfaceAlt, height: 3 }}>
|
|
33
|
-
<textarea
|
|
34
|
-
ref={textareaRef}
|
|
35
|
-
initialValue={initialValue}
|
|
36
|
-
onContentChange={onContentChange}
|
|
37
|
-
focused
|
|
38
|
-
/>
|
|
39
|
-
</box>
|
|
40
|
-
</Modal>
|
|
41
|
-
)
|
|
42
|
-
}
|
package/src/ui/SearchInput.tsx
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { TextareaRenderable } from '@opentui/core'
|
|
2
|
-
import { useTheme } from '../styles/theme'
|
|
3
|
-
import { AppMode } from '../types'
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
appMode: AppMode
|
|
7
|
-
searchQuery: string
|
|
8
|
-
textareaRef: { current: TextareaRenderable | null }
|
|
9
|
-
onContentChange: () => void
|
|
10
|
-
prefixActive?: boolean
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default function SearchInput({
|
|
14
|
-
appMode,
|
|
15
|
-
searchQuery,
|
|
16
|
-
textareaRef,
|
|
17
|
-
onContentChange,
|
|
18
|
-
prefixActive = false,
|
|
19
|
-
}: Props) {
|
|
20
|
-
const theme = useTheme()
|
|
21
|
-
const placeholder =
|
|
22
|
-
appMode === AppMode.NewSession
|
|
23
|
-
? 'Type project name, GitHub URL, or custom session name...'
|
|
24
|
-
: 'Type to search...'
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<box
|
|
28
|
-
style={{
|
|
29
|
-
marginBottom: 1,
|
|
30
|
-
height: 3,
|
|
31
|
-
backgroundColor: prefixActive ? theme.surfaceAlt : theme.surface,
|
|
32
|
-
}}
|
|
33
|
-
>
|
|
34
|
-
<textarea
|
|
35
|
-
ref={textareaRef}
|
|
36
|
-
placeholder={placeholder}
|
|
37
|
-
initialValue={searchQuery}
|
|
38
|
-
onContentChange={onContentChange}
|
|
39
|
-
focused={!prefixActive}
|
|
40
|
-
/>
|
|
41
|
-
</box>
|
|
42
|
-
)
|
|
43
|
-
}
|