1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
//! Session driver for reovim.
//!
//! Provides traits and types for session management.
//!
//! # Overview
//!
//! This driver provides:
//!
//! - **Session infrastructure**: Shared state ([`SessionShared`]) and runtime ([`SessionRuntime`])
//! - **Client identification**: [`ClientId`] for explicit client binding
//! - **Window management**: [`Window`], [`WindowLayout`], [`CursorPosition`]
//! - **Mode lifecycle**: Runtime mode hooks ([`SessionMode`], [`ModeError`])
//! - **Extension system**: Module per-session state ([`SessionExtension`], [`ExtensionMap`])
//! - **Empty session handling**: Startup behavior ([`EmptySessionHandler`])
//!
//! # Architecture (#471, #491)
//!
//! ```text
//! ┌─────────────────────────────────────────────────────────────────┐
//! │ SESSION DRIVER (server/lib/drivers/session/) - PURE MECHANISM │
//! │ │
//! │ SHARED INFRASTRUCTURE: │
//! │ Session { id, shared: SessionShared } │
//! │ SessionShared { compositor, home_mode } │
//! │ │
//! │ RUNTIME (borrows shared + per-client state): │
//! │ SessionRuntime::new(&session, &mode_stack, &windows, ...) │
//! │ │
//! │ PER-CLIENT TYPES (defined here, owned by server::EditingState): │
//! │ ModeStack, WindowLayout, KeySequence, ExtensionMap, Viewport │
//! │ │
//! │ LIFECYCLE TRAITS: │
//! │ SessionMode: id(), on_enter(), on_exit() │
//! │ SessionExtension: create() - module state factory │
//! │ EmptySessionHandler: handle() - startup behavior │
//! └─────────────────────────────────────────────────────────────────┘
//! ```
//!
//! # Per-Client State (#471 Phase 0)
//!
//! Per-client state (mode, cursor, selection) lives in `server::EditingState`,
//! not in this driver. The driver provides shared infrastructure only.
//! Use [`SessionRuntime::new`] with per-client state, or [`SessionRuntime::with_owner`]
//! for explicit client binding. Per-client state is now REQUIRED (no Option wrappers).
//!
//! # Empty Session Handling
//!
//! The [`EmptySessionHandler`] trait defines how to handle sessions
//! with no buffers. Modules implement this to define policy (e.g.,
//! create a scratch buffer, show a welcome screen).
//!
//! ```ignore
//! use reovim_driver_session::{
//! EmptySessionHandler, EmptySessionContext, EmptySessionAction
//! };
//!
//! struct MyHandler;
//!
//! impl EmptySessionHandler for MyHandler {
//! fn handle(&self, ctx: &EmptySessionContext) -> EmptySessionAction {
//! EmptySessionAction::CreateBuffer {
//! name: None,
//! content: String::new(),
//! }
//! }
//! fn id(&self) -> &'static str { "my-module:handler" }
//! fn description(&self) -> &'static str { "My handler" }
//! }
//! ```
//!
//! # Session Extension
//!
//! Modules store per-session policy state via [`SessionExtension`]:
//!
//! ```ignore
//! use reovim_driver_session::{SessionExtension, ExtensionMap};
//!
//! #[derive(Default)]
//! pub struct VimSessionState {
//! pub pending_count: Option<usize>,
//! }
//!
//! impl SessionExtension for VimSessionState {
//! fn create() -> Self { Self::default() }
//! }
//!
//! // Access in resolver
//! let vim = session.extensions.get_or_insert::<VimSessionState>();
//! vim.pending_count = Some(5);
//! ```
// Empty session handling
pub use ;
// Initial mode provider for cross-personality support (#623)
pub use InitialModeProvider;
// Leader key provider for personality-aware binding expansion (#700)
pub use ;
// Session extension system
pub use ;
// Operator-pending state for text object communication
pub use OperatorPendingState;
// Mode lifecycle
pub use ;
// Session types
pub use ;
// SessionContext removed in #491 - use SessionRuntime instead
// Transition types
pub use ;
// Session runtime (implements all API traits)
pub use SessionRuntime;
// Session API traits (re-export for convenience)
pub use ;
// Tab page management (#401)
pub use ;
// Re-export typed key and registry (Epic #417 - UniqueProvider abstraction)
pub use ;
// Pending notification queue (#542 - cross-module decoupling, #691 - progress ops)
pub use ;
// Notification drain trait (#542 - decouple completion from notification module)
pub use ;
// Snippet expander trait (#542 - decouple completion from snippet module)
pub use ;
// Tick scheduler (#546 - periodic state advancement)
pub use ;
pub use BufferReadAccess;