main 5041353

session_state.go RawHistoryFolder

1package port
2
3import (
4	"context"
5
6	"github.com/bnema/dumber/internal/domain/entity"
7)
8
9// WindowStateProvider provides window-scoped browser state for v2 snapshots.
10// Implemented by the UI layer and consumed by the snapshot service.
11type WindowStateProvider interface {
12	// GetWindowSnapshotState returns the ordered window tab lists and active window index atomically.
13	GetWindowSnapshotState() ([]entity.WindowTabListState, int)
14	// GetWindowTabLists returns the ordered list of windows with their tab lists.
15	// For consistent reads alongside GetActiveWindowIndex, prefer GetWindowSnapshotState.
16	GetWindowTabLists() []entity.WindowTabListState
17	// GetActiveWindowIndex returns the index of the currently focused window.
18	// For consistent reads alongside GetWindowTabLists, prefer GetWindowSnapshotState.
19	GetActiveWindowIndex() int
20	// GetSessionID returns the current session ID.
21	GetSessionID() entity.SessionID
22}
23
24// SessionSpawner spawns a new dumber instance for resurrection.
25type SessionSpawner interface {
26	// SpawnWithSession starts a new dumber instance to restore a session.
27	SpawnWithSession(sessionID entity.SessionID) error
28}
29
30// SessionSpawnEnvironment provides engine-specific environment overrides for
31// spawned restore-session processes. Implementations are optional: engines that
32// do not need extra launch environment can leave this nil.
33type SessionSpawnEnvironment interface {
34	// RootCacheEnvVar returns the environment variable used to override the
35	// engine's root cache/data directory.
36	RootCacheEnvVar() string
37	// SessionRootCachePath returns the engine-specific root cache/data path for
38	// the provided restored session.
39	SessionRootCachePath(sessionID entity.SessionID) string
40}
41
42// SnapshotService manages debounced session-state snapshots.
43type SnapshotService interface {
44	// Start begins the snapshot service with the given context.
45	Start(ctx context.Context)
46	// Stop stops the service and saves the final state.
47	Stop(ctx context.Context) error
48	// SetReady marks the service as ready to save snapshots.
49	// Call this after the session has been persisted to the database.
50	SetReady()
51	// MarkDirty signals that session state has changed and should be saved.
52	MarkDirty()
53	// SaveNow forces an immediate save (e.g. for shutdown).
54	SaveNow(ctx context.Context) error
55}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close