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,650 +0,0 @@
1
- import { useEffect, useRef, type Dispatch, type MutableRefObject, type SetStateAction } from 'react'
2
- import { useRenderer } from '@opentui/react'
3
- import type { TerminalColors } from '@opentui/core'
4
- import { isOpencodeSessionItem } from '../opencode/session-name'
5
- import { checkAndUpdate, updateEvents } from '../update'
6
- import { showTemporaryToast } from './notifications'
7
- import { clearMatchIndices, filterAndSortItems } from '../search'
8
- import { combineFileSearchResults, searchFilesAndDirectories, warmFileSearch } from '../search/fff'
9
- import { annotateProjectItemsWithSessionLinks } from '../projects/session-links'
10
- import {
11
- getProjectSelectionIndex,
12
- getAgentSelectionIndex,
13
- getSessionSelectionIndex,
14
- loadSessionCandidateItems,
15
- loadSessionItems,
16
- reuseSessionItemIdentities,
17
- } from './data'
18
- import { SYSTEM_THEME_ID } from '../styles/theme'
19
- import { subscribeThemeFollow } from '../styles/theme-follow'
20
- import { terminalColorsToPalette, type TerminalPalette } from '../styles/terminal-palette'
21
- import { AppMode, ViewMode, type Config, type Item } from '../types'
22
- import type { MultiplexerBackend } from '../multiplexer'
23
- import { getItemKey } from '../multiplexer/items'
24
- import { clampCursorIndex } from '../ui/list-window'
25
- import { isGitHubURL } from '../util/github'
26
- import { measure } from '../util/perf'
27
-
28
- const FILE_SEARCH_DEBOUNCE_MS = 120
29
-
30
- export function useSystemThemeFollow(
31
- themeId: string | undefined,
32
- homeDir: string,
33
- onRefresh: () => void
34
- ) {
35
- const onRefreshRef = useRef(onRefresh)
36
- onRefreshRef.current = onRefresh
37
-
38
- useEffect(() => {
39
- if (themeId !== SYSTEM_THEME_ID) {
40
- return
41
- }
42
-
43
- const subscription = subscribeThemeFollow(homeDir, {
44
- onRefresh: () => {
45
- onRefreshRef.current()
46
- },
47
- })
48
-
49
- return () => {
50
- subscription.stop()
51
- }
52
- }, [homeDir, themeId])
53
- }
54
-
55
- export function useTerminalPalette(
56
- themeId: string | undefined,
57
- onPalette: (palette: TerminalPalette | null) => void
58
- ) {
59
- const renderer = useRenderer()
60
- const onPaletteRef = useRef(onPalette)
61
- onPaletteRef.current = onPalette
62
-
63
- useEffect(() => {
64
- if (themeId !== SYSTEM_THEME_ID) {
65
- onPaletteRef.current(null)
66
- return
67
- }
68
-
69
- let cancelled = false
70
-
71
- const publish = (colors: TerminalColors): void => {
72
- if (!cancelled) {
73
- onPaletteRef.current(terminalColorsToPalette(colors))
74
- }
75
- }
76
-
77
- void renderer.getPalette().then(colors => {
78
- publish(colors)
79
- })
80
-
81
- renderer.on('palette', publish)
82
- return () => {
83
- cancelled = true
84
- renderer.off('palette', publish)
85
- }
86
- }, [renderer, themeId])
87
- }
88
-
89
- export function useAutoUpdateScheduler(
90
- config: Config | null,
91
- hasScheduledAutoUpdateRef: MutableRefObject<boolean>
92
- ) {
93
- useEffect(() => {
94
- if (!config || hasScheduledAutoUpdateRef.current) {
95
- return
96
- }
97
-
98
- hasScheduledAutoUpdateRef.current = true
99
-
100
- const timeout = setTimeout(() => {
101
- checkAndUpdate(config).catch(error => {
102
- console.error('Auto-update check failed:', error)
103
- })
104
- }, 1000)
105
-
106
- return () => clearTimeout(timeout)
107
- }, [config, hasScheduledAutoUpdateRef])
108
- }
109
-
110
- export function useUpdateEventToasts(
111
- setUpdatedVersion: Dispatch<SetStateAction<string | null>>,
112
- setToastMessage: Dispatch<SetStateAction<string>>,
113
- setToastVisible: Dispatch<SetStateAction<boolean>>
114
- ) {
115
- useEffect(() => {
116
- const unsubscribe = updateEvents.on(event => {
117
- if (event.kind === 'updated') {
118
- setUpdatedVersion(event.version)
119
- showTemporaryToast(
120
- setToastMessage,
121
- setToastVisible,
122
- `Updated in background to v${event.version}. Restart mux-sesh to use it.`
123
- )
124
- } else if (event.kind === 'available') {
125
- showTemporaryToast(setToastMessage, setToastVisible, `Update available: v${event.version}`)
126
- } else {
127
- showTemporaryToast(
128
- setToastMessage,
129
- setToastVisible,
130
- `Background update to v${event.version} failed.`
131
- )
132
- }
133
- })
134
-
135
- return unsubscribe
136
- }, [setToastMessage, setToastVisible, setUpdatedVersion])
137
- }
138
-
139
- export function useNormalModeSessionReset(
140
- appMode: AppMode,
141
- viewMode: ViewMode,
142
- sessionItems: Item[],
143
- lastSessionSelectionRef: MutableRefObject<string | null>,
144
- setAllItems: Dispatch<SetStateAction<Item[]>>,
145
- setItems: Dispatch<SetStateAction<Item[]>>,
146
- setCursor: Dispatch<SetStateAction<number>>
147
- ) {
148
- useEffect(() => {
149
- if (appMode !== AppMode.Normal || viewMode !== ViewMode.Sessions) {
150
- return
151
- }
152
-
153
- const cleanSessions = clearMatchIndices(sessionItems)
154
- setAllItems(cleanSessions)
155
- setItems(cleanSessions)
156
- setCursor(getSessionSelectionIndex(cleanSessions, lastSessionSelectionRef.current))
157
- }, [appMode, lastSessionSelectionRef, sessionItems, setAllItems, setCursor, setItems, viewMode])
158
- }
159
-
160
- export function useNewSessionProjectCursor(
161
- appMode: AppMode,
162
- viewMode: ViewMode,
163
- projectSourceItems: Item[],
164
- sessionCandidateItems: Item[],
165
- lastProjectSelectionRef: MutableRefObject<string | null>,
166
- setCursor: Dispatch<SetStateAction<number>>
167
- ) {
168
- useEffect(() => {
169
- if (appMode !== AppMode.NewSession || viewMode !== ViewMode.Projects) {
170
- return
171
- }
172
-
173
- setCursor(
174
- getProjectSelectionIndex(
175
- sessionCandidateItems.length > 0 ? sessionCandidateItems : projectSourceItems,
176
- lastProjectSelectionRef.current
177
- )
178
- )
179
- }, [
180
- appMode,
181
- lastProjectSelectionRef,
182
- projectSourceItems,
183
- sessionCandidateItems,
184
- setCursor,
185
- viewMode,
186
- ])
187
- }
188
-
189
- export function useSessionCandidateLoader(
190
- appMode: AppMode,
191
- config: Config | null,
192
- backend: MultiplexerBackend | null,
193
- lastProjectSelectionRef: MutableRefObject<string | null>,
194
- setSessionCandidateItems: Dispatch<SetStateAction<Item[]>>,
195
- setAllItems: Dispatch<SetStateAction<Item[]>>,
196
- setItems: Dispatch<SetStateAction<Item[]>>,
197
- setCursor: Dispatch<SetStateAction<number>>
198
- ) {
199
- useEffect(() => {
200
- if (appMode !== AppMode.NewSession || !config || !backend) {
201
- return
202
- }
203
-
204
- const nextConfig = config
205
- const activeBackend = backend
206
- let cancelled = false
207
-
208
- async function loadCandidates() {
209
- const linkedCandidates = await loadSessionCandidateItems(nextConfig, measure, activeBackend)
210
- if (cancelled) {
211
- return
212
- }
213
-
214
- setSessionCandidateItems(linkedCandidates)
215
- setAllItems(linkedCandidates)
216
- setItems(linkedCandidates)
217
- setCursor(getProjectSelectionIndex(linkedCandidates, lastProjectSelectionRef.current))
218
- }
219
-
220
- void loadCandidates()
221
-
222
- return () => {
223
- cancelled = true
224
- }
225
- }, [
226
- appMode,
227
- backend,
228
- config,
229
- lastProjectSelectionRef,
230
- setAllItems,
231
- setCursor,
232
- setItems,
233
- setSessionCandidateItems,
234
- ])
235
- }
236
-
237
- export function useBoundedCursor(length: number, setCursor: Dispatch<SetStateAction<number>>) {
238
- useEffect(() => {
239
- if (length === 0) {
240
- setCursor(0)
241
- return
242
- }
243
-
244
- setCursor(current => clampCursorIndex(length, current))
245
- }, [length, setCursor])
246
- }
247
-
248
- export function useResetCursorOnValue(value: string, setCursor: Dispatch<SetStateAction<number>>) {
249
- useEffect(() => {
250
- setCursor(0)
251
- }, [setCursor, value])
252
- }
253
-
254
- export function useSelectionMemory(
255
- appMode: AppMode,
256
- viewMode: ViewMode,
257
- cursor: number,
258
- items: Item[],
259
- selectedPrimaryItem: Item | undefined,
260
- lastProjectSelectionRef: MutableRefObject<string | null>,
261
- lastSessionSelectionRef: MutableRefObject<string | null>
262
- ) {
263
- useEffect(() => {
264
- const selectedItem = appMode === AppMode.NewSession ? items[cursor] : selectedPrimaryItem
265
-
266
- if (!selectedItem) {
267
- return
268
- }
269
-
270
- if (appMode === AppMode.NewSession || viewMode === ViewMode.Projects) {
271
- if (!selectedItem.isSession) {
272
- lastProjectSelectionRef.current = selectedItem.path
273
- }
274
- return
275
- }
276
-
277
- if (viewMode === ViewMode.Sessions && appMode === AppMode.Normal) {
278
- lastSessionSelectionRef.current = getItemKey(selectedItem)
279
- }
280
- }, [
281
- appMode,
282
- cursor,
283
- items,
284
- lastProjectSelectionRef,
285
- lastSessionSelectionRef,
286
- selectedPrimaryItem,
287
- viewMode,
288
- ])
289
- }
290
-
291
- export function usePendingKillReset(
292
- pendingKillSessionName: string | null,
293
- appMode: AppMode,
294
- viewMode: ViewMode,
295
- agentSessions: Item[],
296
- agentCursor: number,
297
- regularSessions: Item[],
298
- cursor: number,
299
- setPendingKillSessionName: Dispatch<SetStateAction<string | null>>
300
- ) {
301
- useEffect(() => {
302
- if (!pendingKillSessionName) {
303
- return
304
- }
305
-
306
- const selectedSession =
307
- appMode === AppMode.AgentsManage
308
- ? agentSessions[agentCursor]
309
- : viewMode === ViewMode.Sessions
310
- ? regularSessions[cursor]
311
- : undefined
312
-
313
- if (!selectedSession || getItemKey(selectedSession) !== pendingKillSessionName) {
314
- setPendingKillSessionName(null)
315
- }
316
- }, [
317
- appMode,
318
- cursor,
319
- agentCursor,
320
- agentSessions,
321
- pendingKillSessionName,
322
- regularSessions,
323
- setPendingKillSessionName,
324
- viewMode,
325
- ])
326
- }
327
-
328
- export function useSearchFiltering(
329
- appMode: AppMode,
330
- searchQuery: string,
331
- allItems: Item[],
332
- setItems: Dispatch<SetStateAction<Item[]>>,
333
- setCursor: Dispatch<SetStateAction<number>>
334
- ) {
335
- useEffect(() => {
336
- if (appMode !== AppMode.Search && appMode !== AppMode.NewSession) {
337
- return
338
- }
339
-
340
- if (searchQuery.trim()) {
341
- setItems(filterAndSortItems(allItems, searchQuery))
342
- setCursor(0)
343
- return
344
- }
345
-
346
- setItems(allItems)
347
- setCursor(0)
348
- }, [allItems, appMode, searchQuery, setCursor, setItems])
349
- }
350
-
351
- export function useNewSessionFileSearch(
352
- appMode: AppMode,
353
- config: Config | null,
354
- searchQuery: string,
355
- sessionItems: Item[],
356
- setItems: Dispatch<SetStateAction<Item[]>>,
357
- setCursor: Dispatch<SetStateAction<number>>
358
- ) {
359
- const sessionItemsRef = useRef(sessionItems)
360
- sessionItemsRef.current = sessionItems
361
-
362
- useEffect(() => {
363
- if (appMode !== AppMode.NewSession || !config) {
364
- return
365
- }
366
-
367
- const nextConfig = config
368
- const query = searchQuery.trim()
369
-
370
- if (!query || isGitHubURL(query)) {
371
- void warmFileSearch(nextConfig)
372
- return
373
- }
374
-
375
- let cancelled = false
376
-
377
- async function runFileSearch() {
378
- const fileSearchItems = await searchFilesAndDirectories(query, nextConfig)
379
- if (cancelled || fileSearchItems.length === 0) {
380
- return
381
- }
382
-
383
- const liveSessions = sessionItemsRef.current.filter(item => item.isSession)
384
- const annotated = await annotateProjectItemsWithSessionLinks(
385
- fileSearchItems,
386
- liveSessions,
387
- nextConfig
388
- )
389
- if (cancelled) {
390
- return
391
- }
392
-
393
- setItems(current => combineFileSearchResults(annotated, current, query))
394
- setCursor(0)
395
- }
396
-
397
- const timeout = setTimeout(() => {
398
- void runFileSearch()
399
- }, FILE_SEARCH_DEBOUNCE_MS)
400
-
401
- return () => {
402
- cancelled = true
403
- clearTimeout(timeout)
404
- }
405
- }, [appMode, config, searchQuery, setCursor, setItems])
406
- }
407
-
408
- export function useOpencodeStatsPolling(
409
- selectedAgentSession: Item | undefined,
410
- loadOpencodeStatsForSession: (sessionName: string) => Promise<unknown>
411
- ) {
412
- const loadStatsRef = useRef(loadOpencodeStatsForSession)
413
- loadStatsRef.current = loadOpencodeStatsForSession
414
- const selectedSessionName =
415
- selectedAgentSession && isOpencodeSessionItem(selectedAgentSession)
416
- ? selectedAgentSession.title
417
- : undefined
418
-
419
- useEffect(() => {
420
- if (!selectedSessionName) {
421
- return
422
- }
423
-
424
- void loadStatsRef.current(selectedSessionName)
425
-
426
- const interval = setInterval(() => {
427
- void loadStatsRef.current(selectedSessionName)
428
- }, 2000)
429
-
430
- return () => {
431
- clearInterval(interval)
432
- }
433
- }, [selectedSessionName])
434
- }
435
-
436
- export function useHerdrAgentPolling(
437
- appMode: AppMode,
438
- viewMode: ViewMode,
439
- config: Config | null,
440
- backend: MultiplexerBackend | null,
441
- selectedAgentSession: Item | undefined,
442
- agentCursor: number,
443
- setSessionItems: Dispatch<SetStateAction<Item[]>>,
444
- setAllItems: Dispatch<SetStateAction<Item[]>>,
445
- setItems: Dispatch<SetStateAction<Item[]>>,
446
- setAgentCursor: Dispatch<SetStateAction<number>>,
447
- setMessage: Dispatch<SetStateAction<string>>
448
- ) {
449
- const selectedKeyRef = useRef<string | undefined>(undefined)
450
- const agentCursorRef = useRef(agentCursor)
451
- selectedKeyRef.current = selectedAgentSession ? getItemKey(selectedAgentSession) : undefined
452
- agentCursorRef.current = agentCursor
453
-
454
- useEffect(() => {
455
- if (
456
- appMode !== AppMode.AgentsManage ||
457
- viewMode !== ViewMode.Sessions ||
458
- !config ||
459
- backend?.kind !== 'herdr'
460
- ) {
461
- return
462
- }
463
-
464
- let cancelled = false
465
- let polling = false
466
- let reportedError: string | undefined
467
-
468
- const poll = async () => {
469
- if (polling) {
470
- return
471
- }
472
- polling = true
473
- try {
474
- const { sessionItems } = await loadSessionItems(config, measure, backend, 'agents-poll')
475
- if (cancelled) {
476
- return
477
- }
478
-
479
- setSessionItems(current => reuseSessionItemIdentities(current, sessionItems))
480
- setAllItems(current => reuseSessionItemIdentities(current, sessionItems))
481
- setItems(current => reuseSessionItemIdentities(current, sessionItems))
482
- setAgentCursor(
483
- getAgentSelectionIndex(sessionItems, selectedKeyRef.current, agentCursorRef.current)
484
- )
485
- if (reportedError) {
486
- const recoveredError = reportedError
487
- setMessage(current => (current === recoveredError ? '' : current))
488
- reportedError = undefined
489
- }
490
- } catch (error) {
491
- if (!cancelled && !reportedError) {
492
- reportedError = error instanceof Error ? error.message : 'Failed to refresh Herdr agents'
493
- setMessage(reportedError)
494
- }
495
- } finally {
496
- polling = false
497
- }
498
- }
499
-
500
- void poll()
501
- const interval = setInterval(() => void poll(), 2000)
502
- return () => {
503
- cancelled = true
504
- clearInterval(interval)
505
- if (reportedError) {
506
- const abandonedError = reportedError
507
- setMessage(current => (current === abandonedError ? '' : current))
508
- }
509
- }
510
- }, [
511
- appMode,
512
- backend,
513
- config,
514
- setAgentCursor,
515
- setAllItems,
516
- setItems,
517
- setMessage,
518
- setSessionItems,
519
- viewMode,
520
- ])
521
- }
522
-
523
- interface UseAppBehaviorsOptions {
524
- appMode: AppMode
525
- viewMode: ViewMode
526
- config: Config | null
527
- backend: MultiplexerBackend | null
528
- sessionItems: Item[]
529
- projectSourceItems: Item[]
530
- sessionCandidateItems: Item[]
531
- lastSessionSelectionRef: MutableRefObject<string | null>
532
- lastProjectSelectionRef: MutableRefObject<string | null>
533
- setAllItems: Dispatch<SetStateAction<Item[]>>
534
- setItems: Dispatch<SetStateAction<Item[]>>
535
- setSessionItems: Dispatch<SetStateAction<Item[]>>
536
- setCursor: Dispatch<SetStateAction<number>>
537
- setAgentCursor: Dispatch<SetStateAction<number>>
538
- setMessage: Dispatch<SetStateAction<string>>
539
- setSessionCandidateItems: Dispatch<SetStateAction<Item[]>>
540
- filteredCommandEntriesLength: number
541
- setCommandsCursor: Dispatch<SetStateAction<number>>
542
- commandsSearchQuery: string
543
- filteredSettingsEntriesLength: number
544
- setSettingsCursor: Dispatch<SetStateAction<number>>
545
- filteredSettingOptionsLength: number
546
- setSettingOptionsCursor: Dispatch<SetStateAction<number>>
547
- cursor: number
548
- items: Item[]
549
- selectedPrimaryItem: Item | undefined
550
- pendingKillSessionName: string | null
551
- agentSessions: Item[]
552
- agentCursor: number
553
- regularSessions: Item[]
554
- setPendingKillSessionName: Dispatch<SetStateAction<string | null>>
555
- searchQuery: string
556
- allItems: Item[]
557
- selectedAgentSession: Item | undefined
558
- loadOpencodeStatsForSession: (sessionName: string) => Promise<unknown>
559
- setUpdatedVersion: Dispatch<SetStateAction<string | null>>
560
- setToastMessage: Dispatch<SetStateAction<string>>
561
- setToastVisible: Dispatch<SetStateAction<boolean>>
562
- homeDir: string
563
- onSystemThemeRefresh: () => void
564
- onTerminalPalette: (palette: TerminalPalette | null) => void
565
- }
566
-
567
- export function useAppBehaviors(options: UseAppBehaviorsOptions) {
568
- useSystemThemeFollow(options.config?.theme, options.homeDir, options.onSystemThemeRefresh)
569
- useTerminalPalette(options.config?.theme, options.onTerminalPalette)
570
- useUpdateEventToasts(options.setUpdatedVersion, options.setToastMessage, options.setToastVisible)
571
- useNormalModeSessionReset(
572
- options.appMode,
573
- options.viewMode,
574
- options.sessionItems,
575
- options.lastSessionSelectionRef,
576
- options.setAllItems,
577
- options.setItems,
578
- options.setCursor
579
- )
580
- useNewSessionProjectCursor(
581
- options.appMode,
582
- options.viewMode,
583
- options.projectSourceItems,
584
- options.sessionCandidateItems,
585
- options.lastProjectSelectionRef,
586
- options.setCursor
587
- )
588
- useSessionCandidateLoader(
589
- options.appMode,
590
- options.config,
591
- options.backend,
592
- options.lastProjectSelectionRef,
593
- options.setSessionCandidateItems,
594
- options.setAllItems,
595
- options.setItems,
596
- options.setCursor
597
- )
598
- useBoundedCursor(options.filteredCommandEntriesLength, options.setCommandsCursor)
599
- useResetCursorOnValue(options.commandsSearchQuery, options.setCommandsCursor)
600
- useBoundedCursor(options.filteredSettingsEntriesLength, options.setSettingsCursor)
601
- useBoundedCursor(options.filteredSettingOptionsLength, options.setSettingOptionsCursor)
602
- useSelectionMemory(
603
- options.appMode,
604
- options.viewMode,
605
- options.cursor,
606
- options.items,
607
- options.selectedPrimaryItem,
608
- options.lastProjectSelectionRef,
609
- options.lastSessionSelectionRef
610
- )
611
- usePendingKillReset(
612
- options.pendingKillSessionName,
613
- options.appMode,
614
- options.viewMode,
615
- options.agentSessions,
616
- options.agentCursor,
617
- options.regularSessions,
618
- options.cursor,
619
- options.setPendingKillSessionName
620
- )
621
- useSearchFiltering(
622
- options.appMode,
623
- options.searchQuery,
624
- options.allItems,
625
- options.setItems,
626
- options.setCursor
627
- )
628
- useNewSessionFileSearch(
629
- options.appMode,
630
- options.config,
631
- options.searchQuery,
632
- options.sessionItems,
633
- options.setItems,
634
- options.setCursor
635
- )
636
- useOpencodeStatsPolling(options.selectedAgentSession, options.loadOpencodeStatsForSession)
637
- useHerdrAgentPolling(
638
- options.appMode,
639
- options.viewMode,
640
- options.config,
641
- options.backend,
642
- options.selectedAgentSession,
643
- options.agentCursor,
644
- options.setSessionItems,
645
- options.setAllItems,
646
- options.setItems,
647
- options.setAgentCursor,
648
- options.setMessage
649
- )
650
- }