composition

package
v0.17.4 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: AGPL-3.0 Imports: 57 Imported by: 0

Documentation

Overview

Package composition wires all marotte services together and manages application lifecycle.

Index

Constants

View Source
const PathsCommand = "paths"

PathsCommand is the subcommand that prints the boot's folders for entrypoint.sh to eval.

Variables

This section is empty.

Functions

func RunPaths added in v0.16.0

func RunPaths(stdout, stderr io.Writer) int

RunPaths prints, for bash or sh to eval, CONFIG_DIR, TOOLS, KIRO_HOME, PATH, GOPATH and GOBIN as the server derives them, so the boot acts on the server's folders. TOOLS is empty when the server rejects the tools dir. It returns 1, printing why, when the server would refuse the config dir.

Types

type App

type App struct {
	Runtime *agent.Runtime
	Server  *server.Server
	// contains filtered or unexported fields
}

App holds all wired-up services for the marotte server.

func Build

func Build(ctx context.Context, cfg *Config, staticFS fs.FS) (*App, error)

Build constructs all services and wires them together. staticFS is the embedded web UI; cfg must be treated as read-only from here on.

func (*App) Run

func (a *App) Run() error

Run starts the HTTP server and blocks until shutdown, which the server handles itself.

func (*App) Shutdown

func (a *App) Shutdown()

Shutdown stops background services, mostly in reverse order; a comment marks each step whose position is load-bearing. Every member is treated as optional: a panic on a service never started would abort the teardown of the rest.

type Config

type Config struct {
	WorkDir   string
	ConfigDir string
	VapidSub  string
	// KiroCLIVersion and the two digests are the Renovate-pinned literals
	// entrypoint.sh declares and exports. They are the manager's whole input:
	// no version means no managed install (bare `go run`), and a malformed
	// digest fails manager construction rather than a 528 MB download.
	KiroCLIVersion     string
	KiroCLISHA256      string
	KiroCLISHA256ARM64 string
	// KASNodePath is the node binary kiro-cli runs KAS on, resolved as kiro-cli resolves it:
	// KIRO_KAS_NODE_PATH, else the embedded copy in kiro-cli's data dir. It may not exist yet.
	KASNodePath string
	// Tools is the tools engine's and the kiro-cli install's root (bin/, opt/, npm/, python/,
	// kiro-cli-versions/) on the persistent volume, with the server's verdict on it.
	Tools toolsRoot
	// ToolCatalogPath is the compiled tool catalog baked into the
	// image (missing = degraded catalog search). With the runtime
	// refresh below it is only the first-boot/offline fallback.
	ToolCatalogPath string
	// ToolCatalogURL is the published catalog the engine refreshes
	// from at boot and on the ToolCatalogRefresh schedule.
	ToolCatalogURL string
	// ToolCatalogOverlays are the bundled-tools files the engine re-applies to every loaded
	// catalog: the tools marotte needs or recommends, plus their UI copy, which the published
	// catalog lacks. A missing file warns and is dropped (see bundledToolsFiles).
	ToolCatalogOverlays []string
	// ToolCatalogRequire lists the tool names a fetched catalog must
	// resolve before it replaces the current one — the embedded
	// required-tools.txt, injected by main.
	ToolCatalogRequire []string
	// TrustedProxies are the reverse-proxy prefixes whose X-Forwarded-For webhttp may trust, from
	// TRUSTED_PROXIES. Empty trusts nothing and logs the unspoofable socket peer.
	TrustedProxies []netip.Prefix
	// TrustedInstallUIDs names identities whose write access to the kiro-cli install tree does not
	// invalidate pinstall's custody, from TRUSTED_INSTALL_UIDS. Empty (the default) refuses any
	// tree another identity can write. Never compiled in: only the deployment knows which account
	// is already as privileged as this process.
	TrustedInstallUIDs []int
	// HostPolicy is the exact-match Host allowlist from ALLOWED_HOSTS, the anti-DNS-rebinding gate
	// applied before the CSRF check. Unset = inactive, any Host accepted (the server warns at
	// listen time).
	HostPolicy *webhttp.HostPolicy
	// BridgeEnvAllow re-permits names the bridge's credential screen would drop, from
	// bridge.EnvAllowVar. Nil is the shipped and right configuration.
	BridgeEnvAllow map[string]struct{}
	// BrowseRoots is the file browser's allow-list: WorkDir, ConfigDir, marotte.DefaultUploadDir,
	// plus MAROTTE_BROWSE_ROOTS grants (colon-separated absolute paths). Everything else is denied.
	BrowseRoots []string
	// ACPArgs are operator kiro-cli launch flags from MAROTTE_KIRO_ACP_ARGS, filtered by
	// bridge.ParseACPArgs and appended to the agent engine's argv. An escape hatch for a flag
	// upstream adds, not a capability switch.
	ACPArgs []string
	// ToolCatalogRefresh is the engine refresh cadence (toolbelt's 24h default), with no env override.
	ToolCatalogRefresh time.Duration
	// KiroAPIKeySet records whether bridge.KiroAPIKeyVar is present. The value
	// is never read into Config.
	KiroAPIKeySet bool
}

Config holds all environment/flag values needed to build the app.

func ConfigFromEnv

func ConfigFromEnv() Config

ConfigFromEnv reads configuration from environment variables with sensible defaults.

Jump to

Keyboard shortcuts

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