Documentation
¶
Overview ¶
Package config is the broker's one config file (a ConfigMap, Flux-substituted). Load decodes it strictly, applies the defaults and validates it, so a typo or a bad pattern fails the rollout rather than the first request.
Index ¶
Constants ¶
const ( DefaultCertFile = "/etc/room-broker/tls/tls.crt" DefaultKeyFile = "/etc/room-broker/tls/tls.key" )
The :8443 key pair's defaults: cert-manager's Certificate room-broker-tls (GP-18).
const ( // IssuerModeJWKS verifies a token offline against the issuer's JWKS. IssuerModeJWKS = "jwks" // IssuerModeTokenReview asks the apiserver, so no issuer URL has to be reachable from the pod. IssuerModeTokenReview = "tokenreview" )
How a token issuer is verified. An empty mode is JWKS: the bytes a deployed broker already carries need no edit.
const ( // HumanModeOIDC is the ZITADEL-backed default: oauth2-proxy in front, a token per member. HumanModeOIDC = "oidc" // HumanModeLocal is one loopback user behind a port-forward, for an install with no IdP. HumanModeLocal = "local" )
The human listener's modes. An empty mode is OIDC: the bytes a deployed broker already carries need no edit, and a local one is explicit (adoption 3b).
const (
DefaultSuspendAfter = 5 * time.Minute
)
The bounds of suspend.after: a suspend and its resume cost a cold start, so not at once, and the attended approval expires at 30 minutes, so before that.
const MaxAccessTTL = 5 * time.Minute
MaxAccessTTL is the longest a GitHub access answer is trusted, and the default: a revoked read must lapse within it (D7).
const (
MaxDashboards = 8
)
The bounds of human.dashboards: a strip of a few links, each label a chip's width.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessConfig ¶
type AccessConfig struct {
ReaderFile string `json:"readerFile"`
TTL Duration `json:"ttl,omitempty"`
}
AccessConfig is D7's GitHub check. ReaderFile is the ZITADEL link reader's mounted secret, JSON {"pat", "tokenId", "githubIdpId"}, read at use: ZITADEL at the human issuer resolves a member to their linked GitHub id. TTL caches each answer.
type Config ¶
type Config struct {
PublicURL string `json:"publicURL"`
RunIssuers []IssuerConfig `json:"runIssuers"`
// SystemIssuer is optional: only the factory calls the system routes, and without it they
// answer 401. systemPrincipals without it is refused: no principal could ever be vouched for.
SystemIssuer *IssuerConfig `json:"systemIssuer,omitempty"`
SystemPrincipals map[string]string `json:"systemPrincipals"` // token sub -> system:<component>
Human HumanConfig `json:"human"`
// RoomTools is the agents' :8090 listener (I8). Absent, it starts; explicit false is the opt-out.
RoomTools *RoomToolsConfig `json:"roomTools,omitempty"`
FactoryURL string `json:"factoryURL,omitempty"`
TLS TLSConfig `json:"tls"`
Suspend SuspendConfig `json:"suspend,omitzero"`
// Runs is where AgentRuns live (adoption 3a): cloud-native-ref's XR when omitted.
Runs runwatch.Kind `json:"runs,omitzero"`
// Webhooks are the subscribers to room events (factory interfaces F6).
Webhooks []WebhookConfig `json:"webhooks,omitempty"`
}
Config is the broker's configuration.
func (*Config) ApplyDefaults ¶
func (c *Config) ApplyDefaults()
ApplyDefaults fills what the file may leave out.
func (Config) RoomToolsEnabled ¶
RoomToolsEnabled is the listener's switch: absent block or nil enabled means true, as every existing deployment expects.
type DashboardConfig ¶
DashboardConfig is one link the room page shows in its title strip, such as a Grafana dashboard. URL is a template: the page fills {room}, {run} and {task} with the room's ids, each URL-encoded, and hides a link whose placeholder the room has no value for.
type Duration ¶
Duration is a time.Duration written as a string such as "90s".
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON parses a Go duration string; a bare number is refused, since its unit is a guess.
type GroupsConfig ¶
GroupsConfig names the IdP's two agent groups, which feed policy.Groups. They are literals: names we choose, not ids the IdP mints.
type HumanConfig ¶
type HumanConfig struct {
// Mode is "" or "oidc" (the ZITADEL-backed default), or "local": one loopback user behind a
// port-forward, for an install with no IdP (adoption 3b).
Mode string `json:"mode,omitempty"`
Issuer string `json:"issuer"`
JWKSURL string `json:"jwksURL"`
ClientIDFile string `json:"clientIDFile"` // the rooms-proxy client id, from agents-secrets
RoomctlClientIDFile string `json:"roomctlClientIDFile,omitempty"` // phase 6
ProjectIDFile string `json:"projectIDFile"` // a human token's aud must hold it (Ruling AS)
Origin string `json:"origin"`
Groups GroupsConfig `json:"groups"`
// Access turns on D7: a member sees a room only if they can read its repository
// on GitHub. Unset, rooms are visible to admins only, never to every member.
Access *AccessConfig `json:"access,omitempty"`
// MCP serves /mcp, the MCP server maku mcp relays (factory interfaces F2). Off unless
// enabled: v3 ships each feature behind a switch (D4).
MCP MCPConfig `json:"mcp,omitzero"`
// Dashboards are the room page's links out, such as Grafana's, filled with the room's ids.
// None by default: the page then shows no group at all.
Dashboards []DashboardConfig `json:"dashboards,omitempty"`
// SlackLink turns on the Slack self-serve link: the Slack App mints one-time codes, and a
// signed-in human confirms one on /link/slack. Off unless set.
SlackLink *SlackLinkConfig `json:"slackLink,omitempty"`
}
HumanConfig is the viewers' identity provider (phase 2). The client and project ids are read from mounted files at use, never literals (Ruling AS-a): the IdP mints them, anew on every gcp-0 build, and a rotation needs no restart.
func (HumanConfig) EffectiveGroups ¶
func (h HumanConfig) EffectiveGroups() GroupsConfig
EffectiveGroups is the two group names the listener admits and the policy matrix reads. Local mode has one human and no IdP to name a group, so it takes the two fixed names; every other mode keeps the configured ones.
func (HumanConfig) EffectiveMode ¶
func (h HumanConfig) EffectiveMode() string
EffectiveMode is the mode the broker serves: an empty mode is the OIDC deployment every existing config carries, so nothing has to be added to it.
type IssuerConfig ¶
type IssuerConfig struct {
Issuer string `json:"issuer"`
JWKSURL string `json:"jwksURL"`
SubPattern string `json:"subPattern,omitempty"`
// Mode names how the issuer's tokens are verified: "" or "jwks" against JWKSURL; "tokenreview"
// asks the apiserver, for a cluster whose issuer is not reachable (kind, adoption 3b).
Mode string `json:"mode,omitempty"`
}
IssuerConfig is one allowlisted token issuer. SubPattern, for a run issuer only, maps a subject to its runId with exactly one capture group.
func (IssuerConfig) EffectiveMode ¶
func (is IssuerConfig) EffectiveMode() string
EffectiveMode is the mode this issuer serves: JWKS unless another is set.
type MCPConfig ¶
type MCPConfig struct {
Enabled bool `json:"enabled,omitempty"`
// Sponsored are the service accounts that may call run_create (factory interfaces F4, R13);
// each is also declared in the factory's api.sponsored, which decides everything else.
Sponsored []SponsoredConfig `json:"sponsored,omitempty"`
// SessionStart lists the repositories ("owner/name") whose issue_draft says canStart: the
// handoff prompt may start the factory there for a caller who writes to them. Empty, none does.
SessionStart []string `json:"sessionStart,omitempty"`
}
MCPConfig switches the human listener's MCP server.
type RoomToolsConfig ¶
type RoomToolsConfig struct {
// Enabled unset means on, today's :8090 listener: every deployed config keeps working with no
// edit. An explicit false binds no port at all — not even one to close again — and starts no
// server, so a broker with no room-tool client stays clean.
Enabled *bool `json:"enabled,omitempty"`
}
RoomToolsConfig switches the agents' :8090 room tools listener (I8). It sits at the top level, apart from human.mcp: the two MCP servers are different trust domains on different ports.
type SlackLinkConfig ¶
type SlackLinkConfig struct {
Principal string `json:"principal"`
TeamID string `json:"teamID"`
Repository string `json:"repository"`
}
SlackLinkConfig is human.slackLink: the sponsored principal (one of human.mcp.sponsored, the Slack App) that may mint link codes, the one Slack workspace a code may be for, and the repository whose GitHub App installation names the account's login on the page.
type SponsoredConfig ¶
SponsoredConfig is one sponsored principal the broker admits on /mcp.
type SuspendConfig ¶
type SuspendConfig struct {
Enabled bool `json:"enabled,omitempty"`
After Duration `json:"after,omitzero"`
}
SuspendConfig is the broker's suspend trigger (v2 warm-sandboxes design §6): a suspendable run in an attended room whose approval waits while the room stays idle for After is suspended, and resumed once nothing waits. Off unless Enabled.
type TLSConfig ¶
type TLSConfig struct {
CertFile string `json:"certFile,omitempty"`
KeyFile string `json:"keyFile,omitempty"`
}
TLSConfig names the :8443 key pair, re-read when it changes (GP-18).
type WebhookConfig ¶
type WebhookConfig struct {
Name string `json:"name"`
Network string `json:"network"` // cluster | internet
URL string `json:"url"`
Events []string `json:"events"`
SecretFile string `json:"secretFile"`
Repositories []string `json:"repositories"`
// Generation re-enables a subscriber the emitter disabled: changing it is the reviewed act (R17).
Generation int `json:"generation,omitempty"`
}
WebhookConfig is one subscriber (factory interfaces F6, O7): declared here because subscribers are few, this file is a gate path, and ai-native-ref generates the broker's egress from it.