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 ¶
- Variables
- func RunBridge(ctx context.Context, log *slog.Logger, getenv func(string) string) error
- func RunBroker(ctx context.Context, log *slog.Logger, args []string, ...) error
- func RunController(ctx context.Context, logger *slog.Logger, getenv func(string) string) error
- func RunFactory(ctx context.Context, log *slog.Logger, getenv func(string) string) error
- func RunGate(ctx context.Context, log *slog.Logger, getenv func(string) string) error
- func RunMaku(ctx context.Context, args []string, stdout io.Writer) error
- func RunSlackApp(ctx context.Context, log *slog.Logger, args []string, ...) error
- type ListenFunc
- type Maku
Constants ¶
This section is empty.
Variables ¶
var ErrNotAdmitted = errors.New("the room refused this run")
ErrNotAdmitted is RunGate's failure when the bridge will never hold the room.
Functions ¶
func RunBridge ¶
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, migrate or migrate-group. 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 ¶
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 ¶
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 ¶
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.
Types ¶
type ListenFunc ¶
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)
}
Maku is maku's wiring: where its files live, and its two HTTP clients.
func (Maku) ConfirmConfig ¶
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.
Source Files
¶
- access.go
- approvals.go
- bridge.go
- broker.go
- factory.go
- factory_repos.go
- factory_status.go
- factory_wait.go
- jwks.go
- leader.go
- listeners.go
- maku.go
- maku_config.go
- maku_demo_app.go
- maku_policy.go
- maku_run.go
- maku_views.go
- mcp.go
- metered.go
- migrategroup.go
- ops.go
- rooms.go
- runcontroller.go
- runs.go
- slackapp.go
- tokenreview.go
- verdicts.go