Help us shape the future of Go! Take the 2026 Go Developer Survey

api

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package api implements LadyM's HTTP data-plane front-end (`ladym serve --http`): one POST endpoint per MCP tool, mirroring the engine calls and parameter semantics of mcp/server.go, with optional database-backed HTTP Basic auth (users table) and per-user workspace enforcement.

Concurrency: engine calls run without a request-level lock. Per-request workspace isolation goes through engine.Scope (a workspace-bound view of the shared engine); store concurrency is handled by database/sql and the backend (SQLite writes serialize via WAL + busy_timeout).

Personal edition: the management console (console/dist, see the console package) is embedded in the api node — `ladym serve --http` serves it at "/". The enterprise variant of this file (console_mount_enterprise.go) is a 404 stub; the console's serving logic itself lives in console.Mount.

Console data-CRUD endpoints (spec §3.1): memories list/update/delete and the admin-only users management API. Auth/workspace semantics are the T1 ones: every endpoint sits behind the Basic middleware, non-admin users are locked to their forced workspace, and the users endpoints additionally require admin (auth disabled = implicit trust).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DescribeAuth

func DescribeAuth(cfg *config.Config, store storage.Store) string

DescribeAuth summarizes the configured auth mode for the startup banner. Auth disabled is the default (personal mode — no warning needed); when enabled with an empty users table, every request would 401, so the summary points at the CLI bootstrap path.

func NewHandler

func NewHandler(eng *engine.Engine, cfg *config.Config) http.Handler

NewHandler builds the HTTP front-end (mux + auth middleware) for eng: the data-plane mux (NewMux) plus the edition-dependent console mount at "/" (console_mount_*.go), wrapped in the standard middleware.

func NewHandlerWithRegistry added in v0.6.0

func NewHandlerWithRegistry(eng *engine.Engine, cfg *config.Config, reg *observability.Registry) http.Handler

NewHandlerWithRegistry is NewHandler with an injectable metrics registry (tests use isolated instances; production uses observability.Default()).

func NewMux

func NewMux(eng *engine.Engine, cfg *config.Config) (mux *http.ServeMux, wrap func(http.Handler) http.Handler)

NewMux builds the data-plane mux for eng — /healthz plus every /api/* endpoint — with NOTHING registered at "/": the caller decides what lives there (the personal edition mounts the embedded console inside NewHandler; the enterprise ladymconsole binary mounts it via console.Mount). The returned wrapper applies the standard middleware chain (auth + observability) and must be applied AFTER any extra top-level mounts.

func NewMuxWithRegistry added in v0.6.0

func NewMuxWithRegistry(eng *engine.Engine, cfg *config.Config, reg *observability.Registry) (mux *http.ServeMux, wrap func(http.Handler) http.Handler)

NewMuxWithRegistry is NewMux with an injectable metrics registry (tests use isolated instances; production uses observability.Default()).

Types

type Handler

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

Handler serves the /api/* endpoints against one engine.

Jump to

Keyboard shortcuts

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