app

package
v0.0.0-...-90b817e Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 60 Imported by: 0

Documentation

Overview

Package app boots the kagent controller.

It exists so that the controller can be started by something other than this repository's own main package. The only parts of it a library consumer may replace are authentication and authorization; everything else — the database, the controller manager, the Substrate connection, the A2A gateway and the gRPC server — is core's to build. Those are not policy decisions, and a component that reaches agent runtimes should not take whatever handler a library consumer happens to assemble for it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, input *configv1.ControllerConfig, opts Options) error

Run boots the controller and blocks until ctx is cancelled or a component fails. It returns the first error rather than exiting, so a library consumer keeps control of how the process ends.

func SetupLogger

func SetupLogger(level string) error

SetupLogger installs the explicitly configured controller logger.

Types

type Options

type Options struct {
	// Authenticator identifies the caller. Nil selects InsecureAuthenticator,
	// which admits every request.
	Authenticator auth.AuthProvider
	// Authorizer decides what an identified caller may do and which collection
	// entries it may see. Nil selects NoopAuthorizer, which permits every action.
	Authorizer auth.CollectionAuthorizer
	// SetupWithManager registers additional controllers and scheme types on
	// core's manager. It runs after the manager exists and before it starts, so
	// a scheme added here is in place before any cache is built. Returning an
	// error aborts startup.
	//
	// This exists so that a library consumer does not have to run a second manager
	// alongside core's: two managers means two caches of the same objects and a
	// second leader election to keep consistent with the first.
	SetupWithManager func(manager.Manager) error
	// ExtraMigrations are applied after the built-in tracks, in the order
	// given. A library consumer that owns tables uses this rather than migrating
	// separately, so that one run leaves the database wholly at one version.
	// Each source must set Schema.
	ExtraMigrations []migrations.Source
	// GRPCServices registers additional services on core's gRPC server, so a
	// consumer's API shares core's transport, authenticator and interceptors
	// instead of standing up a second server on another port.
	//
	// Every method it registers needs an entry in MethodPolicies: the
	// authentication interceptor refuses a method it has no policy for, so a
	// service registered without one is closed rather than open.
	GRPCServices func(grpc.ServiceRegistrar)
	// MethodPolicies declares access for the methods GRPCServices registers,
	// keyed by full method name.
	//
	// Run fails if a key names one of core's own methods. A consumer describes
	// its own surface here; letting it reclassify core's would turn a config
	// field into a way to make an authenticated method public.
	MethodPolicies map[string]auth.AccessMode
}

Options are the components a library consumer may supply in place of core's own.

A nil field is not an error: it selects the library default. The shipped controller selects its authenticator from server.auth settings. Supplying one does not change how core uses it — the authenticator still guards the gRPC server and the /mcp endpoint, and the authorizer is still consulted by every service that takes one — so a library consumer cannot narrow where its own policy applies.

Jump to

Keyboard shortcuts

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