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.
Files changed (124) hide show
  1. package/README.md +133 -86
  2. package/bin/mux-sesh +45 -17
  3. package/bin/platform.sh +139 -0
  4. package/bin/postinstall +22 -0
  5. package/package.json +27 -38
  6. package/src/agents/index.ts +0 -1
  7. package/src/agents/session-name.ts +0 -24
  8. package/src/app/commands.ts +0 -138
  9. package/src/app/controller.ts +0 -437
  10. package/src/app/controls.ts +0 -123
  11. package/src/app/core-state.ts +0 -75
  12. package/src/app/data.ts +0 -130
  13. package/src/app/derived.ts +0 -77
  14. package/src/app/effects.ts +0 -650
  15. package/src/app/handlers.ts +0 -406
  16. package/src/app/keyboard.ts +0 -165
  17. package/src/app/modal-keyboard.ts +0 -137
  18. package/src/app/modal-state.ts +0 -53
  19. package/src/app/modals-layer.tsx +0 -159
  20. package/src/app/modals.ts +0 -108
  21. package/src/app/notifications.ts +0 -21
  22. package/src/app/opencode.ts +0 -49
  23. package/src/app/operations.ts +0 -31
  24. package/src/app/runtime.ts +0 -79
  25. package/src/app/screen.tsx +0 -240
  26. package/src/app/state.ts +0 -178
  27. package/src/app/textarea.ts +0 -16
  28. package/src/app/view.ts +0 -101
  29. package/src/app.tsx +0 -50
  30. package/src/config/index.ts +0 -475
  31. package/src/config/listed-sessions.ts +0 -33
  32. package/src/config/paths.ts +0 -13
  33. package/src/config/session-rules.ts +0 -100
  34. package/src/config/store.ts +0 -33
  35. package/src/files/target.ts +0 -96
  36. package/src/handlers/action-helpers.ts +0 -83
  37. package/src/handlers/actions.ts +0 -216
  38. package/src/handlers/keyboard/agents.ts +0 -134
  39. package/src/handlers/keyboard/index.ts +0 -5
  40. package/src/handlers/keyboard/new-session.ts +0 -58
  41. package/src/handlers/keyboard/normal.ts +0 -220
  42. package/src/handlers/keyboard/search.ts +0 -118
  43. package/src/handlers/keyboard/shared.ts +0 -117
  44. package/src/herdr/backend.ts +0 -357
  45. package/src/herdr/protocol.ts +0 -268
  46. package/src/index.tsx +0 -23
  47. package/src/items/order.ts +0 -95
  48. package/src/multiplexer/backend.ts +0 -43
  49. package/src/multiplexer/command.ts +0 -48
  50. package/src/multiplexer/index.ts +0 -21
  51. package/src/multiplexer/items.ts +0 -66
  52. package/src/multiplexer/resolve.ts +0 -109
  53. package/src/multiplexer/tmux-backend.ts +0 -87
  54. package/src/multiplexer/types.ts +0 -93
  55. package/src/opencode/constants.ts +0 -7
  56. package/src/opencode/index.ts +0 -20
  57. package/src/opencode/parser.ts +0 -45
  58. package/src/opencode/session-name.ts +0 -13
  59. package/src/opencode/session.ts +0 -146
  60. package/src/opencode/sqlite.ts +0 -447
  61. package/src/opencode/stats.ts +0 -26
  62. package/src/opencode/tokens.ts +0 -116
  63. package/src/opencode/types.ts +0 -33
  64. package/src/preview/project.ts +0 -362
  65. package/src/projects/session-links.ts +0 -52
  66. package/src/search/fff.ts +0 -224
  67. package/src/search/index.ts +0 -198
  68. package/src/settings.ts +0 -465
  69. package/src/styles/omarchy.ts +0 -295
  70. package/src/styles/opencode-themes-a.ts +0 -1442
  71. package/src/styles/opencode-themes-b.ts +0 -1212
  72. package/src/styles/opencode-tui-colors.ts +0 -1784
  73. package/src/styles/terminal-palette.ts +0 -156
  74. package/src/styles/theme-follow.ts +0 -94
  75. package/src/styles/theme.tsx +0 -311
  76. package/src/tmux/actions.ts +0 -145
  77. package/src/tmux/details.ts +0 -104
  78. package/src/tmux/helpers.ts +0 -35
  79. package/src/tmux/index.ts +0 -10
  80. package/src/tmux/list.ts +0 -31
  81. package/src/tmux/project-discovery.ts +0 -116
  82. package/src/tmux/project-loader.ts +0 -92
  83. package/src/tmux/project-zoxide.ts +0 -128
  84. package/src/tmux/projects.ts +0 -38
  85. package/src/tmux/workflows.ts +0 -26
  86. package/src/types/index.ts +0 -221
  87. package/src/ui/AgentSessionGroup.tsx +0 -93
  88. package/src/ui/CommandsModal.tsx +0 -246
  89. package/src/ui/ErrorScreen.tsx +0 -102
  90. package/src/ui/HighlightedText.tsx +0 -60
  91. package/src/ui/ItemList.tsx +0 -119
  92. package/src/ui/Modal.tsx +0 -48
  93. package/src/ui/OpencodeStatsPanel.tsx +0 -233
  94. package/src/ui/RenameModal.tsx +0 -42
  95. package/src/ui/SearchInput.tsx +0 -43
  96. package/src/ui/SessionDetailsPanel.tsx +0 -273
  97. package/src/ui/SessionList.tsx +0 -119
  98. package/src/ui/SettingEditorModal.tsx +0 -55
  99. package/src/ui/SettingOptionsModal.tsx +0 -95
  100. package/src/ui/SettingsModal.tsx +0 -102
  101. package/src/ui/Toast.tsx +0 -34
  102. package/src/ui/VersionBadge.tsx +0 -45
  103. package/src/ui/item-icon.ts +0 -110
  104. package/src/ui/list-window.ts +0 -35
  105. package/src/ui/session-meta.ts +0 -10
  106. package/src/ui/text-columns.ts +0 -17
  107. package/src/ui/use-textarea-focus.ts +0 -29
  108. package/src/update/events.ts +0 -28
  109. package/src/update/index.ts +0 -91
  110. package/src/update/installation.ts +0 -161
  111. package/src/update/version.ts +0 -33
  112. package/src/util/ansi.ts +0 -3
  113. package/src/util/browser.ts +0 -37
  114. package/src/util/clipboard.ts +0 -22
  115. package/src/util/errors.ts +0 -170
  116. package/src/util/github.ts +0 -100
  117. package/src/util/glob.ts +0 -51
  118. package/src/util/path-display.ts +0 -98
  119. package/src/util/perf.ts +0 -23
  120. package/src/util/shell.ts +0 -3
  121. package/src/util/shutdown.ts +0 -111
  122. package/src/util/terminal.ts +0 -28
  123. package/src/util/time.ts +0 -48
  124. package/tsconfig.json +0 -25
@@ -1,240 +0,0 @@
1
- import type { TextareaRenderable } from '@opentui/core'
2
- import type { Dispatch, MutableRefObject, SetStateAction } from 'react'
3
- import {
4
- getAppTitle,
5
- getEmptyStateMessage,
6
- getFooterHint,
7
- getListStyle,
8
- getStatusLabel,
9
- } from './view'
10
- import { syncTextareaValue } from './textarea'
11
- import { isOpencodeSessionItem } from '../opencode/session-name'
12
- import { AppMode, ViewMode, type Config, type Item, type ThemeColors } from '../types'
13
- import { isGitHubURL } from '../util/github'
14
- import { shouldShowDetailPanel } from '../util/terminal'
15
- import SearchInput from '../ui/SearchInput'
16
- import SessionList from '../ui/SessionList'
17
- import AgentSessionGroup from '../ui/AgentSessionGroup'
18
- import ItemList from '../ui/ItemList'
19
- import OpencodeStatsPanel from '../ui/OpencodeStatsPanel'
20
- import SessionDetailsPanel from '../ui/SessionDetailsPanel'
21
- import Toast from '../ui/Toast'
22
- import VersionBadge, { formatVersionBadge } from '../ui/VersionBadge'
23
- import { CURRENT_VERSION } from '../update/version'
24
- import type { MultiplexerBackend } from '../multiplexer'
25
-
26
- interface Props {
27
- theme: ThemeColors
28
- appMode: AppMode
29
- viewMode: ViewMode
30
- config: Config | null
31
- backend: MultiplexerBackend | null
32
- items: Item[]
33
- regularSessions: Item[]
34
- agentSessions: Item[]
35
- selectedPrimaryItem?: Item
36
- cursor: number
37
- agentCursor: number
38
- searchQuery: string
39
- prefixActive: boolean
40
- pendingKillSessionName: string | null
41
- projectCount: number
42
- sessionItems: Item[]
43
- rows: number
44
- columns: number
45
- textareaRef: MutableRefObject<TextareaRenderable | null>
46
- setSearchQuery: Dispatch<SetStateAction<string>>
47
- message: string
48
- toastMessage: string
49
- toastVisible: boolean
50
- updatedVersion: string | null
51
- }
52
-
53
- export function AppScreen({
54
- theme,
55
- appMode,
56
- viewMode,
57
- config,
58
- backend,
59
- items,
60
- regularSessions,
61
- agentSessions,
62
- selectedPrimaryItem,
63
- cursor,
64
- agentCursor,
65
- searchQuery,
66
- prefixActive,
67
- pendingKillSessionName,
68
- projectCount,
69
- sessionItems,
70
- rows,
71
- columns,
72
- textareaRef,
73
- setSearchQuery,
74
- message,
75
- toastMessage,
76
- toastVisible,
77
- updatedVersion,
78
- }: Props) {
79
- const title = getAppTitle(appMode, viewMode, backend?.kind)
80
- const listStyle = getListStyle(theme, appMode)
81
- const totalSessions = sessionItems.filter(item => item.isSession).length
82
- const activeSessions = items.filter(item => item.isSession && item.isAttached).length
83
- const maxVisibleItems = Math.max(8, rows - (appMode === AppMode.NewSession ? 10 : 12))
84
- const versionLabel = formatVersionBadge(
85
- CURRENT_VERSION,
86
- updatedVersion,
87
- process.env.MUX_SESH_DEV === '1'
88
- )
89
- const selectedAgentSession = agentSessions[agentCursor]
90
- const showOpencodeStats =
91
- viewMode === ViewMode.Sessions &&
92
- appMode === AppMode.AgentsManage &&
93
- selectedAgentSession !== undefined &&
94
- isOpencodeSessionItem(selectedAgentSession)
95
- const footerHint = getFooterHint(appMode, config?.prefixKey, selectedPrimaryItem)
96
-
97
- return (
98
- <>
99
- <box
100
- style={{
101
- flexDirection: 'column',
102
- width: '100%',
103
- height: '100%',
104
- gap: 1,
105
- backgroundColor: theme.background,
106
- }}
107
- >
108
- <box
109
- style={{
110
- flexDirection: 'row',
111
- alignItems: 'stretch',
112
- justifyContent: 'center',
113
- width: '100%',
114
- flexGrow: 1,
115
- flexShrink: 1,
116
- gap: 1,
117
- }}
118
- >
119
- <box style={listStyle}>
120
- <box style={{ justifyContent: 'space-between', marginBottom: 1 }}>
121
- <box style={{ flexDirection: 'column' }}>
122
- <text style={{ fg: theme.text }}>mux-sesh</text>
123
- <text style={{ fg: theme.textSubtle }}>{title}</text>
124
- </box>
125
- <box style={{ flexDirection: 'column', alignItems: 'flex-end' }}>
126
- <text style={{ fg: theme.textMuted }}>
127
- {getStatusLabel(viewMode, activeSessions, totalSessions, projectCount)}
128
- </text>
129
- </box>
130
- </box>
131
-
132
- {(appMode === AppMode.Search || appMode === AppMode.NewSession) && (
133
- <SearchInput
134
- key={appMode}
135
- appMode={appMode}
136
- searchQuery={searchQuery}
137
- textareaRef={textareaRef}
138
- prefixActive={prefixActive}
139
- onContentChange={() => syncTextareaValue(textareaRef, setSearchQuery)}
140
- />
141
- )}
142
-
143
- <box
144
- style={{
145
- alignSelf: 'auto',
146
- flexDirection: 'column',
147
- flexGrow: 0,
148
- flexShrink: 0,
149
- marginTop:
150
- viewMode === ViewMode.Sessions &&
151
- (appMode === AppMode.Normal || appMode === AppMode.AgentsManage)
152
- ? 1
153
- : 0,
154
- }}
155
- >
156
- {items.length === 0 ? (
157
- <text style={{ fg: theme.inactive }}>
158
- {getEmptyStateMessage(appMode, searchQuery, isGitHubURL(searchQuery))}
159
- </text>
160
- ) : viewMode === ViewMode.Sessions &&
161
- (appMode === AppMode.Normal || appMode === AppMode.AgentsManage) ? (
162
- <>
163
- <SessionList
164
- items={regularSessions}
165
- cursor={cursor}
166
- searchQuery={searchQuery}
167
- maxItems={maxVisibleItems}
168
- icons={config?.icons}
169
- pendingKillSessionName={pendingKillSessionName}
170
- />
171
-
172
- <AgentSessionGroup
173
- sessions={agentSessions}
174
- appMode={appMode}
175
- cursor={agentCursor}
176
- maxItems={maxVisibleItems}
177
- icons={config?.icons}
178
- pendingKillSessionName={pendingKillSessionName}
179
- />
180
- </>
181
- ) : (
182
- <ItemList
183
- items={items}
184
- cursor={cursor}
185
- appMode={appMode}
186
- searchQuery={searchQuery}
187
- maxItems={maxVisibleItems}
188
- icons={config?.icons}
189
- pendingKillSessionName={pendingKillSessionName}
190
- />
191
- )}
192
- </box>
193
- </box>
194
-
195
- {shouldShowDetailPanel(columns, appMode === AppMode.NewSession) &&
196
- (showOpencodeStats ? (
197
- <OpencodeStatsPanel selectedItem={selectedAgentSession} />
198
- ) : (
199
- <SessionDetailsPanel
200
- selectedItem={selectedPrimaryItem}
201
- config={config}
202
- backend={backend}
203
- />
204
- ))}
205
- </box>
206
-
207
- {(message || columns < 80 || footerHint) && (
208
- <box
209
- style={{
210
- backgroundColor: theme.surface,
211
- position: 'absolute',
212
- bottom: 0,
213
- left: 0,
214
- paddingTop: 0.4,
215
- paddingBottom: 0.4,
216
- paddingLeft: 1,
217
- paddingRight: versionLabel.length + 3,
218
- width: '100%',
219
- flexDirection: 'column',
220
- flexShrink: 0,
221
- }}
222
- >
223
- {message && <text style={{ fg: theme.action }}>{message}</text>}
224
- {columns < 80 && appMode !== AppMode.NewSession && (
225
- <text style={{ fg: theme.textSubtle }}>Resize for the detail pane.</text>
226
- )}
227
- <text style={{ fg: theme.textSubtle }}>{footerHint}</text>
228
- </box>
229
- )}
230
-
231
- <Toast message={toastMessage} visible={toastVisible} />
232
- <VersionBadge
233
- currentVersion={CURRENT_VERSION}
234
- updatedVersion={updatedVersion}
235
- isDev={process.env.MUX_SESH_DEV === '1'}
236
- />
237
- </box>
238
- </>
239
- )
240
- }
package/src/app/state.ts DELETED
@@ -1,178 +0,0 @@
1
- import { useEffect, type Dispatch, type MutableRefObject, type SetStateAction } from 'react'
2
- import { loadConfig } from '../config'
3
- import { AppMode, ViewMode, type Config, type Item } from '../types'
4
- import { resolveMultiplexerBackend, type MultiplexerBackend } from '../multiplexer'
5
- import {
6
- getProjectSelectionIndex,
7
- getSessionSelectionIndex,
8
- loadProjectSourceItems,
9
- loadProjectItemsWithLinks,
10
- loadSessionItems,
11
- type Measure,
12
- } from './data'
13
-
14
- export interface RefreshedViewState {
15
- items: Item[]
16
- cursor: number
17
- sessionItems?: Item[]
18
- projectSourceItems?: Item[]
19
- }
20
-
21
- export async function loadRefreshedViewState(
22
- targetMode: ViewMode,
23
- config: Config,
24
- measure: Measure,
25
- backend: MultiplexerBackend,
26
- lastSessionSelection?: string | null,
27
- lastProjectSelection?: string | null
28
- ): Promise<RefreshedViewState> {
29
- if (targetMode === ViewMode.Sessions) {
30
- const { sessionItems } = await loadSessionItems(config, measure, backend, 'refresh')
31
- return {
32
- items: sessionItems,
33
- sessionItems,
34
- cursor: getSessionSelectionIndex(sessionItems, lastSessionSelection),
35
- }
36
- }
37
-
38
- const { visibleSessions } = await loadSessionItems(config, measure, backend, 'refresh-projects')
39
- const { projectSourceItems, projectItems } = await loadProjectItemsWithLinks(
40
- config,
41
- visibleSessions,
42
- measure
43
- )
44
-
45
- return {
46
- items: projectItems,
47
- projectSourceItems,
48
- cursor: getProjectSelectionIndex(projectItems, lastProjectSelection),
49
- }
50
- }
51
-
52
- export function applyRefreshedViewState(
53
- refreshedState: RefreshedViewState,
54
- setSessionItems: Dispatch<SetStateAction<Item[]>>,
55
- setProjectSourceItems: Dispatch<SetStateAction<Item[]>>,
56
- setAllItems: Dispatch<SetStateAction<Item[]>>,
57
- setItems: Dispatch<SetStateAction<Item[]>>,
58
- setCursor: Dispatch<SetStateAction<number>>
59
- ) {
60
- if (refreshedState.sessionItems) {
61
- setSessionItems(refreshedState.sessionItems)
62
- }
63
-
64
- if (refreshedState.projectSourceItems) {
65
- setProjectSourceItems(refreshedState.projectSourceItems)
66
- }
67
-
68
- setAllItems(refreshedState.items)
69
- setItems(refreshedState.items)
70
- setCursor(refreshedState.cursor)
71
- }
72
-
73
- export function useAppStartup(
74
- measure: Measure,
75
- lastSessionSelectionRef: MutableRefObject<string | null>,
76
- lastProjectSelectionRef: MutableRefObject<string | null>,
77
- mark: (label: string) => void,
78
- setConfig: Dispatch<SetStateAction<Config | null>>,
79
- setBackend: Dispatch<SetStateAction<MultiplexerBackend | null>>,
80
- setMessage: Dispatch<SetStateAction<string>>,
81
- setAppMode: Dispatch<SetStateAction<AppMode>>,
82
- setViewMode: Dispatch<SetStateAction<ViewMode>>,
83
- setSessionItems: Dispatch<SetStateAction<Item[]>>,
84
- setProjectSourceItems: Dispatch<SetStateAction<Item[]>>,
85
- setAllItems: Dispatch<SetStateAction<Item[]>>,
86
- setItems: Dispatch<SetStateAction<Item[]>>,
87
- setCursor: Dispatch<SetStateAction<number>>
88
- ) {
89
- useEffect(() => {
90
- let cancelled = false
91
-
92
- async function init() {
93
- mark('startup begin')
94
- const config = await measure('loadConfig', loadConfig)
95
- if (cancelled) {
96
- return
97
- }
98
-
99
- const startupAppMode = config.keybindMode === 'standard' ? AppMode.Search : AppMode.Normal
100
- const backend = await measure('resolveBackend', () =>
101
- resolveMultiplexerBackend({ preference: config.backend })
102
- )
103
- if (cancelled) return
104
- setConfig(config)
105
- setBackend(backend)
106
- setAppMode(startupAppMode)
107
-
108
- const { visibleSessions, sessionItems } = await loadSessionItems(
109
- config,
110
- measure,
111
- backend,
112
- 'startup'
113
- )
114
- if (cancelled) {
115
- return
116
- }
117
-
118
- setSessionItems(sessionItems)
119
-
120
- if (sessionItems.length > 0) {
121
- setViewMode(ViewMode.Sessions)
122
- setAllItems(sessionItems)
123
- setItems(sessionItems)
124
- setCursor(getSessionSelectionIndex(sessionItems, lastSessionSelectionRef.current))
125
- mark('startup complete')
126
-
127
- const projectSourceItems = await loadProjectSourceItems(config, measure)
128
- if (cancelled) {
129
- return
130
- }
131
-
132
- setProjectSourceItems(projectSourceItems)
133
- return
134
- }
135
-
136
- const { projectSourceItems, projectItems } = await loadProjectItemsWithLinks(
137
- config,
138
- visibleSessions,
139
- measure
140
- )
141
- if (cancelled) {
142
- return
143
- }
144
-
145
- setViewMode(ViewMode.Projects)
146
- setProjectSourceItems(projectSourceItems)
147
- setAllItems(projectItems)
148
- setItems(projectItems)
149
- setCursor(getProjectSelectionIndex(projectItems, lastProjectSelectionRef.current))
150
- mark('startup complete')
151
- }
152
-
153
- void init().catch(error => {
154
- if (!cancelled) {
155
- setMessage(error instanceof Error ? error.message : 'Failed to start mux-sesh')
156
- }
157
- })
158
-
159
- return () => {
160
- cancelled = true
161
- }
162
- }, [
163
- lastProjectSelectionRef,
164
- lastSessionSelectionRef,
165
- mark,
166
- measure,
167
- setAllItems,
168
- setAppMode,
169
- setConfig,
170
- setBackend,
171
- setMessage,
172
- setCursor,
173
- setItems,
174
- setProjectSourceItems,
175
- setSessionItems,
176
- setViewMode,
177
- ])
178
- }
@@ -1,16 +0,0 @@
1
- import type { TextareaRenderable } from '@opentui/core'
2
- import type { Dispatch, MutableRefObject, SetStateAction } from 'react'
3
-
4
- export function syncTextareaValue(
5
- textareaRef: MutableRefObject<TextareaRenderable | null>,
6
- setValue: Dispatch<SetStateAction<string>>,
7
- resetCursor?: Dispatch<SetStateAction<number>>
8
- ) {
9
- const value = textareaRef.current?.plainText
10
- if (value === undefined) {
11
- return
12
- }
13
-
14
- setValue(value)
15
- resetCursor?.(0)
16
- }
package/src/app/view.ts DELETED
@@ -1,101 +0,0 @@
1
- import { isAgentSessionItem } from '../agents/session-name'
2
- import { isHerdrAgentItem } from '../multiplexer/items'
3
- import { getPanelStyle } from '../styles/theme'
4
- import { AppMode, ViewMode, type BackendKind, type Item, type ThemeColors } from '../types'
5
-
6
- export function splitVisibleSessions<T extends { isSession: boolean; title: string }>(
7
- items: readonly T[]
8
- ) {
9
- return {
10
- regularSessions: items.filter(item => !isAgentSessionItem(item)),
11
- agentSessions: items.filter(isAgentSessionItem),
12
- }
13
- }
14
-
15
- export function getAppTitle(
16
- appMode: AppMode,
17
- viewMode: ViewMode,
18
- backend: BackendKind = 'tmux'
19
- ): string {
20
- if (appMode === AppMode.Search) {
21
- return 'Search'
22
- }
23
-
24
- if (appMode === AppMode.NewSession) {
25
- return backend === 'herdr' ? 'New Workspace' : 'New Session'
26
- }
27
-
28
- if (appMode === AppMode.AgentsManage) {
29
- return 'Agent Sessions'
30
- }
31
-
32
- return viewMode === ViewMode.Projects
33
- ? 'Projects'
34
- : backend === 'herdr'
35
- ? 'Workspaces'
36
- : 'Sessions'
37
- }
38
-
39
- export function getListStyle(theme: ThemeColors, appMode: AppMode) {
40
- if (appMode === AppMode.NewSession) {
41
- return {
42
- ...getPanelStyle(theme, 'full'),
43
- flexGrow: 1,
44
- flexShrink: 1,
45
- }
46
- }
47
-
48
- return {
49
- ...getPanelStyle(theme, 'split'),
50
- flexGrow: 1,
51
- flexShrink: 1,
52
- minWidth: 40,
53
- }
54
- }
55
-
56
- export function getStatusLabel(
57
- viewMode: ViewMode,
58
- activeSessions: number,
59
- totalSessions: number,
60
- projectCount: number
61
- ): string {
62
- return viewMode === ViewMode.Sessions
63
- ? `${activeSessions}/${totalSessions} active`
64
- : `${projectCount} projects`
65
- }
66
-
67
- export function getFooterHint(appMode: AppMode, prefixKey?: string, selectedItem?: Item): string {
68
- const prefixLabel = prefixKey ? `${prefixKey} ...` : 'direct keys'
69
-
70
- if (appMode === AppMode.AgentsManage) {
71
- return isHerdrAgentItem(selectedItem)
72
- ? `o back enter focus ctrl+p commands ${prefixLabel}`
73
- : `o back d kill ctrl+p commands ${prefixLabel}`
74
- }
75
-
76
- if (appMode === AppMode.NewSession) {
77
- return 'enter create esc cancel'
78
- }
79
-
80
- if (appMode === AppMode.Search) {
81
- return 'enter select esc cancel'
82
- }
83
-
84
- return `enter select i search n new o agents d kill ctrl+p commands ${prefixLabel}`
85
- }
86
-
87
- export function getEmptyStateMessage(
88
- appMode: AppMode,
89
- searchQuery: string,
90
- isGitHubURL: boolean
91
- ): string {
92
- if (appMode === AppMode.NewSession && searchQuery && isGitHubURL) {
93
- return 'Clone & create session'
94
- }
95
-
96
- if (appMode === AppMode.NewSession && searchQuery) {
97
- return `Create session: ${searchQuery}`
98
- }
99
-
100
- return 'No items found'
101
- }
package/src/app.tsx DELETED
@@ -1,50 +0,0 @@
1
- import { Component, type ReactNode } from 'react'
2
- import { useAppController } from './app/controller'
3
- import { AppModalsLayer } from './app/modals-layer'
4
- import { AppScreen } from './app/screen'
5
- import { ThemeProvider } from './styles/theme'
6
- import { ErrorScreen } from './ui/ErrorScreen'
7
-
8
- interface ErrorBoundaryState {
9
- error?: unknown
10
- hasError: boolean
11
- retryKey: number
12
- }
13
-
14
- class RootErrorBoundary extends Component<
15
- { children: (retryKey: number) => ReactNode },
16
- ErrorBoundaryState
17
- > {
18
- state: ErrorBoundaryState = { hasError: false, retryKey: 0 }
19
-
20
- static getDerivedStateFromError(error: unknown): Partial<ErrorBoundaryState> {
21
- return { error, hasError: true }
22
- }
23
-
24
- private retry = () => {
25
- this.setState(state => ({ error: undefined, hasError: false, retryKey: state.retryKey + 1 }))
26
- }
27
-
28
- render() {
29
- if (this.state.hasError) {
30
- return <ErrorScreen error={this.state.error} onRetry={this.retry} />
31
- }
32
-
33
- return this.props.children(this.state.retryKey)
34
- }
35
- }
36
-
37
- function AppTree() {
38
- const { theme, screenProps, modalProps } = useAppController()
39
-
40
- return (
41
- <ThemeProvider theme={theme}>
42
- <AppScreen {...screenProps} />
43
- <AppModalsLayer {...modalProps} />
44
- </ThemeProvider>
45
- )
46
- }
47
-
48
- export function App() {
49
- return <RootErrorBoundary>{retryKey => <AppTree key={retryKey} />}</RootErrorBoundary>
50
- }