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
//! Object Model for exposing terminal state to Fusabi scripts
//!
//! This module provides handle-based proxies that allow Fusabi scripts
//! to interact with Window, Pane, and Tab objects.
//!
//! # Architecture
//!
//! The object model uses a handle-based approach similar to WezTerm's Lua API:
//!
//! 1. **Handles**: Lightweight, copyable references to objects
//! 2. **Registry**: Centralized storage for objects with lifecycle management
//! 3. **Generation Counters**: Detect stale handles after object deletion
//!
//! # Example
//!
//! ```
//! use scarab_plugin_api::object_model::{ObjectHandle, ObjectType, WindowProxy};
//!
//! // Create a handle
//! let handle = ObjectHandle::new(ObjectType::Window, 1, 0);
//!
//! // Create a proxy from the handle
//! let window = WindowProxy::new(handle).unwrap();
//!
//! // Check validity
//! assert!(handle.is_valid(0));
//! assert!(!handle.is_valid(1));
//! ```
//!
//! # Handle-Based Design
//!
//! Instead of passing raw object references to scripts, we use handles:
//!
//! - **Safety**: Scripts can't hold dangling references
//! - **Serialization**: Handles can cross process boundaries
//! - **Invalidation**: Generation counters detect deleted objects
//! - **Type Safety**: ObjectType enum prevents type confusion
//!
//! # Lifecycle Management
//!
//! Objects follow this lifecycle:
//!
//! 1. **Registration**: Object is stored, handle is returned
//! 2. **Access**: Handle is used to retrieve object from registry
//! 3. **Unregistration**: Object is removed, generation is incremented
//! 4. **Invalidation**: Old handles fail validation checks
//!
//! # Thread Safety
//!
//! All types in this module are designed to be `Send + Sync`:
//!
//! - Handles contain only primitive types
//! - Registry trait can be implemented with appropriate locking
//! - Errors are cloneable for propagation across threads
pub use ;
pub use ;
pub use PaneProxy;
pub use ;
pub use TabProxy;
pub use WindowProxy;