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) Context() *repocontext.Service
- func (e *Engine) DB() *db.DB
- func (e *Engine) Doctor(validator doctor.ConfigValidator, plugins []doctor.PluginInfo) *doctor.Service
- func (e *Engine) Git() git.Git
- func (e *Engine) GitStatus() *gitstatus.Service
- func (e *Engine) HC() *hcsvc.Service
- func (e *Engine) Messages() *msgsvc.Service
- func (e *Engine) Reload(cfg *config.Config) error
- func (e *Engine) Renderer() *tmpl.Renderer
- func (e *Engine) Sessions() *sessionsvc.Service
- func (e *Engine) Status() *statussvc.Service
- func (e *Engine) Terminal() *terminal.Manager
- func (e *Engine) Todos() *todosvc.Service
- type NotificationRouter
- type Ports
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.
func (*Engine) Config ¶ added in v0.60.0
Config returns the config the current services were built from.
func (*Engine) Context ¶ added in v0.60.0
func (e *Engine) Context() *repocontext.Service
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) HC ¶ added in v0.60.0
HC returns the honeycomb service. It reads no config, so 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 honeycomb service are kept, so a changed database section or data dir still needs a restart.
func (*Engine) Renderer ¶ added in v0.60.0
Renderer returns the template renderer for the current default agent.
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.
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, opened with OpenDB. The program closes it.
DB *db.DB
// Bus is the event bus. The program starts and stops it.
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
}
Ports are the drivers and process-lived handles a program gives the engine. None of them is rebuilt on Reload.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package doctor runs health checks on a hive setup.
|
Package doctor runs health checks on a hive setup. |
|
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 messaging publishes and reads inter-agent messages.
|
Package messaging publishes and reads inter-agent messages. |
|
Package repocontext manages per-repository context directories.
|
Package repocontext manages per-repository context directories. |
|
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 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. |