Documentation
¶
Overview ¶
Package server provides the HTTP server for BuildMax.
Route handling lives in the handlers sub-package:
- server/handlers — all HTTP handlers in one package, grouped by domain file: auth.go (OTP/login + JWT middleware), teams.go, agents.go, usage.go, issues.go, workflows.go, conversations.go, tasks.go, artifacts.go, files.go, stream.go, ws.go, webhook_keys.go, inbound_webhook.go, worker.go.
This package wires handlers.NewHandler, holds server Config, and serves healthz, openapi, swagger, CORS, and request-logging middleware.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthConfig ¶
type AuthConfig struct {
JWTSecret string // Required for login when UserStore is set
AllowSignup bool // Open POST /api/otp/request to self-registration; closed by default
CORSOrigin string // If set, enable CORS with this origin (e.g. "http://localhost:5173")
QuotaService *quota.QuotaService // Optional; when set, create chat/run enforce quota and return 429 when exceeded
DefaultQuotaTier string // Default quota tier for new users (e.g. signup); used when calling CreateUser
// Token lifetimes; zero means the default in internal/core/model.
AccessTokenTTL time.Duration
RefreshTokenTTL time.Duration
RefreshRotationGrace time.Duration
}
AuthConfig holds auth and CORS settings plus optional quota for signup and create-chat/run.
type Config ¶
type Config struct {
Addr string // Listen address (e.g. ":5678")
Auth AuthConfig
Stores StoresConfig
Storage StorageConfig
Worker WorkerConfig
Conv ConversationConfig
Webhook WebhookConfig
// Audit records sensitive actions. Nil discards them.
Audit *audit.Recorder
// Readiness lists the dependency probes GET /readyz runs. Empty means the
// endpoint reports ready without verifying anything, and says so by
// returning an empty check list.
Readiness []ReadinessCheck
}
Config holds server configuration. Grouped fields document what is required for auth, storage, worker, and conversation.
type ConversationConfig ¶
type ConversationConfig struct {
TitleGenerator llm.TitleGenerator
ConversationStore model.ConversationStore
ConversationMessageStore model.ConversationMessageStore
ConversationLLMClient llm.LLMClient
// LLMGateway serves managed inference to authenticated clients. Nil leaves
// the /llm routes answering 503.
LLMGateway *llmgateway.Service
}
ConversationConfig holds Tier 1 conversation stores and LLM wiring.
type ReadinessCheck ¶
type ReadinessCheck struct {
// Name appears in the response, so it must be safe to show an
// unauthenticated caller: "database", not a DSN.
Name string
Probe func(ctx context.Context) error
}
ReadinessCheck is one dependency the server needs before it can serve traffic. The server does not know what a database or an object store is — bootstrap supplies the probes, which keeps infrastructure detail out of this layer.
type RunOutputLister ¶
type RunOutputLister interface {
ListRunOutputsByConversation(ctx context.Context, conversationID string, taskID *string) ([]model.ArtifactWithTask, error)
GetTaskRunOutputFiles(ctx context.Context, taskRunID string) ([]model.TaskRunArtifact, error)
}
RunOutputLister lists run outputs (artifacts) by conversation and gets output files for a run.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server wraps the HTTP server and runs it.
func New ¶
New builds an HTTP server with routes for healthz, readyz, openapi, swagger, and all API handlers.
type StorageConfig ¶
type StorageConfig struct {
PersistStorage blob.PersistStorage
ArtifactStorage blob.ArtifactStorage
WorkspacesDir string // Overrides config.WorkspacesDir() for workspace file operations
}
StorageConfig holds blob storage and workspace paths.
type StoresConfig ¶
type StoresConfig struct {
UserStore model.UserStore
LoginCodeStore model.LoginCodeStore
PasswordStore model.PasswordStore
RefreshTokenStore model.RefreshTokenStore
TeamStore model.TeamStore
WorkflowStore model.WorkflowStore
AgentStore model.AgentStore
IssueStore model.IssueStore
TaskStore model.TaskStore
TaskRunStore model.TaskRunStore
RunOutputLister RunOutputLister
UserWebhookKeyStore model.UserWebhookKeyStore
AuditStore model.AuditStore
}
StoresConfig holds entity store interfaces used by handlers.
type WebhookConfig ¶
type WebhookConfig struct {
MessagePath string // JSON path for message in body (default "message")
UserID string // CreatedBy for webhook runs (default "webhook")
}
WebhookConfig holds webhook handler options (message path and optional user ID for created runs).
type WorkerConfig ¶
type WorkerConfig struct {
WorkerToken string // If set, required for /api/worker/*
}
WorkerConfig holds worker-to-server auth.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package scheduler provides task run scheduling.
|
Package scheduler provides task run scheduling. |
|
Package streamhub provides task-scoped stream buffers for worker-push and client subscribe (SSE).
|
Package streamhub provides task-scoped stream buffers for worker-push and client subscribe (SSE). |