app

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: Apache-2.0 Imports: 61 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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

func FixturesFS

func FixturesFS() fs.FS

FixturesFS exposes the embedded eval fixtures.

func NewProxy

func NewProxy(boot *config.Boot, log *slog.Logger, reg prometheus.Registerer, onDecision func(proxy.Decision)) (*proxy.Server, error)

NewProxy builds kojo-proxy from the deployment config. `kojo proxy` runs it standalone, with its admin API; `kojo serve` embeds it.

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
	// contains filtered or unexported fields
}

App is a built kōjō.

func Build

func Build(ctx context.Context, boot *config.Boot, o Options) (app *App, err error)

Build assembles the app. It connects to the database but starts nothing: Serve does.

func (*App) Close

func (a *App) Close()

Close releases what Build opened.

func (*App) Doctor

func (a *App) Doctor(ctx context.Context, skipProbe bool) *doctor.Report

Doctor runs the doctor checks against the built app.

func (*App) Handler

func (a *App) Handler(ctx context.Context) (http.Handler, error)

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

func (a *App) MetricsHandler() http.Handler

MetricsHandler serves the Prometheus registry. It runs on server.metrics_listen, never on the main port.

func (*App) Serve

func (a *App) Serve(ctx context.Context) error

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.

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.

Jump to

Keyboard shortcuts

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