Documentation
¶
Overview ¶
Package hive is the hive engine both programs run on. Each application service lives in its own subpackage; Engine composes them over the drivers a program hands it and rebuilds the config-derived ones on Reload.
Index ¶
- func NewTerminalManager(logger zerolog.Logger, cfg *config.Config, source terminal.PaneSource) *terminal.Manager
- func OpenDB(ctx context.Context, dataDir string, opts config.DatabaseConfig) (*db.DB, error)
- func StatusOptionsFromConfig(cfg config.TerminalStatusConfig, pollInterval time.Duration) status.Options
- type Engine
- func (e *Engine) Bus() *events.EventBus
- func (e *Engine) Config() *config.Config
- func (e *Engine) Doctor(validator doctor.ConfigValidator, plugins []doctor.PluginInfo) *doctor.Service
- func (e *Engine) Drive() *drivesvc.Service
- func (e *Engine) DriveRemote() *driveremote.Service
- func (e *Engine) Git() git.Git
- func (e *Engine) GitStatus() *gitstatus.Service
- func (e *Engine) HC() *hcsvc.Service
- func (e *Engine) KV() kv.KV
- func (e *Engine) Messages() *msgsvc.Service
- func (e *Engine) Notifications() notify.Store
- func (e *Engine) Reload(cfg *config.Config) error
- func (e *Engine) Renderer() *tmpl.Renderer
- func (e *Engine) Reviews() review.Store
- func (e *Engine) Sessions() *sessionsvc.Service
- func (e *Engine) Status() *statussvc.Service
- func (e *Engine) SweepKV(ctx context.Context, interval time.Duration)
- func (e *Engine) Terminal() *terminal.Manager
- func (e *Engine) Todos() *todosvc.Service
- type NotificationRouter
- type Ports
- type Runtime
- type RuntimeOptions
- type StartError
- type StartStep
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTerminalManager ¶ added in v0.58.0
func NewTerminalManager(logger zerolog.Logger, cfg *config.Config, source terminal.PaneSource) *terminal.Manager
NewTerminalManager builds the terminal integration manager from config. tmux is always enabled; availability is checked lazily by the manager.
func OpenDB ¶ added in v0.60.0
OpenDB opens hive.db in dataDir and imports the JSON stores that predate it.
func StatusOptionsFromConfig ¶ added in v0.60.0
func StatusOptionsFromConfig(cfg config.TerminalStatusConfig, pollInterval time.Duration) status.Options
StatusOptionsFromConfig maps the terminal.status config section onto the status tracker's debounce options.
Confirm.Missing is not part of status.Options: the tmux transport reads it as a retry count for failed list-panes calls, not as a tracker rule.
Types ¶
type Engine ¶ added in v0.60.0
type Engine struct {
// contains filtered or unexported fields
}
Engine is the hive engine. Accessors return the services built from the current config. Fetch a service per call (e.Sessions().X) and do not hold it across a Reload, or it keeps serving the old config.
The drive service is the exception: it holds the snapshot of the context root, so it is built once and follows a Reload through Reconfigure.
func (*Engine) Config ¶ added in v0.60.0
Config returns the config the current services were built from.
func (*Engine) Doctor ¶ added in v0.60.0
func (e *Engine) Doctor(validator doctor.ConfigValidator, plugins []doctor.PluginInfo) *doctor.Service
Doctor returns the health checks for the current config. validator checks the program's whole config: a program whose config has sections the engine does not read passes its own, so those sections are checked too. plugins is what the program wants reported; the engine has none.
func (*Engine) Drive ¶ added in v0.64.0
Drive returns the Hive Drive service. Reload keeps it and re-roots it.
func (*Engine) DriveRemote ¶ added in v0.66.0
func (e *Engine) DriveRemote() *driveremote.Service
DriveRemote returns the drive server client service, or nil when the program gave the engine no credential store.
func (*Engine) HC ¶ added in v0.60.0
HC returns the honeycomb service. It reads no config, so Reload keeps it.
func (*Engine) KV ¶ added in v0.63.0
KV returns the persistent key-value store. Reload keeps it. The runtime runs SweepKV.
func (*Engine) Notifications ¶ added in v0.63.0
Notifications returns the notification history. Reload keeps it.
func (*Engine) Reload ¶ added in v0.60.0
Reload swaps in services built from cfg and publishes config.reloaded. A config that fails validation changes nothing: the running services keep serving the config they were built from.
The database, the bus, and the services that read no config (honeycomb, KV, notifications, reviews) are kept, so a changed database section or data dir still needs a restart. The drive service is kept too and handed the new config and git executor; it re-roots itself when the context dir moved.
func (*Engine) Renderer ¶ added in v0.60.0
Renderer returns the template renderer for the current default agent.
func (*Engine) Reviews ¶ added in v0.63.0
Reviews returns the document review sessions and comments. Reload keeps it.
func (*Engine) Sessions ¶ added in v0.60.0
func (e *Engine) Sessions() *sessionsvc.Service
func (*Engine) Status ¶ added in v0.60.0
Status returns the terminal status service, or nil without a PaneSource.
func (*Engine) SweepKV ¶ added in v0.63.0
SweepKV deletes expired KV entries every interval until ctx is done. Reads already treat an expired entry as missing; the sweep only reclaims the rows.
type NotificationRouter ¶ added in v0.60.0
type NotificationRouter struct {
// contains filtered or unexported fields
}
NotificationRouter maps domain events to user-facing notifications.
func NewNotificationRouter ¶ added in v0.60.0
func NewNotificationRouter(bus *events.EventBus) *NotificationRouter
NewNotificationRouter constructs a router for event-to-notification mappings.
func (*NotificationRouter) Register ¶ added in v0.60.0
func (r *NotificationRouter) Register()
Register subscribes all supported event mappings.
type Ports ¶ added in v0.60.0
type Ports struct {
// DB is hive.db and Bus the event bus. New requires both; StartRuntime
// opens them itself and rejects ones the caller sets.
DB *db.DB
Bus *events.EventBus
Executor executil.Executor
Mux sessionsvc.Multiplexer
// PaneSource feeds terminal status. Nil disables status: Status and
// Terminal return nil.
PaneSource terminal.PaneSource
// DataDir holds the bundled scripts the renderer points spawn commands at.
DataDir string
// Styler, Stdout and Stderr shape hook and file-copy output. Nil means
// plain text to io.Discard.
Styler sessionsvc.OutputStyler
Stdout io.Writer
Stderr io.Writer
Logger zerolog.Logger
// Credentials holds the drive server token. Nil disables DriveRemote.
Credentials credentials.Store
}
Ports are the drivers and process-lived handles a program gives the engine. None of them is rebuilt on Reload.
type Runtime ¶ added in v0.66.0
type Runtime struct {
// contains filtered or unexported fields
}
Runtime owns the process-lifetime half of the engine: hive.db, the event bus and its goroutine, the engine, and the KV sweep. A config reload goes through Engine().Reload and keeps all of them.
func StartRuntime ¶ added in v0.66.0
StartRuntime opens hive.db, starts the bus, builds the engine from cfg, and starts the KV sweep. Background work stops when ctx is done or on Close. A failed step closes everything the earlier steps opened.
func (*Runtime) Bus ¶ added in v0.66.0
Bus returns the event bus. Subscribing after StartRuntime is safe.
func (*Runtime) Close ¶ added in v0.66.0
Close stops the drive watcher and the background goroutines, then closes hive.db. It is idempotent and returns the first call's error. A drive watcher that fails to stop only warns: it must not fail the shutdown.
type RuntimeOptions ¶ added in v0.66.0
type RuntimeOptions struct {
// Ports are the program's drivers. DB and Bus must be nil: the runtime
// opens them.
Ports Ports
// ScriptsVersion stamps the bundled scripts extracted into the data dir.
ScriptsVersion string
}
RuntimeOptions is what a program hands StartRuntime.
type StartError ¶ added in v0.66.0
StartError is a StartRuntime failure. Error returns the cause's message unchanged; Step lets a caller add context per step.
func (*StartError) Error ¶ added in v0.66.0
func (e *StartError) Error() string
func (*StartError) Unwrap ¶ added in v0.66.0
func (e *StartError) Unwrap() error
Directories
¶
| Path | Synopsis |
|---|---|
|
Package daemon serves sessionapi.API for one hive data directory on a unix socket, so every client on the machine shares one writer and one status tracker.
|
Package daemon serves sessionapi.API for one hive data directory on a unix socket, so every client on the machine shares one writer and one status tracker. |
|
daemonpath
Package daemonpath names the files of the hive daemon for a data directory, so a client finds them without importing the daemon.
|
Package daemonpath names the files of the hive daemon for a data directory, so a client finds them without importing the daemon. |
|
wire
Package wire converts between the hive.daemon.v1 messages and the Go types sessionapi.API speaks, for both the daemon and its client.
|
Package wire converts between the hive.daemon.v1 messages and the Go types sessionapi.API speaks, for both the daemon and its client. |
|
Package daemonclient implements sessionapi.API against a hive daemon.
|
Package daemonclient implements sessionapi.API against a hive daemon. |
|
Package doctor runs health checks on a hive setup.
|
Package doctor runs health checks on a hive setup. |
|
Package drive is the Hive Drive service: the document tree under the context root, served from one in-memory snapshot per space.
|
Package drive is the Hive Drive service: the document tree under the context root, served from one in-memory snapshot per space. |
|
Package driveremote copies Hive Drive documents to and from a drive server.
|
Package driveremote copies Hive Drive documents to and from a drive server. |
|
Code generated by gobusgen; DO NOT EDIT.
|
Code generated by gobusgen; DO NOT EDIT. |
|
testbus
Package testbus provides test utilities for the event bus.
|
Package testbus provides test utilities for the event bus. |
|
Package gitstatus reads the git state of session checkouts: branch, dirty tree, unpushed commits and the line delta against the default branch.
|
Package gitstatus reads the git state of session checkouts: branch, dirty tree, unpushed commits and the line delta against the default branch. |
|
Package hc is the honeycomb task service.
|
Package hc is the honeycomb task service. |
|
Package hivetest builds a hive.Engine over a temp database, a recording executor, and a tmux stand-in, for tests in any package that needs one.
|
Package hivetest builds a hive.Engine over a temp database, a recording executor, and a tmux stand-in, for tests in any package that needs one. |
|
Package messaging publishes and reads inter-agent messages.
|
Package messaging publishes and reads inter-agent messages. |
|
Package servers is the fleet of hive servers a client works with: the local daemon (or engine) and each server under servers: in config.yaml, reached over ssh.
|
Package servers is the fleet of hive servers a client works with: the local daemon (or engine) and each server under servers: in config.yaml, reached over ssh. |
|
Package session is the session service: create, recycle, rename, delete and prune sessions, and spawn their terminals.
|
Package session is the session service: create, recycle, rename, delete and prune sessions, and spawn their terminals. |
|
scripts
Package scripts embeds and extracts bundled helper scripts (hive-tmux, agent-send).
|
Package scripts embeds and extracts bundled helper scripts (hive-tmux, agent-send). |
|
Package sessionapi is the session view the hive TUI, the CLI, and Hive Desktop share.
|
Package sessionapi is the session view the hive TUI, the CLI, and Hive Desktop share. |
|
Package status reads agent terminal status for sessions and repositories.
|
Package status reads agent terminal status for sessions and repositories. |
|
Package todo is the todo service and its creation limiter.
|
Package todo is the todo service and its creation limiter. |