Documentation
¶
Index ¶
- Constants
- func GetInboxPathForProvider(provider, externalID string) (string, error)
- func GetStatePathForProvider(provider, externalID string) (string, error)
- func GetSyncDir() (string, error)
- func StopDaemon(externalID string, hookInput *types.ClaudeHookInput) error
- func StopDaemonForProvider(providerName, externalID string, hookInput *types.ClaudeHookInput) error
- type Config
- type Daemon
- type State
Constants ¶
const ( // DefaultSyncInterval is the base interval for syncing files DefaultSyncInterval = 30 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func GetInboxPathForProvider ¶ added in v0.16.0
GetInboxPathForProvider returns the namespaced inbox file path.
func GetStatePathForProvider ¶ added in v0.16.0
GetStatePathForProvider returns the namespaced state file path.
func GetSyncDir ¶
GetSyncDir returns the path to the sync state directory
func StopDaemon ¶
func StopDaemon(externalID string, hookInput *types.ClaudeHookInput) error
StopDaemon sends SIGTERM to a running daemon by external ID. If hookInput is provided, it writes a session_end event to the daemon's inbox before signaling, so the daemon can access the full SessionEnd payload.
func StopDaemonForProvider ¶ added in v0.16.0
func StopDaemonForProvider(providerName, externalID string, hookInput *types.ClaudeHookInput) error
StopDaemonForProvider sends SIGTERM to a running daemon by provider and external ID.
Types ¶
type Config ¶
type Config struct {
Provider string
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 {
Provider string `json:"provider,omitempty"`
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 LoadStateForProvider ¶ added in v0.16.0
LoadStateForProvider reads a provider-namespaced state file. Claude Code falls back to the legacy flat path so old daemons and existing hooks keep working.
func NewStateForProvider ¶ added in v0.16.0
NewStateForProvider creates a daemon state under a provider namespace.
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