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,220 +0,0 @@
1
- import { isOpencodeSessionItem } from '../../opencode/session-name'
2
- import { AppMode, ViewMode, type KeybindMode } from '../../types'
3
- import { clampCursorIndex } from '../../ui/list-window'
4
- import { requestShutdown } from '../../util/shutdown'
5
- import {
6
- activatePrefix,
7
- clearPrefix,
8
- enterNewSessionMode,
9
- getKeyName,
10
- getQuickSelectItem,
11
- getSelectedItem,
12
- matchesPrefixKey,
13
- openSelectedEditTarget,
14
- openSelectedRootSession,
15
- setTimedMessage,
16
- type KeyboardHandlerContext,
17
- type KeyboardInput,
18
- } from './shared'
19
-
20
- export function handleNormalMode(
21
- key: KeyboardInput,
22
- ctx: KeyboardHandlerContext,
23
- keybindMode: KeybindMode = 'vim'
24
- ) {
25
- const keyName = getKeyName(key)
26
- const isStandard = keybindMode === 'standard'
27
-
28
- if (ctx.prefixActive) {
29
- clearPrefix(ctx)
30
-
31
- if (key.shift && keyName.toLowerCase() === 'r') {
32
- ctx.clearPendingKill()
33
- void ctx.refreshItems()
34
- setTimedMessage(ctx, 'Refreshed')
35
- return
36
- }
37
-
38
- switch (keyName) {
39
- case 'l':
40
- ctx.clearPendingKill()
41
- void ctx.handleLastSession()
42
- return
43
- case 'g':
44
- openSelectedRootSession(ctx)
45
- return
46
- case 'e':
47
- openSelectedEditTarget(ctx)
48
- return
49
- case 'd':
50
- if (ctx.viewMode === ViewMode.Sessions && ctx.regularSessions[ctx.cursor]?.isSession) {
51
- ctx.requestKillSession(ctx.regularSessions[ctx.cursor])
52
- }
53
- return
54
- case 'r':
55
- if (ctx.viewMode === ViewMode.Sessions && ctx.regularSessions[ctx.cursor]?.isSession) {
56
- ctx.clearPendingKill()
57
- ctx.openRenameModal(ctx.regularSessions[ctx.cursor])
58
- }
59
- return
60
- case 's':
61
- ctx.clearPendingKill()
62
- ctx.setViewMode(ViewMode.Sessions)
63
- void ctx.refreshItems(ViewMode.Sessions)
64
- return
65
- case 'p':
66
- ctx.clearPendingKill()
67
- ctx.setViewMode(ViewMode.Projects)
68
- void ctx.refreshItems(ViewMode.Projects)
69
- return
70
- }
71
-
72
- return
73
- }
74
-
75
- if (ctx.prefixKey && matchesPrefixKey(key, ctx.prefixKey)) {
76
- activatePrefix(ctx)
77
- return
78
- }
79
-
80
- if (
81
- (isStandard && ((key.ctrl && keyName === 'q') || keyName === 'escape')) ||
82
- (!isStandard && (keyName === 'q' || keyName === 'escape'))
83
- ) {
84
- void requestShutdown(0)
85
- return
86
- }
87
-
88
- if (!isStandard && keyName === 'i') {
89
- ctx.clearPendingKill()
90
- ctx.setAppMode(AppMode.Search)
91
- ctx.setSearchQuery('')
92
- return
93
- }
94
-
95
- if (!isStandard && keyName === 'n') {
96
- enterNewSessionMode(ctx)
97
- return
98
- }
99
-
100
- if (!isStandard && keyName === 'o') {
101
- ctx.clearPendingKill()
102
- if (ctx.viewMode === ViewMode.Sessions && ctx.agentSessions.length > 0) {
103
- ctx.setAppMode(AppMode.AgentsManage)
104
- ctx.setAgentCursor(0)
105
- const firstAgent = ctx.agentSessions[0]
106
- if (isOpencodeSessionItem(firstAgent)) {
107
- void ctx.loadOpencodeStatsForSession(firstAgent.title)
108
- }
109
- }
110
- return
111
- }
112
-
113
- if (key.ctrl && keyName === 'p') {
114
- ctx.clearPendingKill()
115
- ctx.openCommandsModal()
116
- return
117
- }
118
-
119
- if (key.ctrl && keyName === 'f') {
120
- const item = ctx.viewMode === ViewMode.Sessions ? ctx.regularSessions[ctx.cursor] : undefined
121
- if (item) {
122
- ctx.clearPendingKill()
123
- void ctx.togglePinnedSession(item.title)
124
- }
125
- return
126
- }
127
-
128
- if (!ctx.prefixKey && !isStandard && keyName === 'l') {
129
- ctx.clearPendingKill()
130
- void ctx.handleLastSession()
131
- return
132
- }
133
-
134
- if (!ctx.prefixKey && !isStandard && keyName === 'g') {
135
- openSelectedRootSession(ctx)
136
- return
137
- }
138
-
139
- if (!ctx.prefixKey && !isStandard && keyName === 'e') {
140
- openSelectedEditTarget(ctx)
141
- return
142
- }
143
-
144
- if (!isStandard && keyName === 'd') {
145
- if (ctx.viewMode === ViewMode.Sessions && ctx.regularSessions[ctx.cursor]?.isSession) {
146
- ctx.requestKillSession(ctx.regularSessions[ctx.cursor])
147
- }
148
- return
149
- }
150
-
151
- if (!ctx.prefixKey && !isStandard && keyName === 'r') {
152
- if (ctx.viewMode === ViewMode.Sessions && ctx.regularSessions[ctx.cursor]?.isSession) {
153
- ctx.clearPendingKill()
154
- ctx.openRenameModal(ctx.regularSessions[ctx.cursor])
155
- }
156
- return
157
- }
158
-
159
- if (!ctx.prefixKey && !isStandard && keyName === 'R') {
160
- ctx.clearPendingKill()
161
- void ctx.refreshItems()
162
- setTimedMessage(ctx, 'Refreshed')
163
- return
164
- }
165
-
166
- if (!isStandard) {
167
- if (keyName === 's') {
168
- ctx.clearPendingKill()
169
- ctx.setViewMode(ViewMode.Sessions)
170
- void ctx.refreshItems(ViewMode.Sessions)
171
- return
172
- }
173
-
174
- if (keyName === 'p') {
175
- ctx.clearPendingKill()
176
- ctx.setViewMode(ViewMode.Projects)
177
- void ctx.refreshItems(ViewMode.Projects)
178
- return
179
- }
180
- }
181
-
182
- if (keyName === 'down' || (!isStandard && keyName === 'j')) {
183
- ctx.clearPendingKill()
184
- if (ctx.viewMode === ViewMode.Sessions) {
185
- ctx.setCursor(cursor => clampCursorIndex(ctx.regularSessions.length, cursor + 1))
186
- return
187
- }
188
-
189
- ctx.setCursor(cursor => clampCursorIndex(ctx.items.length, cursor + 1))
190
- return
191
- }
192
-
193
- if (keyName === 'up' || (!isStandard && keyName === 'k')) {
194
- ctx.clearPendingKill()
195
- ctx.setCursor(cursor =>
196
- clampCursorIndex(
197
- ctx.viewMode === ViewMode.Sessions ? ctx.regularSessions.length : ctx.items.length,
198
- cursor - 1
199
- )
200
- )
201
- return
202
- }
203
-
204
- if (keyName === 'return') {
205
- ctx.clearPendingKill()
206
- const item = getSelectedItem(ctx)
207
- if (item) {
208
- void ctx.handleSelect(item)
209
- }
210
- return
211
- }
212
-
213
- if (!isStandard && keyName >= '1' && keyName <= '9') {
214
- ctx.clearPendingKill()
215
- const item = getQuickSelectItem(ctx, Number.parseInt(keyName, 10) - 1)
216
- if (item) {
217
- void ctx.handleSelect(item)
218
- }
219
- }
220
- }
@@ -1,118 +0,0 @@
1
- import { isOpencodeSessionItem } from '../../opencode/session-name'
2
- import { AppMode, ViewMode, type KeybindMode } from '../../types'
3
- import { clampCursorIndex } from '../../ui/list-window'
4
- import { requestShutdown } from '../../util/shutdown'
5
- import {
6
- activatePrefix,
7
- clearPrefix,
8
- enterNewSessionMode,
9
- getKeyName,
10
- matchesPrefixKey,
11
- setTimedMessage,
12
- type KeyboardHandlerContext,
13
- type KeyboardInput,
14
- } from './shared'
15
-
16
- export function handleSearchMode(
17
- key: KeyboardInput,
18
- ctx: KeyboardHandlerContext,
19
- keybindMode: KeybindMode = 'vim'
20
- ) {
21
- const keyName = getKeyName(key)
22
- const isStandard = keybindMode === 'standard'
23
-
24
- if (isStandard) {
25
- if (ctx.prefixActive) {
26
- clearPrefix(ctx)
27
-
28
- switch (keyName) {
29
- case 'd':
30
- if (ctx.viewMode === ViewMode.Sessions && ctx.items[ctx.cursor]?.isSession) {
31
- ctx.requestKillSession(ctx.items[ctx.cursor])
32
- }
33
- return
34
- case 'n':
35
- enterNewSessionMode(ctx)
36
- return
37
- case 'o':
38
- ctx.clearPendingKill()
39
- if (ctx.viewMode === ViewMode.Sessions && ctx.agentSessions.length > 0) {
40
- ctx.setAppMode(AppMode.AgentsManage)
41
- ctx.setAgentCursor(0)
42
- const firstAgent = ctx.agentSessions[0]
43
- if (isOpencodeSessionItem(firstAgent)) {
44
- void ctx.loadOpencodeStatsForSession(firstAgent.title)
45
- }
46
- }
47
- return
48
- case 's':
49
- ctx.clearPendingKill()
50
- ctx.openSettingsModal()
51
- return
52
- case 'l':
53
- ctx.clearPendingKill()
54
- void ctx.handleLastSession()
55
- return
56
- case 'g':
57
- ctx.clearPendingKill()
58
- void ctx.handleRootSession(ctx.items[ctx.cursor])
59
- return
60
- case 'r':
61
- if (key.shift) {
62
- void ctx.refreshItems()
63
- setTimedMessage(ctx, 'Refreshed')
64
- return
65
- }
66
-
67
- if (ctx.viewMode === ViewMode.Sessions && ctx.items[ctx.cursor]?.isSession) {
68
- ctx.clearPendingKill()
69
- ctx.openRenameModal(ctx.items[ctx.cursor])
70
- }
71
- return
72
- default:
73
- return
74
- }
75
- }
76
-
77
- if (matchesPrefixKey(key, ctx.prefixKey)) {
78
- activatePrefix(ctx)
79
- return
80
- }
81
-
82
- if (key.ctrl && keyName === 'q') {
83
- void requestShutdown(0)
84
- return
85
- }
86
- }
87
-
88
- if (keyName === 'escape') {
89
- ctx.clearPendingKill()
90
- if (isStandard) {
91
- ctx.setSearchQuery('')
92
- ctx.setCursor(0)
93
- return
94
- }
95
-
96
- ctx.setAppMode(AppMode.Normal)
97
- ctx.setSearchQuery('')
98
- ctx.setCursor(0)
99
- return
100
- }
101
-
102
- switch (keyName) {
103
- case 'return':
104
- ctx.clearPendingKill()
105
- if (ctx.items.length > 0) {
106
- void ctx.handleSelect(ctx.items[clampCursorIndex(ctx.items.length, ctx.cursor)])
107
- }
108
- break
109
- case 'down':
110
- ctx.clearPendingKill()
111
- ctx.setCursor(cursor => clampCursorIndex(ctx.items.length, cursor + 1))
112
- break
113
- case 'up':
114
- ctx.clearPendingKill()
115
- ctx.setCursor(cursor => clampCursorIndex(ctx.items.length, cursor - 1))
116
- break
117
- }
118
- }
@@ -1,117 +0,0 @@
1
- import type { Dispatch, MutableRefObject, SetStateAction } from 'react'
2
- import { AppMode, ViewMode, type Config, type Item, type OpencodeSessionStats } from '../../types'
3
-
4
- export interface KeyboardInput {
5
- name?: string
6
- ctrl?: boolean
7
- shift?: boolean
8
- }
9
-
10
- export interface KeyboardHandlerContext {
11
- appMode: AppMode
12
- viewMode: ViewMode
13
- items: Item[]
14
- regularSessions: Item[]
15
- agentSessions: Item[]
16
- cursor: number
17
- agentCursor: number
18
- searchQuery: string
19
- prefixKey?: string
20
- projectItems: Item[]
21
- sessionItems: Item[]
22
- prefixActive: boolean
23
- prefixTimeoutRef: MutableRefObject<NodeJS.Timeout | null>
24
- setAppMode: (mode: AppMode) => void
25
- setViewMode: (mode: ViewMode) => void
26
- setCursor: Dispatch<SetStateAction<number>>
27
- setAgentCursor: Dispatch<SetStateAction<number>>
28
- setSearchQuery: (query: string) => void
29
- setAllItems: Dispatch<SetStateAction<Item[]>>
30
- setItems: Dispatch<SetStateAction<Item[]>>
31
- setPrefixActive: (active: boolean) => void
32
- refreshItems: (forceViewMode?: ViewMode, nextConfig?: Config) => Promise<void>
33
- requestKillSession: (item: Item) => void
34
- togglePinnedSession: (sessionName: string) => Promise<void>
35
- clearPendingKill: () => void
36
- handleSelect: (item: Item) => Promise<void>
37
- handleKillSession: (item: Item) => Promise<void>
38
- handleLastSession: () => Promise<void>
39
- handleRootSession: (item?: Item) => Promise<void>
40
- handleEditTarget: (item?: Item) => Promise<void>
41
- openRenameModal: (item: Item) => void
42
- openCommandsModal: () => void
43
- openSettingsModal: () => void
44
- loadOpencodeStatsForSession: (sessionName: string) => Promise<OpencodeSessionStats | null>
45
- setMessage: (message: string) => void
46
- }
47
-
48
- export function getKeyName(key: KeyboardInput): string {
49
- return key.name ?? ''
50
- }
51
-
52
- export function matchesPrefixKey(key: KeyboardInput, prefixKey = 'ctrl+x'): boolean {
53
- const parts = prefixKey.toLowerCase().split('+')
54
- const keyPart = parts.at(-1) ?? prefixKey.toLowerCase()
55
- const expectsCtrl = parts.includes('ctrl')
56
- const expectsShift = parts.includes('shift')
57
-
58
- return (
59
- Boolean(key.ctrl) === expectsCtrl &&
60
- Boolean(key.shift) === expectsShift &&
61
- getKeyName(key).toLowerCase() === keyPart
62
- )
63
- }
64
-
65
- export function clearPrefix(ctx: KeyboardHandlerContext) {
66
- if (ctx.prefixTimeoutRef.current) {
67
- clearTimeout(ctx.prefixTimeoutRef.current)
68
- ctx.prefixTimeoutRef.current = null
69
- }
70
-
71
- ctx.setPrefixActive(false)
72
- }
73
-
74
- export function activatePrefix(ctx: KeyboardHandlerContext) {
75
- ctx.setPrefixActive(true)
76
- ctx.prefixTimeoutRef.current = setTimeout(() => {
77
- ctx.setPrefixActive(false)
78
- }, 2000)
79
- }
80
-
81
- export function setTimedMessage(ctx: KeyboardHandlerContext, message: string, timeout = 2000) {
82
- ctx.setMessage(message)
83
- setTimeout(() => ctx.setMessage(''), timeout)
84
- }
85
-
86
- export function getSelectedItem(ctx: KeyboardHandlerContext): Item | undefined {
87
- return ctx.viewMode === ViewMode.Sessions
88
- ? ctx.regularSessions[ctx.cursor]
89
- : ctx.items[ctx.cursor]
90
- }
91
-
92
- export function getQuickSelectItem(ctx: KeyboardHandlerContext, index: number): Item | undefined {
93
- return ctx.viewMode === ViewMode.Sessions ? ctx.regularSessions[index] : ctx.items[index]
94
- }
95
-
96
- export function enterNewSessionMode(ctx: KeyboardHandlerContext) {
97
- ctx.clearPendingKill()
98
- ctx.setAppMode(AppMode.NewSession)
99
- ctx.setViewMode(ViewMode.Projects)
100
- ctx.setAllItems(ctx.projectItems)
101
- ctx.setItems(ctx.projectItems)
102
- ctx.setCursor(Math.max(0, ctx.projectItems.length - 1))
103
- ctx.setSearchQuery('')
104
- }
105
-
106
- export function openSelectedRootSession(ctx: KeyboardHandlerContext) {
107
- ctx.clearPendingKill()
108
- void ctx.handleRootSession(getSelectedItem(ctx))
109
- }
110
-
111
- export function openSelectedEditTarget(ctx: KeyboardHandlerContext) {
112
- ctx.clearPendingKill()
113
- const item = getSelectedItem(ctx)
114
- if (item?.itemKind === 'configured') {
115
- void ctx.handleEditTarget(item)
116
- }
117
- }