Documentation
¶
Overview ¶
Package daemon wires every component into the running `caprock up` process: store, pricing, recorder, hookd, ingest, loop detector, API/WS server, the idle sweeper, and the runtime.json lifecycle.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Daemon ¶
type Daemon struct {
// contains filtered or unexported fields
}
Daemon is a running instance.
type Options ¶
type Options struct {
DataDir string
Config config.Config
Version string
Log *slog.Logger
TranscriptRoot string // "" ⇒ ~/.claude/projects
// Listener overrides the port (tests pass a pre-bound 127.0.0.1:0 listener).
Listener net.Listener
// DisableIngest turns transcript tailing off (tests, or hooks-only mode).
DisableIngest bool
// IdleAfter is the silence threshold before a session is marked idle.
IdleAfter time.Duration
// EndAfter is the silence threshold before a session is marked ended (default 12h).
EndAfter time.Duration
// HiveDir enables Phase 2 orchestration (tasks board + Stop-loop) at this path.
// Empty ⇒ orchestration off (task endpoints return 501).
HiveDir string
// RepoCwd is the repo the orchestrator + workers operate on (default: cwd).
RepoCwd string
// OnReady is called once the server is listening (with the bound URL).
OnReady func(url string)
}
Options configure a daemon run.
type PricingStatus ¶
type PricingStatus struct {
Version string `json:"version"`
Source string `json:"source"`
FetchedAt string `json:"fetched_at"`
UserOverride bool `json:"user_override"`
Models int `json:"models"`
}
PricingStatus summarizes the table in force.
type Status ¶
type Status struct {
Version string `json:"version"`
// Platform is GOOS/GOARCH — the first thing a bug report needs and the
// last thing anyone remembers to include.
Platform string `json:"platform"`
PID int `json:"pid"`
StartedAt int64 `json:"started_at"`
UptimeS int64 `json:"uptime_s"`
URL string `json:"url"`
DataDir string `json:"data_dir"`
Pricing PricingStatus `json:"pricing"`
Ingest *ingest.Stats `json:"ingest,omitempty"`
// IngestError is the terminal error that stopped transcript ingest, when
// one happened (a read-only ~/.claude, a vanished transcript root). Empty
// while ingest is running. Without it the daemon looked healthy while
// capturing nothing, and the dashboard told the user to start `claude` and
// wait for sessions that could never arrive.
IngestError string `json:"ingest_error,omitempty"`
Hooks *hooks.Status `json:"hooks,omitempty"`
UIBuilt bool `json:"ui_built"`
ClaudeAvailable bool `json:"claude_available"`
OwnedActive int `json:"owned_active"`
Orchestration bool `json:"orchestration"`
// Hive is the orchestration directory in force, and Repo the checkout its
// workers operate on. Both empty when orchestration is off. Without them
// there was no way — CLI, API or log — to ask which hive a running daemon
// had been started with.
Hive string `json:"hive,omitempty"`
Repo string `json:"repo,omitempty"`
// SuggestedHive and SuggestedRepo are what POST /v1/hive would use if it were
// called with no body — the defaults the dashboard shows for confirmation
// before turning the runner on. Present only while orchestration is off.
SuggestedHive string `json:"suggested_hive,omitempty"`
SuggestedRepo string `json:"suggested_repo,omitempty"`
LoopK int `json:"loop_k"`
LoopTMin int `json:"loop_t_minutes"`
ActiveLoops int `json:"active_loops"`
Events int64 `json:"events"`
RetentionDays int `json:"retention_days"`
// Desktop is the Claude desktop app's own plan usage, when it has any on
// this machine. Omitted entirely otherwise — most people do not use it.
Desktop *desktop.Reading `json:"desktop,omitempty"`
}
Status is /v1/status.