Documentation
¶
Overview ¶
Package app assembles kōjō from its deployment config: the store, the day-2 config manager, the model gateway, the sandbox driver and its proxy, the surfaces, the engine and the HTTP server. The CLI's commands are thin wrappers around it.
Index ¶
- func DefaultImage() string
- func FixturesFS() fs.FS
- func NewProxy(boot *config.Boot, log *slog.Logger, reg prometheus.Registerer, ...) (*proxy.Server, error)
- type App
- func (a *App) Close()
- func (a *App) Doctor(ctx context.Context, skipProbe bool) *doctor.Report
- func (a *App) Handler(ctx context.Context) (http.Handler, error)
- func (a *App) MetricsHandler() http.Handler
- func (a *App) Serve(ctx context.Context) error
- func (a *App) StopAlerts(ctx context.Context) bool
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultImage ¶
func DefaultImage() string
DefaultImage is the sandbox image of kits that name none, unless sandbox.image overrides it: the toolchain image published with each release (deploy/toolchain).
Types ¶
type App ¶
type App struct {
Boot *config.Boot
Log *slog.Logger
Store store.Store
Config *config.Manager
Skills *skills.Resolver
Models models.Gateway
Driver sandbox.Driver
Proxy *proxy.Server // nil when the proxy is remote or unused
Forges map[string]forge.Forge
Chats map[string]chat.Adapter
Trackers map[string]tracker.Tracker
Engine *core.Engine
Eval *eval.Runner
Registry *prometheus.Registry
Image string
// ProxyClient drives a remote proxy; nil when it is embedded or unused.
// Its Run sends sandbox policies again after the proxy restarts.
ProxyClient *proxy.Client
// Alerts are the sources of production alerts (alerts.go), by name.
Alerts map[string]alerts.Source
// contains filtered or unexported fields
}
App is a built kōjō.
func (*App) Handler ¶
Handler builds the HTTP handler of the server: health, webhooks, chat routes, MCP, and the dashboard with its API. Metrics are on a port of their own (MetricsHandler).
func (*App) MetricsHandler ¶
MetricsHandler serves the Prometheus registry. It runs on server.metrics_listen, never on the main port.
func (*App) Serve ¶
Serve runs everything until ctx ends: the HTTP server, the workers, the scheduler, the config watcher, the chat connections, the embedded proxy or the re-sending of a remote proxy's policies, and the sandbox reaper. It returns the first failure of any of them.
func (*App) StopAlerts ¶ added in v0.4.0
StopAlerts stops taking alerts and waits for those at work until ctx ends. It reports whether they all finished. An alert cut off by the process ending is not lost for good: the source sends another the next time its rule or monitor fires.
type Options ¶
type Options struct {
Logger *slog.Logger
// MemoryStore uses the in-memory store instead of Postgres: `kojo eval
// --local` and tests. Nothing is persisted.
MemoryStore bool
// Migrate applies pending migrations while building (kojo serve).
Migrate bool
// NoSurfaces skips the forges and chat adapters (kojo eval --local).
NoSurfaces bool
// NoSeed leaves an empty database's day-2 config unwritten (kojo
// doctor, which only inspects).
NoSeed bool
// Fixtures replaces the built-in eval fixtures (kojo eval --local
// --factory: a repository's own laid over them). Nil means the built-in
// ones.
Fixtures fs.FS
}
Options change how Build assembles the app.