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/app/modal-state.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { TextareaRenderable } from '@opentui/core'
|
|
2
|
-
import { useRef, useState } from 'react'
|
|
3
|
-
import type { ModalState } from './modals'
|
|
4
|
-
|
|
5
|
-
export function useAppModalState() {
|
|
6
|
-
const [modalState, setModalState] = useState<ModalState>(null)
|
|
7
|
-
const [modalInputValue, setModalInputValue] = useState('')
|
|
8
|
-
const [commandsCursor, setCommandsCursor] = useState(0)
|
|
9
|
-
const [commandsSearchQuery, setCommandsSearchQuery] = useState('')
|
|
10
|
-
const [settingsCursor, setSettingsCursor] = useState(0)
|
|
11
|
-
const [settingsSearchQuery, setSettingsSearchQuery] = useState('')
|
|
12
|
-
const [settingOptionsCursor, setSettingOptionsCursor] = useState(0)
|
|
13
|
-
const [settingOptionsSearchQuery, setSettingOptionsSearchQuery] = useState('')
|
|
14
|
-
const [settingEditorValue, setSettingEditorValue] = useState('')
|
|
15
|
-
const [settingEditorError, setSettingEditorError] = useState('')
|
|
16
|
-
const [themePreviewId, setThemePreviewId] = useState<string | null>(null)
|
|
17
|
-
|
|
18
|
-
const modalTextareaRef = useRef<TextareaRenderable | null>(null)
|
|
19
|
-
const commandsSearchTextareaRef = useRef<TextareaRenderable | null>(null)
|
|
20
|
-
const settingsSearchTextareaRef = useRef<TextareaRenderable | null>(null)
|
|
21
|
-
const settingOptionsSearchTextareaRef = useRef<TextareaRenderable | null>(null)
|
|
22
|
-
const settingEditorTextareaRef = useRef<TextareaRenderable | null>(null)
|
|
23
|
-
|
|
24
|
-
return {
|
|
25
|
-
modalState,
|
|
26
|
-
setModalState,
|
|
27
|
-
modalInputValue,
|
|
28
|
-
setModalInputValue,
|
|
29
|
-
commandsCursor,
|
|
30
|
-
setCommandsCursor,
|
|
31
|
-
commandsSearchQuery,
|
|
32
|
-
setCommandsSearchQuery,
|
|
33
|
-
settingsCursor,
|
|
34
|
-
setSettingsCursor,
|
|
35
|
-
settingsSearchQuery,
|
|
36
|
-
setSettingsSearchQuery,
|
|
37
|
-
settingOptionsCursor,
|
|
38
|
-
setSettingOptionsCursor,
|
|
39
|
-
settingOptionsSearchQuery,
|
|
40
|
-
setSettingOptionsSearchQuery,
|
|
41
|
-
settingEditorValue,
|
|
42
|
-
setSettingEditorValue,
|
|
43
|
-
settingEditorError,
|
|
44
|
-
setSettingEditorError,
|
|
45
|
-
themePreviewId,
|
|
46
|
-
setThemePreviewId,
|
|
47
|
-
modalTextareaRef,
|
|
48
|
-
commandsSearchTextareaRef,
|
|
49
|
-
settingsSearchTextareaRef,
|
|
50
|
-
settingOptionsSearchTextareaRef,
|
|
51
|
-
settingEditorTextareaRef,
|
|
52
|
-
}
|
|
53
|
-
}
|
package/src/app/modals-layer.tsx
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import type { TextareaRenderable } from '@opentui/core'
|
|
2
|
-
import type { Dispatch, MutableRefObject, SetStateAction } from 'react'
|
|
3
|
-
import type { SettingsEntry, SettingsOption, SettingsFieldId } from '../settings'
|
|
4
|
-
import type { CommandEntry } from '../ui/CommandsModal'
|
|
5
|
-
import type { ModalState } from './modals'
|
|
6
|
-
import { syncTextareaValue } from './textarea'
|
|
7
|
-
import CommandsModal from '../ui/CommandsModal'
|
|
8
|
-
import RenameModal from '../ui/RenameModal'
|
|
9
|
-
import SettingEditorModal from '../ui/SettingEditorModal'
|
|
10
|
-
import SettingOptionsModal from '../ui/SettingOptionsModal'
|
|
11
|
-
import SettingsModal from '../ui/SettingsModal'
|
|
12
|
-
|
|
13
|
-
interface Props {
|
|
14
|
-
modalState: ModalState
|
|
15
|
-
columns: number
|
|
16
|
-
rows: number
|
|
17
|
-
configPath: string
|
|
18
|
-
themeId: string
|
|
19
|
-
themeName: string
|
|
20
|
-
colorMode: string
|
|
21
|
-
filteredCommandEntries: CommandEntry[]
|
|
22
|
-
commandsCursor: number
|
|
23
|
-
commandsSearchQuery: string
|
|
24
|
-
setCommandsCursor: Dispatch<SetStateAction<number>>
|
|
25
|
-
setCommandsSearchQuery: Dispatch<SetStateAction<string>>
|
|
26
|
-
filteredSettingsEntries: SettingsEntry[]
|
|
27
|
-
settingsCursor: number
|
|
28
|
-
settingsSearchQuery: string
|
|
29
|
-
setSettingsCursor: Dispatch<SetStateAction<number>>
|
|
30
|
-
setSettingsSearchQuery: Dispatch<SetStateAction<string>>
|
|
31
|
-
filteredSettingOptions: SettingsOption[]
|
|
32
|
-
settingOptionsCursor: number
|
|
33
|
-
settingOptionsSearchQuery: string
|
|
34
|
-
setSettingOptionsCursor: Dispatch<SetStateAction<number>>
|
|
35
|
-
setSettingOptionsSearchQuery: Dispatch<SetStateAction<string>>
|
|
36
|
-
settingEditorValue: string
|
|
37
|
-
settingEditorError: string
|
|
38
|
-
setSettingEditorValue: Dispatch<SetStateAction<string>>
|
|
39
|
-
modalInputValue: string
|
|
40
|
-
setModalInputValue: Dispatch<SetStateAction<string>>
|
|
41
|
-
commandsSearchTextareaRef: MutableRefObject<TextareaRenderable | null>
|
|
42
|
-
settingsSearchTextareaRef: MutableRefObject<TextareaRenderable | null>
|
|
43
|
-
settingOptionsSearchTextareaRef: MutableRefObject<TextareaRenderable | null>
|
|
44
|
-
settingEditorTextareaRef: MutableRefObject<TextareaRenderable | null>
|
|
45
|
-
modalTextareaRef: MutableRefObject<TextareaRenderable | null>
|
|
46
|
-
getSettingEditorTitle: (field: SettingsFieldId) => string
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export function AppModalsLayer({
|
|
50
|
-
modalState,
|
|
51
|
-
columns,
|
|
52
|
-
rows,
|
|
53
|
-
configPath,
|
|
54
|
-
themeId,
|
|
55
|
-
themeName,
|
|
56
|
-
colorMode,
|
|
57
|
-
filteredCommandEntries,
|
|
58
|
-
commandsCursor,
|
|
59
|
-
commandsSearchQuery,
|
|
60
|
-
setCommandsCursor,
|
|
61
|
-
setCommandsSearchQuery,
|
|
62
|
-
filteredSettingsEntries,
|
|
63
|
-
settingsCursor,
|
|
64
|
-
settingsSearchQuery,
|
|
65
|
-
setSettingsCursor,
|
|
66
|
-
setSettingsSearchQuery,
|
|
67
|
-
filteredSettingOptions,
|
|
68
|
-
settingOptionsCursor,
|
|
69
|
-
settingOptionsSearchQuery,
|
|
70
|
-
setSettingOptionsCursor,
|
|
71
|
-
setSettingOptionsSearchQuery,
|
|
72
|
-
settingEditorValue,
|
|
73
|
-
settingEditorError,
|
|
74
|
-
setSettingEditorValue,
|
|
75
|
-
modalInputValue,
|
|
76
|
-
setModalInputValue,
|
|
77
|
-
commandsSearchTextareaRef,
|
|
78
|
-
settingsSearchTextareaRef,
|
|
79
|
-
settingOptionsSearchTextareaRef,
|
|
80
|
-
settingEditorTextareaRef,
|
|
81
|
-
modalTextareaRef,
|
|
82
|
-
getSettingEditorTitle,
|
|
83
|
-
}: Props) {
|
|
84
|
-
return (
|
|
85
|
-
<>
|
|
86
|
-
{modalState?.type === 'rename' && (
|
|
87
|
-
<RenameModal
|
|
88
|
-
target={modalState.target}
|
|
89
|
-
initialValue={modalInputValue}
|
|
90
|
-
columns={columns}
|
|
91
|
-
textareaRef={modalTextareaRef}
|
|
92
|
-
onContentChange={() => syncTextareaValue(modalTextareaRef, setModalInputValue)}
|
|
93
|
-
/>
|
|
94
|
-
)}
|
|
95
|
-
|
|
96
|
-
{modalState?.type === 'commands' && (
|
|
97
|
-
<CommandsModal
|
|
98
|
-
columns={columns}
|
|
99
|
-
themeId={themeId}
|
|
100
|
-
entries={filteredCommandEntries}
|
|
101
|
-
cursor={commandsCursor}
|
|
102
|
-
searchQuery={commandsSearchQuery}
|
|
103
|
-
textareaRef={commandsSearchTextareaRef}
|
|
104
|
-
onContentChange={() =>
|
|
105
|
-
syncTextareaValue(commandsSearchTextareaRef, setCommandsSearchQuery, setCommandsCursor)
|
|
106
|
-
}
|
|
107
|
-
/>
|
|
108
|
-
)}
|
|
109
|
-
|
|
110
|
-
{modalState?.type === 'settings' && (
|
|
111
|
-
<SettingsModal
|
|
112
|
-
configPath={configPath}
|
|
113
|
-
themeName={themeName}
|
|
114
|
-
colorMode={colorMode}
|
|
115
|
-
columns={columns}
|
|
116
|
-
entries={filteredSettingsEntries}
|
|
117
|
-
cursor={settingsCursor}
|
|
118
|
-
searchQuery={settingsSearchQuery}
|
|
119
|
-
textareaRef={settingsSearchTextareaRef}
|
|
120
|
-
onContentChange={() =>
|
|
121
|
-
syncTextareaValue(settingsSearchTextareaRef, setSettingsSearchQuery, setSettingsCursor)
|
|
122
|
-
}
|
|
123
|
-
/>
|
|
124
|
-
)}
|
|
125
|
-
|
|
126
|
-
{modalState?.type === 'setting-options' && (
|
|
127
|
-
<SettingOptionsModal
|
|
128
|
-
title={getSettingEditorTitle(modalState.field)}
|
|
129
|
-
description="Select an option to apply it immediately"
|
|
130
|
-
columns={columns}
|
|
131
|
-
options={filteredSettingOptions}
|
|
132
|
-
cursor={settingOptionsCursor}
|
|
133
|
-
searchQuery={settingOptionsSearchQuery}
|
|
134
|
-
textareaRef={settingOptionsSearchTextareaRef}
|
|
135
|
-
onContentChange={() =>
|
|
136
|
-
syncTextareaValue(
|
|
137
|
-
settingOptionsSearchTextareaRef,
|
|
138
|
-
setSettingOptionsSearchQuery,
|
|
139
|
-
setSettingOptionsCursor
|
|
140
|
-
)
|
|
141
|
-
}
|
|
142
|
-
/>
|
|
143
|
-
)}
|
|
144
|
-
|
|
145
|
-
{modalState?.type === 'setting-editor' && (
|
|
146
|
-
<SettingEditorModal
|
|
147
|
-
title={getSettingEditorTitle(modalState.field)}
|
|
148
|
-
description="Edit value and press Enter to apply immediately"
|
|
149
|
-
value={settingEditorValue}
|
|
150
|
-
error={settingEditorError}
|
|
151
|
-
columns={columns}
|
|
152
|
-
rows={rows}
|
|
153
|
-
textareaRef={settingEditorTextareaRef}
|
|
154
|
-
onContentChange={() => syncTextareaValue(settingEditorTextareaRef, setSettingEditorValue)}
|
|
155
|
-
/>
|
|
156
|
-
)}
|
|
157
|
-
</>
|
|
158
|
-
)
|
|
159
|
-
}
|
package/src/app/modals.ts
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import type { Dispatch, SetStateAction } from 'react'
|
|
2
|
-
import { getSettingEditorValue, type SettingsFieldId } from '../settings'
|
|
3
|
-
import type { Config, Item } from '../types'
|
|
4
|
-
|
|
5
|
-
export type ModalState =
|
|
6
|
-
| { type: 'rename'; target: string }
|
|
7
|
-
| { type: 'commands' }
|
|
8
|
-
| { type: 'settings' }
|
|
9
|
-
| { type: 'setting-options'; field: SettingsFieldId; openedFrom?: 'commands' | 'settings' }
|
|
10
|
-
| { type: 'setting-editor'; field: SettingsFieldId }
|
|
11
|
-
| null
|
|
12
|
-
|
|
13
|
-
interface ModalSetters {
|
|
14
|
-
setModalState: Dispatch<SetStateAction<ModalState>>
|
|
15
|
-
setModalInputValue: Dispatch<SetStateAction<string>>
|
|
16
|
-
setCommandsSearchQuery: Dispatch<SetStateAction<string>>
|
|
17
|
-
setCommandsCursor: Dispatch<SetStateAction<number>>
|
|
18
|
-
setSettingsSearchQuery: Dispatch<SetStateAction<string>>
|
|
19
|
-
setSettingsCursor: Dispatch<SetStateAction<number>>
|
|
20
|
-
setSettingOptionsSearchQuery: Dispatch<SetStateAction<string>>
|
|
21
|
-
setSettingOptionsCursor: Dispatch<SetStateAction<number>>
|
|
22
|
-
setSettingEditorValue: Dispatch<SetStateAction<string>>
|
|
23
|
-
setSettingEditorError: Dispatch<SetStateAction<string>>
|
|
24
|
-
setRenameTarget: Dispatch<SetStateAction<Item | null>>
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function openRenameModal(
|
|
28
|
-
item: Item,
|
|
29
|
-
clearPendingKill: () => void,
|
|
30
|
-
setRenameTarget: Dispatch<SetStateAction<Item | null>>,
|
|
31
|
-
setModalInputValue: Dispatch<SetStateAction<string>>,
|
|
32
|
-
setModalState: Dispatch<SetStateAction<ModalState>>
|
|
33
|
-
) {
|
|
34
|
-
clearPendingKill()
|
|
35
|
-
setRenameTarget(item)
|
|
36
|
-
setModalInputValue(item.title)
|
|
37
|
-
setModalState({ type: 'rename', target: item.title })
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function openCommandsModal(
|
|
41
|
-
clearPendingKill: () => void,
|
|
42
|
-
setCommandsSearchQuery: Dispatch<SetStateAction<string>>,
|
|
43
|
-
setCommandsCursor: Dispatch<SetStateAction<number>>,
|
|
44
|
-
setModalState: Dispatch<SetStateAction<ModalState>>
|
|
45
|
-
) {
|
|
46
|
-
clearPendingKill()
|
|
47
|
-
setCommandsSearchQuery('')
|
|
48
|
-
setCommandsCursor(0)
|
|
49
|
-
setModalState({ type: 'commands' })
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export function openSettingsModal(
|
|
53
|
-
config: Config | null,
|
|
54
|
-
clearPendingKill: () => void,
|
|
55
|
-
setSettingEditorError: Dispatch<SetStateAction<string>>,
|
|
56
|
-
setSettingsSearchQuery: Dispatch<SetStateAction<string>>,
|
|
57
|
-
setSettingsCursor: Dispatch<SetStateAction<number>>,
|
|
58
|
-
setModalState: Dispatch<SetStateAction<ModalState>>
|
|
59
|
-
) {
|
|
60
|
-
if (!config) {
|
|
61
|
-
return
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
clearPendingKill()
|
|
65
|
-
setSettingEditorError('')
|
|
66
|
-
setSettingsSearchQuery('')
|
|
67
|
-
setSettingsCursor(0)
|
|
68
|
-
setModalState({ type: 'settings' })
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export function openSettingOptions(
|
|
72
|
-
field: SettingsFieldId,
|
|
73
|
-
setSettingOptionsSearchQuery: Dispatch<SetStateAction<string>>,
|
|
74
|
-
setSettingOptionsCursor: Dispatch<SetStateAction<number>>,
|
|
75
|
-
setModalState: Dispatch<SetStateAction<ModalState>>
|
|
76
|
-
) {
|
|
77
|
-
setSettingOptionsSearchQuery('')
|
|
78
|
-
setSettingOptionsCursor(0)
|
|
79
|
-
setModalState({ type: 'setting-options', field })
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export function openSettingEditor(
|
|
83
|
-
config: Config | null,
|
|
84
|
-
field: SettingsFieldId,
|
|
85
|
-
setSettingEditorError: Dispatch<SetStateAction<string>>,
|
|
86
|
-
setSettingEditorValue: Dispatch<SetStateAction<string>>,
|
|
87
|
-
setModalState: Dispatch<SetStateAction<ModalState>>
|
|
88
|
-
) {
|
|
89
|
-
if (!config) {
|
|
90
|
-
return
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
setSettingEditorError('')
|
|
94
|
-
setSettingEditorValue(getSettingEditorValue(config, field))
|
|
95
|
-
setModalState({ type: 'setting-editor', field })
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export function closeModal(setters: ModalSetters) {
|
|
99
|
-
setters.setModalState(null)
|
|
100
|
-
setters.setModalInputValue('')
|
|
101
|
-
setters.setCommandsSearchQuery('')
|
|
102
|
-
setters.setCommandsCursor(0)
|
|
103
|
-
setters.setSettingsSearchQuery('')
|
|
104
|
-
setters.setSettingOptionsSearchQuery('')
|
|
105
|
-
setters.setSettingEditorValue('')
|
|
106
|
-
setters.setSettingEditorError('')
|
|
107
|
-
setters.setRenameTarget(null)
|
|
108
|
-
}
|
package/src/app/notifications.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export function showTemporaryMessage(
|
|
2
|
-
setMessage: (message: string) => void,
|
|
3
|
-
message: string,
|
|
4
|
-
timeout = 2000
|
|
5
|
-
) {
|
|
6
|
-
setMessage(message)
|
|
7
|
-
setTimeout(() => setMessage(''), timeout)
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function showTemporaryToast(
|
|
11
|
-
setToastMessage: (message: string) => void,
|
|
12
|
-
setToastVisible: (visible: boolean) => void,
|
|
13
|
-
message: string,
|
|
14
|
-
timeout = 5000
|
|
15
|
-
) {
|
|
16
|
-
setToastMessage(message)
|
|
17
|
-
setToastVisible(true)
|
|
18
|
-
setTimeout(() => {
|
|
19
|
-
setToastVisible(false)
|
|
20
|
-
}, timeout)
|
|
21
|
-
}
|
package/src/app/opencode.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { Dispatch, SetStateAction } from 'react'
|
|
2
|
-
import type { Item, OpencodeSessionStats, OpencodeStatsState } from '../types'
|
|
3
|
-
|
|
4
|
-
export function applyOpencodeState(
|
|
5
|
-
sessionName: string,
|
|
6
|
-
nextState: OpencodeStatsState,
|
|
7
|
-
setSessionItems: Dispatch<SetStateAction<Item[]>>,
|
|
8
|
-
setAllItems: Dispatch<SetStateAction<Item[]>>,
|
|
9
|
-
setItems: Dispatch<SetStateAction<Item[]>>
|
|
10
|
-
) {
|
|
11
|
-
const applyState = (existingItems: Item[]) =>
|
|
12
|
-
existingItems.map(item =>
|
|
13
|
-
item.title === sessionName ? { ...item, opencodeState: nextState } : item
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
setSessionItems(applyState)
|
|
17
|
-
setAllItems(applyState)
|
|
18
|
-
setItems(applyState)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export async function loadOpencodeSessionStats(
|
|
22
|
-
sessionName: string,
|
|
23
|
-
getStats: (sessionName: string) => Promise<OpencodeSessionStats | null>,
|
|
24
|
-
updateState: (sessionName: string, nextState: OpencodeStatsState) => void,
|
|
25
|
-
showMessage: (message: string, timeout?: number) => void
|
|
26
|
-
) {
|
|
27
|
-
updateState(sessionName, { status: 'loading' })
|
|
28
|
-
|
|
29
|
-
try {
|
|
30
|
-
const stats = await getStats(sessionName)
|
|
31
|
-
|
|
32
|
-
if (stats) {
|
|
33
|
-
updateState(sessionName, { status: 'ready', stats })
|
|
34
|
-
return stats
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
updateState(sessionName, {
|
|
38
|
-
status: 'missing',
|
|
39
|
-
message: `No OpenCode stats found for '${sessionName}'`,
|
|
40
|
-
})
|
|
41
|
-
return null
|
|
42
|
-
} catch (error) {
|
|
43
|
-
const errorMessage =
|
|
44
|
-
error instanceof Error ? error.message : `Failed to load stats for '${sessionName}'`
|
|
45
|
-
updateState(sessionName, { status: 'error', message: errorMessage })
|
|
46
|
-
showMessage(errorMessage, 4000)
|
|
47
|
-
return null
|
|
48
|
-
}
|
|
49
|
-
}
|
package/src/app/operations.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { Config, ViewMode } from '../types'
|
|
2
|
-
|
|
3
|
-
type ShowMessage = (message: string, timeout?: number) => void
|
|
4
|
-
type RefreshItems = (forceViewMode?: ViewMode, nextConfig?: Config) => Promise<void>
|
|
5
|
-
|
|
6
|
-
export async function runWithErrorMessage(
|
|
7
|
-
operation: () => Promise<void>,
|
|
8
|
-
fallbackMessage: string,
|
|
9
|
-
showMessage: ShowMessage
|
|
10
|
-
): Promise<void> {
|
|
11
|
-
try {
|
|
12
|
-
await operation()
|
|
13
|
-
} catch (error) {
|
|
14
|
-
const errorMessage = error instanceof Error ? error.message : fallbackMessage
|
|
15
|
-
showMessage(errorMessage, 3000)
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export async function persistConfigUpdate(
|
|
20
|
-
nextConfig: Config,
|
|
21
|
-
successMessage: string,
|
|
22
|
-
saveConfig: (config: Config) => Promise<void>,
|
|
23
|
-
setConfig: (config: Config) => void,
|
|
24
|
-
refreshItems: RefreshItems,
|
|
25
|
-
showMessage: ShowMessage
|
|
26
|
-
): Promise<void> {
|
|
27
|
-
await saveConfig(nextConfig)
|
|
28
|
-
setConfig(nextConfig)
|
|
29
|
-
await refreshItems(undefined, nextConfig)
|
|
30
|
-
showMessage(successMessage)
|
|
31
|
-
}
|
package/src/app/runtime.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import type { Dispatch, MutableRefObject, SetStateAction } from 'react'
|
|
2
|
-
import { showTemporaryMessage } from './notifications'
|
|
3
|
-
import { applyOpencodeState, loadOpencodeSessionStats } from './opencode'
|
|
4
|
-
import { applyRefreshedViewState, loadRefreshedViewState } from './state'
|
|
5
|
-
import type { Measure } from './data'
|
|
6
|
-
import type { Config, Item, OpencodeSessionStats, OpencodeStatsState, ViewMode } from '../types'
|
|
7
|
-
import type { MultiplexerBackend } from '../multiplexer'
|
|
8
|
-
|
|
9
|
-
interface AppRuntimeOptions {
|
|
10
|
-
config: Config | null
|
|
11
|
-
backend: MultiplexerBackend | null
|
|
12
|
-
viewMode: ViewMode
|
|
13
|
-
measure: Measure
|
|
14
|
-
lastSessionSelectionRef: MutableRefObject<string | null>
|
|
15
|
-
lastProjectSelectionRef: MutableRefObject<string | null>
|
|
16
|
-
setSessionItems: Dispatch<SetStateAction<Item[]>>
|
|
17
|
-
setProjectSourceItems: Dispatch<SetStateAction<Item[]>>
|
|
18
|
-
setAllItems: Dispatch<SetStateAction<Item[]>>
|
|
19
|
-
setItems: Dispatch<SetStateAction<Item[]>>
|
|
20
|
-
setCursor: Dispatch<SetStateAction<number>>
|
|
21
|
-
setMessage: Dispatch<SetStateAction<string>>
|
|
22
|
-
getOpencodeSessionStats: (sessionName: string) => Promise<OpencodeSessionStats | null>
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function createAppRuntime(options: AppRuntimeOptions) {
|
|
26
|
-
function showMessage(message: string, timeout = 2000) {
|
|
27
|
-
showTemporaryMessage(options.setMessage, message, timeout)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function updateOpencodeState(sessionName: string, nextState: OpencodeStatsState) {
|
|
31
|
-
applyOpencodeState(
|
|
32
|
-
sessionName,
|
|
33
|
-
nextState,
|
|
34
|
-
options.setSessionItems,
|
|
35
|
-
options.setAllItems,
|
|
36
|
-
options.setItems
|
|
37
|
-
)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
async function refreshItems(forceViewMode?: ViewMode, nextConfig = options.config) {
|
|
41
|
-
if (!nextConfig || !options.backend) {
|
|
42
|
-
return
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const targetMode = forceViewMode ?? options.viewMode
|
|
46
|
-
const refreshedState = await loadRefreshedViewState(
|
|
47
|
-
targetMode,
|
|
48
|
-
nextConfig,
|
|
49
|
-
options.measure,
|
|
50
|
-
options.backend,
|
|
51
|
-
options.lastSessionSelectionRef.current,
|
|
52
|
-
options.lastProjectSelectionRef.current
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
applyRefreshedViewState(
|
|
56
|
-
refreshedState,
|
|
57
|
-
options.setSessionItems,
|
|
58
|
-
options.setProjectSourceItems,
|
|
59
|
-
options.setAllItems,
|
|
60
|
-
options.setItems,
|
|
61
|
-
options.setCursor
|
|
62
|
-
)
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
async function loadOpencodeStatsForSession(sessionName: string) {
|
|
66
|
-
return loadOpencodeSessionStats(
|
|
67
|
-
sessionName,
|
|
68
|
-
options.getOpencodeSessionStats,
|
|
69
|
-
updateOpencodeState,
|
|
70
|
-
showMessage
|
|
71
|
-
)
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return {
|
|
75
|
-
showMessage,
|
|
76
|
-
refreshItems,
|
|
77
|
-
loadOpencodeStatsForSession,
|
|
78
|
-
}
|
|
79
|
-
}
|