Documentation
¶
Overview ¶
Package server implements the bcd HTTP API server.
The server exposes workspace state over HTTP so the bc CLI can operate as a thin client. It binds to localhost only by default and serves:
- REST API at /api/… (JSON, one handler file per resource)
- SSE stream at /api/events (real-time agent state updates)
- Static web UI at / (embedded web/dist, served when built)
- Health probe at /health
Default address: 127.0.0.1:9374
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BuildInfo ¶
type BuildInfo struct {
Commit string // short git commit hash
BuiltAt string // UTC build timestamp (RFC 3339)
}
BuildInfo holds build-time metadata injected via ldflags.
type Config ¶
type Config struct {
Build BuildInfo // build-time metadata
Addr string // default "127.0.0.1:9374"
CORSOrigin string // allowed origin (default "*")
APIKey string // optional API key for Bearer token auth (empty = disabled)
CORS bool // enable permissive CORS headers (safe for loopback)
}
Config holds server configuration.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default server configuration.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the bcd HTTP server.
func New ¶
New creates a bcd server with the given config, services, SSE hub, and optional static files.
func (*Server) Addr ¶
Addr returns the resolved listen address (updated after Start is called with :0).
type Services ¶
type Services struct {
Agents *agent.AgentService
Costs *cost.Store
CostImporter *cost.Importer
Cron *cron.Store
CronScheduler *cron.Scheduler
Secrets *secret.Store
MCP *mcp.Store
Tools *tool.Store
Stats *stats.Store
EventLog events.EventStore
EventWriter *events.JSONLWriter
WS *workspace.Workspace
Gateway *gateway.Manager
Notify *notify.Service
}
Services bundles all service/store dependencies for the handlers.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package handlers implements HTTP handlers for the bcd REST API.
|
Package handlers implements HTTP handlers for the bcd REST API. |
|
Package mcp implements the Model Context Protocol server for bc workspaces.
|
Package mcp implements the Model Context Protocol server for bc workspaces. |
|
Package ws implements a Server-Sent Events (SSE) hub for real-time event broadcasting to connected web clients.
|
Package ws implements a Server-Sent Events (SSE) hub for real-time event broadcasting to connected web clients. |
Click to show internal directories.
Click to hide internal directories.