daemon

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2026 License: Apache-2.0 Imports: 27 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func Run

func Run(ctx context.Context, opt Options) error

Run starts the daemon and blocks until ctx is cancelled or a fatal error occurs.

Types

type Daemon

type Daemon struct {
	// contains filtered or unexported fields
}

Daemon is a running instance.

func (*Daemon) URL

func (d *Daemon) URL() string

URL returns the bound base URL (after start).

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"`
	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"`
	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"`
	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"`
}

Status is /v1/status.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL