api

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: MIT Imports: 19 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.Engine is built for single-process CLI/MCP use (shared Config, per-layer Workspace fields, lazily-resolved LLM agents). Rather than auditing every call path for races, every engine call is serialized through one request-level mutex — simple and safe; throughput is not a goal of this front-end.

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 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.

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