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,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
- }
@@ -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
- }