app

package
v0.53.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 143 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 wires each binary: it reads the environment, builds the adapters and servers, and runs them until the root context ends. It is the only importer of every adapter; cmd/<bin>/main.go only builds the root context and logger and calls app.Run<Bin>.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotAdmitted = errors.New("the room refused this run")

ErrNotAdmitted is RunGate's failure when the bridge will never hold the room.

Functions

func EgressProxy added in v0.46.0

func EgressProxy(ctx context.Context, log *slog.Logger, getenv func(string) string) error

EgressProxy runs the egress proxy (v4 D6) until ctx ends: :3128 the proxy, :9090 its metrics, :9091 /healthz and /readyz (once the pod watch has synced). It reads the run-controller's own config file for the runs namespace and the denied ranges, so the two cannot disagree. It needs no leader: every replica serves.

func GateRequired added in v0.46.0

func GateRequired(rules []forge.RequiredStatus, appID int64) bool

GateRequired reports whether rules require maku/merge-gate from the App appID. A requirement without an integration id, or with another App's, lets a status anyone else posts count, so it is no requirement (D11).

func Netprobe added in v0.46.0

func Netprobe(ctx context.Context, args []string, stderr io.Writer) int

Netprobe is the preflight probe pod's command (v4 D6, plan PR7): each --allow must accept a TCP connection (retried for --allow-wait, as a new pod's policy may not be programmed yet); each --deny must time out or be refused twice, --deny-gap apart; and a CONNECT to --connect through --proxy must be answered 200. It writes a netprobeResult to --termination-log and returns the exit code.

func Preflight added in v0.47.0

func Preflight(ctx context.Context, args []string, stdout, stderr io.Writer) int

Preflight is `maku-run-controller preflight` (v4 D24): the install's preflight pod. It runs the cluster checks through its own ServiceAccount, collects the components' /preflight, prints the JSON lines to stdout and the summary to the termination log, and exits 1 on a fail (and, with --strict, on a warn). The chart runs it as a Helm test hook and as a suspended CronJob.

func RunBridge

func RunBridge(ctx context.Context, log *slog.Logger, getenv func(string) string) error

RunBridge runs room-bridge, the native sidecar of an AgentRun sandbox with a roomRef, until ctx ends, then flushes what it holds. getenv reads its environment (docs/integration.md). It fails before starting on a missing variable, a BROKER_URL that is not https:// or a BROKER_CA_FILE with no CA (GP-18), or a HEALTH_ADDR it cannot listen on.

func RunBroker

func RunBroker(ctx context.Context, log *slog.Logger, args []string, getenv func(string) string) error

RunBroker runs room-broker's subcommand args[0]: serve (the default), retention or migrate. getenv reads ROOMS_CONFIG, ROOMS_DATABASE_URL, POD_NAMESPACE, ROOMS_MCP_KEY, ROOMS_GITHUB_APP_DIR and, for migrate alone, ROOMS_MIGRATION_DATABASE_URL.

func RunController

func RunController(ctx context.Context, logger *slog.Logger, getenv func(string) string) error

RunController runs the run-controller (adoption 3a) until ctx ends. Its cache holds runs and pods in the runs' namespace only; Secrets are read uncached, so it never lists them.

func RunFactory

func RunFactory(ctx context.Context, log *slog.Logger, getenv func(string) string) error

RunFactory runs agent-factory (SP3): the Task reconciler, the issue poller, the run meter and the stop's sweep on the leader; the run-request API on :8082 (TLS when api.tls is set), :9090 metrics and probes and the GitHub ping on every replica. getenv reads FACTORY_CONFIG and POD_NAMESPACE. A config that does not load fails the start, so a bad config fails the rollout rather than the running factory (§4).

func RunGate

func RunGate(ctx context.Context, log *slog.Logger, getenv func(string) string) error

RunGate runs room-bridge gate, the init container between the bridge and the harness (F15). It returns nil once the bridge holds the room's lease, so the harness may start, and an error once the room refuses the run or ctx ends: the pod's restartPolicy Never then fails the run before the harness runs. It reads the bridge's /admission on loopback at HEALTH_ADDR's port.

func RunMaku

func RunMaku(ctx context.Context, args []string, stdout io.Writer) error

RunMaku runs one maku command (SP2 §8): its files under maku.Dir; a pre-v0.30.0 CLI's directory (formerly `roomctl/`) is imported there once, and its egress goes through httpx.

func RunSlackApp

func RunSlackApp(ctx context.Context, log *slog.Logger, args []string, getenv func(string) string) error

RunSlackApp runs factory-slack-app: Slack's events, the broker's webhooks and the ops listener, until ctx ends. args is `--config <file>` (SLACK_APP_CONFIG when absent).

Types

type ListenFunc

type ListenFunc func(ctx context.Context, network, addr string) (net.Listener, error)

ListenFunc opens one listener. Production passes net.ListenConfig.Listen; tests pass a fake that records the addresses, so the chosen ones are asserted without binding a port.

type Maku

type Maku struct {
	Dir    string       // config.json and token.json, both owner-only
	HC     *http.Client // the room list and the IdP: bounded
	Stream *http.Client // the WebSocket: bounded by the context, not a whole-exchange timeout
	In     io.Reader    // mcp's messages; nil is stdin
	Out    io.Writer
	Err    io.Writer // hints; nil is stderr

	// setup's seams; the zero values are the real home, working directory, PATH and exec.
	Home, Cwd string
	LookPath  func(string) (string, error)
	RunCmd    func(ctx context.Context, argv []string) error

	// Apply creates a run's claim (maku run); nil runs kubectl apply -f - with the manifest on stdin.
	Apply func(ctx context.Context, manifest []byte) error

	// Capture runs a command and returns its output (setup's OpenCode service check); nil runs it.
	Capture func(ctx context.Context, argv []string) (string, error)

	// Open opens a URL in the browser (demo app); nil runs xdg-open or open. DemoTimeout bounds the
	// wait for GitHub's callback; zero is five minutes. Tests set both.
	Open        func(ctx context.Context, url string)
	DemoTimeout time.Duration

	// Ask puts a yes/no question to the developer; nil asks on the terminal when In is one, else
	// nothing is asked. Tests set it.
	Ask func(prompt string) (bool, error)

	// install's seams: Digest reads an image's digest (nil: ghcr.io), Rand the generated keys (nil:
	// crypto/rand). Tests set both.
	Digest func(ctx context.Context, image, tag string) (string, error)
	Rand   io.Reader
	// RunFlow runs GitHub's App manifest flow (nil: f.Run): tests stand in for GitHub and the browser.
	RunFlow func(ctx context.Context, f githubapps.Flow, ms ...githubapps.AppManifest) ([]githubapps.App, error)

	// Kube is preflight's cluster from a kubeconfig and context (nil: client-go's loading rules), with
	// the context's namespace. Tests stand in for the cluster.
	Kube func(kubeconfig, kubecontext string) (maku.PreflightCluster, string, error)

	// GH is a GET of the GitHub API with the developer's gh (nil: gh api): an HTTP status and body,
	// or an error when gh could not ask. Tests stand in for GitHub; none reaches the real API.
	GH func(ctx context.Context, path string) (int, []byte, error)

	// RepoCluster is repo check's cluster from a kubeconfig and context (nil: client-go's loading
	// rules and a port-forward to the factory), with the context's namespace. Tests stand in for it.
	RepoCluster func(kubeconfig, kubecontext string) (repoCluster, string, error)
}

Maku is maku's wiring: where its files live, and its two HTTP clients.

func (Maku) ConfirmConfig

func (r Maku) ConfirmConfig(next, old maku.Config, yes bool) error

ConfirmConfig shows what `configure --from` will write, and what it replaces, then decides: an issuer outside the URL's registrable domain is refused unless yes; a terminal is asked unless yes. The values come from the broker's answer, so the developer sees the two a hostile one would plant.

func (Maku) Run

func (r Maku) Run(ctx context.Context, args []string) error

Run runs one command. A transport failure leaves it naming its cause and fix (#48).

Jump to

Keyboard shortcuts

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