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/core-state.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import type { TextareaRenderable } from '@opentui/core'
|
|
2
|
-
import { useRef, useState } from 'react'
|
|
3
|
-
import { AppMode, ViewMode, type Config, type Item } from '../types'
|
|
4
|
-
import type { MultiplexerBackend } from '../multiplexer'
|
|
5
|
-
|
|
6
|
-
export function useAppCoreState() {
|
|
7
|
-
const [appMode, setAppMode] = useState(AppMode.Normal)
|
|
8
|
-
const [viewMode, setViewMode] = useState(ViewMode.Sessions)
|
|
9
|
-
const [items, setItems] = useState<Item[]>([])
|
|
10
|
-
const [allItems, setAllItems] = useState<Item[]>([])
|
|
11
|
-
const [projectSourceItems, setProjectSourceItems] = useState<Item[]>([])
|
|
12
|
-
const [sessionCandidateItems, setSessionCandidateItems] = useState<Item[]>([])
|
|
13
|
-
const [sessionItems, setSessionItems] = useState<Item[]>([])
|
|
14
|
-
const [cursor, setCursor] = useState(0)
|
|
15
|
-
const [agentCursor, setAgentCursor] = useState(0)
|
|
16
|
-
const [searchQuery, setSearchQuery] = useState('')
|
|
17
|
-
const [message, setMessage] = useState('')
|
|
18
|
-
const [renameTarget, setRenameTarget] = useState<Item | null>(null)
|
|
19
|
-
const [config, setConfig] = useState<Config | null>(null)
|
|
20
|
-
const [backend, setBackend] = useState<MultiplexerBackend | null>(null)
|
|
21
|
-
const [pendingKillSessionName, setPendingKillSessionName] = useState<string | null>(null)
|
|
22
|
-
const [prefixActive, setPrefixActive] = useState(false)
|
|
23
|
-
const prefixTimeoutRef = useRef<NodeJS.Timeout | null>(null)
|
|
24
|
-
const textareaRef = useRef<TextareaRenderable | null>(null)
|
|
25
|
-
const lastSessionSelectionRef = useRef<string | null>(null)
|
|
26
|
-
const lastProjectSelectionRef = useRef<string | null>(null)
|
|
27
|
-
const [toastMessage, setToastMessage] = useState('')
|
|
28
|
-
const [toastVisible, setToastVisible] = useState(false)
|
|
29
|
-
const [updatedVersion, setUpdatedVersion] = useState<string | null>(null)
|
|
30
|
-
|
|
31
|
-
return {
|
|
32
|
-
appMode,
|
|
33
|
-
setAppMode,
|
|
34
|
-
viewMode,
|
|
35
|
-
setViewMode,
|
|
36
|
-
items,
|
|
37
|
-
setItems,
|
|
38
|
-
allItems,
|
|
39
|
-
setAllItems,
|
|
40
|
-
projectSourceItems,
|
|
41
|
-
setProjectSourceItems,
|
|
42
|
-
sessionCandidateItems,
|
|
43
|
-
setSessionCandidateItems,
|
|
44
|
-
sessionItems,
|
|
45
|
-
setSessionItems,
|
|
46
|
-
cursor,
|
|
47
|
-
setCursor,
|
|
48
|
-
agentCursor,
|
|
49
|
-
setAgentCursor,
|
|
50
|
-
searchQuery,
|
|
51
|
-
setSearchQuery,
|
|
52
|
-
message,
|
|
53
|
-
setMessage,
|
|
54
|
-
renameTarget,
|
|
55
|
-
setRenameTarget,
|
|
56
|
-
config,
|
|
57
|
-
setConfig,
|
|
58
|
-
backend,
|
|
59
|
-
setBackend,
|
|
60
|
-
pendingKillSessionName,
|
|
61
|
-
setPendingKillSessionName,
|
|
62
|
-
prefixActive,
|
|
63
|
-
setPrefixActive,
|
|
64
|
-
prefixTimeoutRef,
|
|
65
|
-
textareaRef,
|
|
66
|
-
lastSessionSelectionRef,
|
|
67
|
-
lastProjectSelectionRef,
|
|
68
|
-
toastMessage,
|
|
69
|
-
setToastMessage,
|
|
70
|
-
toastVisible,
|
|
71
|
-
setToastVisible,
|
|
72
|
-
updatedVersion,
|
|
73
|
-
setUpdatedVersion,
|
|
74
|
-
}
|
|
75
|
-
}
|
package/src/app/data.ts
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { getListedSessionItems, mergeSessionItems } from '../config/listed-sessions'
|
|
2
|
-
import { orderProjectItems, orderSessionItems } from '../items/order'
|
|
3
|
-
import { annotateProjectItemsWithSessionLinks } from '../projects/session-links'
|
|
4
|
-
import { clearMatchIndices } from '../search'
|
|
5
|
-
import { workspaceToItem } from '../multiplexer/items'
|
|
6
|
-
import type { MultiplexerBackend } from '../multiplexer'
|
|
7
|
-
import { getItemKey } from '../multiplexer/items'
|
|
8
|
-
import { getProjectItems, getSessionCandidateItems } from '../tmux/projects'
|
|
9
|
-
import { filterHiddenSessions } from '../tmux/workflows'
|
|
10
|
-
import { isAgentSessionItem } from '../agents/session-name'
|
|
11
|
-
import type { Config, Item } from '../types'
|
|
12
|
-
import { clampCursorIndex } from '../ui/list-window'
|
|
13
|
-
|
|
14
|
-
export type Measure = <T>(name: string, fn: () => Promise<T>) => Promise<T>
|
|
15
|
-
|
|
16
|
-
export function getSessionSelectionIndex(nextItems: Item[], selection?: string | null): number {
|
|
17
|
-
const regularItems = nextItems.filter(item => !isAgentSessionItem(item))
|
|
18
|
-
if (regularItems.length === 0 || !selection) {
|
|
19
|
-
return 0
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const index = regularItems.findIndex(
|
|
23
|
-
item => getItemKey(item) === selection || item.title === selection
|
|
24
|
-
)
|
|
25
|
-
return index >= 0 ? index : 0
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function getProjectSelectionIndex(nextItems: Item[], selection?: string | null): number {
|
|
29
|
-
if (nextItems.length === 0 || !selection) {
|
|
30
|
-
return 0
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const index = nextItems.findIndex(item => item.path === selection)
|
|
34
|
-
return index >= 0 ? index : 0
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function getAgentSelectionIndex(
|
|
38
|
-
nextItems: Item[],
|
|
39
|
-
selection: string | undefined,
|
|
40
|
-
currentCursor: number
|
|
41
|
-
): number {
|
|
42
|
-
const agentSessions = nextItems.filter(isAgentSessionItem)
|
|
43
|
-
const selectedIndex = selection
|
|
44
|
-
? agentSessions.findIndex(item => getItemKey(item) === selection)
|
|
45
|
-
: -1
|
|
46
|
-
return selectedIndex >= 0 ? selectedIndex : clampCursorIndex(agentSessions.length, currentCursor)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export function reuseSessionItemIdentities(previous: Item[], next: Item[]): Item[] {
|
|
50
|
-
const previousByKey = new Map(previous.map(item => [getItemKey(item), item]))
|
|
51
|
-
return next.map(item => {
|
|
52
|
-
const existing = previousByKey.get(getItemKey(item))
|
|
53
|
-
return existing && JSON.stringify(existing) === JSON.stringify(item) ? existing : item
|
|
54
|
-
})
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export async function loadSessionItems(
|
|
58
|
-
config: Config,
|
|
59
|
-
measure: Measure,
|
|
60
|
-
backend: MultiplexerBackend,
|
|
61
|
-
labelPrefix = 'sessions'
|
|
62
|
-
): Promise<{ visibleSessions: Item[]; sessionItems: Item[] }> {
|
|
63
|
-
const sessions = await measure(`${labelPrefix}:listWorkspaces`, async () =>
|
|
64
|
-
(await backend.list()).map(workspaceToItem)
|
|
65
|
-
)
|
|
66
|
-
const visibleSessions = filterHiddenSessions(sessions, config.hiddenSessions)
|
|
67
|
-
const listedSessions = await measure(`${labelPrefix}:getListedSessionItems`, () =>
|
|
68
|
-
getListedSessionItems(config)
|
|
69
|
-
)
|
|
70
|
-
const sessionItems = clearMatchIndices(
|
|
71
|
-
orderSessionItems(
|
|
72
|
-
mergeSessionItems(visibleSessions, listedSessions),
|
|
73
|
-
config.sortOrder,
|
|
74
|
-
config.pinnedSessions
|
|
75
|
-
)
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
return {
|
|
79
|
-
visibleSessions,
|
|
80
|
-
sessionItems,
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export async function loadProjectItemsWithLinks(
|
|
85
|
-
config: Config,
|
|
86
|
-
liveSessions: Item[],
|
|
87
|
-
measure: Measure,
|
|
88
|
-
sourceItems?: Item[]
|
|
89
|
-
): Promise<{ projectSourceItems: Item[]; projectItems: Item[] }> {
|
|
90
|
-
const projectSourceItems = sourceItems ?? (await loadProjectSourceItems(config, measure))
|
|
91
|
-
|
|
92
|
-
const projectItems = clearMatchIndices(
|
|
93
|
-
orderProjectItems(
|
|
94
|
-
await measure('projects:linkProjectItems', () =>
|
|
95
|
-
annotateProjectItemsWithSessionLinks(projectSourceItems, liveSessions, config)
|
|
96
|
-
),
|
|
97
|
-
config.sortOrder
|
|
98
|
-
)
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
return {
|
|
102
|
-
projectSourceItems,
|
|
103
|
-
projectItems,
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export async function loadProjectSourceItems(config: Config, measure: Measure): Promise<Item[]> {
|
|
108
|
-
return orderProjectItems(
|
|
109
|
-
await measure('projects:getProjectItems', () => getProjectItems(config)),
|
|
110
|
-
config.sortOrder
|
|
111
|
-
)
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export async function loadSessionCandidateItems(
|
|
115
|
-
config: Config,
|
|
116
|
-
measure: Measure,
|
|
117
|
-
backend: MultiplexerBackend
|
|
118
|
-
): Promise<Item[]> {
|
|
119
|
-
const [candidates, sessions] = await measure('loadSessionCandidateItems', () =>
|
|
120
|
-
Promise.all([
|
|
121
|
-
getSessionCandidateItems(config),
|
|
122
|
-
backend.list().then(items => items.map(workspaceToItem)),
|
|
123
|
-
])
|
|
124
|
-
)
|
|
125
|
-
|
|
126
|
-
const visibleSessions = filterHiddenSessions(sessions, config.hiddenSessions)
|
|
127
|
-
return measure('linkSessionCandidateItems', () =>
|
|
128
|
-
annotateProjectItemsWithSessionLinks(candidates, visibleSessions, config)
|
|
129
|
-
)
|
|
130
|
-
}
|
package/src/app/derived.ts
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { filterCommandEntries, getCommandEntries, type CommandEntry } from '../ui/CommandsModal'
|
|
2
|
-
import {
|
|
3
|
-
filterSettingsEntries,
|
|
4
|
-
filterSettingsOptions,
|
|
5
|
-
getSettingsEntries,
|
|
6
|
-
getSettingOptions,
|
|
7
|
-
type SettingsEntry,
|
|
8
|
-
type SettingsOption,
|
|
9
|
-
} from '../settings'
|
|
10
|
-
import { AppMode, ViewMode, type Config, type Item } from '../types'
|
|
11
|
-
import type { ModalState } from './modals'
|
|
12
|
-
import { splitVisibleSessions } from './view'
|
|
13
|
-
|
|
14
|
-
interface SessionCommandState {
|
|
15
|
-
regularSessions: Item[]
|
|
16
|
-
agentSessions: Item[]
|
|
17
|
-
selectedAgentSession: Item | undefined
|
|
18
|
-
selectedPrimaryItem: Item | undefined
|
|
19
|
-
filteredCommandEntries: CommandEntry[]
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
interface SettingsState {
|
|
23
|
-
filteredSettingsEntries: SettingsEntry[]
|
|
24
|
-
filteredSettingOptions: SettingsOption[]
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function getSessionCommandState(
|
|
28
|
-
appMode: AppMode,
|
|
29
|
-
viewMode: ViewMode,
|
|
30
|
-
items: Item[],
|
|
31
|
-
cursor: number,
|
|
32
|
-
agentCursor: number,
|
|
33
|
-
config: Config | null,
|
|
34
|
-
commandsSearchQuery: string
|
|
35
|
-
): SessionCommandState {
|
|
36
|
-
const sessionSplit =
|
|
37
|
-
viewMode === ViewMode.Sessions &&
|
|
38
|
-
(appMode === AppMode.Normal || appMode === AppMode.AgentsManage)
|
|
39
|
-
? splitVisibleSessions(items)
|
|
40
|
-
: { regularSessions: items, agentSessions: [] }
|
|
41
|
-
|
|
42
|
-
const selectedPrimaryItem =
|
|
43
|
-
viewMode === ViewMode.Sessions && appMode === AppMode.Normal
|
|
44
|
-
? sessionSplit.regularSessions[cursor]
|
|
45
|
-
: viewMode === ViewMode.Sessions && appMode === AppMode.AgentsManage
|
|
46
|
-
? sessionSplit.agentSessions[agentCursor]
|
|
47
|
-
: items[cursor]
|
|
48
|
-
|
|
49
|
-
return {
|
|
50
|
-
regularSessions: sessionSplit.regularSessions,
|
|
51
|
-
agentSessions: sessionSplit.agentSessions,
|
|
52
|
-
selectedAgentSession:
|
|
53
|
-
appMode === AppMode.AgentsManage ? sessionSplit.agentSessions[agentCursor] : undefined,
|
|
54
|
-
selectedPrimaryItem,
|
|
55
|
-
filteredCommandEntries: filterCommandEntries(
|
|
56
|
-
getCommandEntries(appMode, config?.keybindMode, config?.prefixKey, selectedPrimaryItem),
|
|
57
|
-
commandsSearchQuery
|
|
58
|
-
),
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export function getSettingsState(
|
|
63
|
-
config: Config | null,
|
|
64
|
-
modalState: ModalState,
|
|
65
|
-
settingsSearchQuery: string,
|
|
66
|
-
settingOptionsSearchQuery: string
|
|
67
|
-
): SettingsState {
|
|
68
|
-
const settingsEntries = config ? getSettingsEntries(config) : []
|
|
69
|
-
const currentOptionField = modalState?.type === 'setting-options' ? modalState.field : undefined
|
|
70
|
-
const settingOptions =
|
|
71
|
-
config && currentOptionField ? getSettingOptions(config, currentOptionField) : []
|
|
72
|
-
|
|
73
|
-
return {
|
|
74
|
-
filteredSettingsEntries: filterSettingsEntries(settingsEntries, settingsSearchQuery),
|
|
75
|
-
filteredSettingOptions: filterSettingsOptions(settingOptions, settingOptionsSearchQuery),
|
|
76
|
-
}
|
|
77
|
-
}
|