daemon

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: GPL-3.0 Imports: 50 Imported by: 0

Documentation

Overview

Package daemon assembles the magus daemon HTTP server: it mounts the MCP Streamable-HTTP handler, the k8s health routes, and the browser Graph Explorer console onto one loopback listener, applying the shared bearer and DNS-rebind guards. It is the composition point that ties together internal/handler/mcp, internal/httpx, and internal/service/console so neither the handler/mcp package nor the root magus package has to.

The CLI injects a *Daemon into the root magus package via magus.SetDaemon; magus.ServeDaemon then delegates here. That indirection keeps magus free of an import cycle (daemon depends on magus, not vice versa).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Daemon

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

Daemon assembles and runs the daemon HTTP server from a set of MCP server options. It satisfies magus.Daemon.

func New

func New(opts mcp.Options, options ...Option) *Daemon

New returns a Daemon that will serve the MCP endpoint (plus health routes and the console) described by opts.

func (*Daemon) Serve

func (s *Daemon) Serve(ctx context.Context) error

Serve starts the daemon HTTP server, blocking until ctx is cancelled or the server fails. Multiple MCP clients can connect concurrently.

type Option

type Option func(*Daemon)

Option customizes a Daemon.

func WithActivityWorkspaces added in v0.4.0

func WithActivityWorkspaces(fn func() []activityhandler.Workspace) Option

WithActivityWorkspaces supplies the daemon's live workspace set (the same per-workspace registry snapshot that feeds the proc Status RPC), so the activity view merges every loaded workspace's trail instead of only the bridge workspace's. Sharing one source keeps the activity view and the status view from disagreeing about which workspaces exist. When unset, the activity view still serves the bridge workspace's own trail.

func WithRuns

func WithRuns(fn func() []types.StatusRun) Option

WithRuns supplies the daemon's live-run source (the run registry's Snapshot). When set, the StatusService (GetStatus/StreamStatus) and the status SSE frame carry the per-target execution state of every adopted run alongside the pool - the same status surface, more live state.

func WithServices

func WithServices(fn func() []types.StatusService) Option

WithServices supplies the daemon's hosted-services source (the service registry's Snapshot). When set, the StatusService and the status SSE frame carry the long-running shared services the daemon is keeping warm alongside the pool and runs.

Jump to

Keyboard shortcuts

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