Documentation
¶
Index ¶
Constants ¶
const ( // DefaultSyncInterval is the base interval for syncing files DefaultSyncInterval = 30 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func GetInboxPath ¶
GetInboxPath returns the path to the event inbox file for a given external ID
func GetStatePath ¶
GetStatePath returns the path to the state file for a given external ID
func GetSyncDir ¶
GetSyncDir returns the path to the sync state directory
Types ¶
type Config ¶
type Config struct {
ExternalID string
TranscriptPath string
CWD string
ParentPID int // Claude Code process ID to monitor (0 to disable)
SyncInterval time.Duration
SyncIntervalJitter time.Duration // 0 to disable jitter (for testing)
}
Config holds daemon configuration
type Daemon ¶
type Daemon struct {
// contains filtered or unexported fields
}
Daemon is the background sync process.
The daemon is resilient to backend unavailability - it will keep running and retry connecting to the backend on each sync interval. Once connected, it will sync any accumulated changes.
If ParentPID is set, the daemon monitors the parent process and shuts down gracefully when it exits. This handles cases where Claude Code crashes or is killed without firing the SessionEnd hook.
type State ¶
type State struct {
ExternalID string `json:"external_id"`
TranscriptPath string `json:"transcript_path"`
CWD string `json:"cwd"`
PID int `json:"pid"`
ParentPID int `json:"parent_pid,omitempty"` // Claude Code process ID
InboxPath string `json:"inbox_path"` // Path to event inbox (JSONL)
StartedAt time.Time `json:"started_at"`
ConfabSessionID string `json:"confab_session_id,omitempty"` // Backend session ID (set after Init)
}
State represents the daemon's persistent state
func ListAllStates ¶
ListAllStates returns all active sync states
func LoadState ¶
LoadState reads the state from disk for a given external ID Returns nil if the state file doesn't exist
func NewState ¶
NewState creates a new daemon state. parentPID is the Claude Code process ID to monitor (0 to disable monitoring).
func (*State) IsDaemonRunning ¶
IsDaemonRunning checks if the daemon process is still alive
func (*State) IsParentRunning ¶
IsParentRunning checks if the parent Claude Code process is still alive