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
- type AccessConfig
- type Config
- type DashboardConfig
- type Duration
- type GroupsConfig
- type HumanConfig
- type IntakeConfig
- type IssuerConfig
- type MCPConfig
- type NeedsConfig
- type PlanClass
- type PlanConfig
- type RoomToolsConfig
- type SlackDecideConfig
- type SlackLinkConfig
- type SponsoredConfig
- type SuspendConfig
- type TLSConfig
- type WebhookConfig
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 ( // PlanModel is the one alias the planner may name: the gateway serves `tier-frontier` to the // `planner` client, and any other alias is a different, unreviewed spend (CD17). PlanModel = "tier-frontier" // DefaultPlanDeadline is 20 s, under /mcp's 25 s bound (mcp.go:64): a plan that outlives it is // refused with planner_timeout rather than hanging the tool. DefaultPlanDeadline = 20 * time.Second // DefaultDailyPlans is the per-requester daily cap (spec §budget): one call per plan attempt, // never a retry loop. DefaultDailyPlans = 50 // DefaultMaxRounds is the clarification-round cap. Reaching it accepts the remaining // recommendations deterministically rather than making another model call. DefaultMaxRounds = 10 )
The planner's one route, and the values that are not a deployment's to choose.
const ( PlanFallbackOff = "off" PlanFallbackComposer = "composer" )
The degraded composer's two positions (CD18): it is off unless a deployment says `composer`, and every surface that renders it labels it as not the natural-language experience.
const ( // RoomToolsAuthKey trusts a gateway's injected key and verified subject. RoomToolsAuthKey = "key" // RoomToolsAuthTokenReview verifies the run's own token (audience room-tools) through the apiserver. RoomToolsAuthTokenReview = "tokenreview" )
How :8090 authenticates a run. An empty auth is key: the bytes a deployed broker carries need no edit.
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"`
// FactoryCAFile is the PEM CA that signs the factory's api certificate, read on every run
// request so a rotation needs no restart (S-1). Empty: the system roots.
FactoryCAFile string `json:"factoryCAFile,omitempty"`
// FactoryInsecure admits an http:// factoryURL. The broker forwards each human's bearer token
// there, so plaintext is an explicit opt-out, never a default (D6).
FactoryInsecure bool `json:"factoryInsecure,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"`
// Coordination is the factory's multi-repository switch, read here with the factory's own type
// and rules (v4 MR16): coordination_plan is listed only while it is not off.
Coordination fconfig.Coordination `json:"coordination,omitzero"`
// PolicyManagement is the factory's merge-policy switches, read here with the factory's own type
// (merge policy stage 6): promotion serves the settings pages and the promotion records, and
// operators approve exceptions. The broker reads nothing else of it.
PolicyManagement fconfig.PolicyManagement `json:"policyManagement,omitzero"`
}
Config is the broker's configuration.
func (*Config) ApplyDefaults ¶
func (c *Config) ApplyDefaults()
ApplyDefaults fills what the file may leave out.
func (Config) IntakePlan ¶ added in v0.35.0
func (c Config) IntakePlan() PlanConfig
IntakePlan is the planner's config with its defaults applied: `tier-frontier`, 20 s, 50 plans a day, 10 clarification rounds and the degraded composer off. A caller reads this rather than re-spelling a default, so an absent block and a block that leaves them out serve the same values.
func (Config) RoomToolsAuth ¶ added in v0.37.0
RoomToolsAuth is the auth :8090 serves: key unless tokenreview is set.
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"`
// Needs serves GET /api/needs, needs/v1's human door (CD28): every room's needs for one caller,
// read-only, with a `since` cursor. On unless a file turns it off.
Needs NeedsConfig `json:"needs,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"`
// SlackDecide turns on POST /api/slack/decisions: the Slack App's Approve/Deny buttons decide a
// forge.push approval. Off unless set: the path is then the mux's 404.
SlackDecide *SlackDecideConfig `json:"slackDecide,omitempty"`
// Intake is the governed planner (v3.x conversational intake, CD5, CD17, CD18). Off unless the
// block turns it on: no block, no tool on any list.
Intake IntakeConfig `json:"intake,omitzero"`
// ApprovalMemory serves saved approval grants (merge policy stage 5): the
// /settings/approval-memory page and its API to humans, and the grant routes on :8443 to the
// factory. Off unless set; the factory consults grants only under its own
// policyManagement.approvalMemory.
ApprovalMemory bool `json:"approvalMemory,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.
func (HumanConfig) NeedsEnabled ¶ added in v0.35.0
func (h HumanConfig) NeedsEnabled() bool
NeedsEnabled is the needs route's switch: an absent block, or a block with no enabled, is true, and false is the opt-out the decoder keeps — a plain bool could not tell the absent block from a refusal.
type IntakeConfig ¶ added in v0.35.0
type IntakeConfig struct {
Plan PlanConfig `json:"plan,omitzero"`
}
IntakeConfig is human.intake. It holds one block today; it exists so the planner's switch has a name of its own beside the other v3 switches, rather than growing on the listener's config.
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 NeedsConfig ¶ added in v0.35.0
type NeedsConfig struct {
Enabled *bool `json:"enabled,omitempty"`
}
NeedsConfig switches the human listener's needs route (CD28). An absent block is on: needs/v1 is a read-only list, which the spec ships on with its release, and only an explicit false closes the door.
type PlanClass ¶ added in v0.35.0
type PlanClass struct {
Roles []string `json:"roles"`
CeilingUSD float64 `json:"ceilingUSD"`
Source string `json:"source"`
}
PlanClass is one class's template: the roles the factory runs for it, the ceiling the class's `taskUSD` sets, and the source string the plan displays as where that ceiling came from.
type PlanConfig ¶ added in v0.35.0
type PlanConfig struct {
// Enabled serves intake_plan and plan_check. Off unless set: neither tool is on any list, so a
// deployment that has not declared the block answers `unknown tool`, as run_create does to a
// human token today.
Enabled bool `json:"enabled,omitempty"`
// URL is the in-cluster AI Gateway data-plane Service, straight to it: a package never
// hard-codes a platform endpoint, and factoryURL is configured the same way.
URL string `json:"url,omitempty"`
// Model is the pinned alias, and the only value it may hold (CD17); empty takes PlanModel.
Model string `json:"model,omitempty"`
// APIKeyFile is the mounted `planner` key, read at use so a rotation needs no restart.
APIKeyFile string `json:"apiKeyFile,omitempty"`
// Deadline bounds the one model call; empty takes DefaultPlanDeadline.
Deadline Duration `json:"deadline,omitzero"`
// ReasoningEffort is sent as the call's `reasoning_effort` when set (low, medium or high); empty
// sends nothing and the model's default stands. A model that always reasons (glm-5.3) spends the
// whole 20 s deadline thinking at its default, and answers in about 4 s at "low".
ReasoningEffort string `json:"reasoningEffort,omitempty"`
// DailyPlans is the cap per requester per UTC day; empty takes DefaultDailyPlans.
DailyPlans int `json:"dailyPlans,omitempty"`
// MaxRounds is the clarification-round cap; empty takes DefaultMaxRounds. A revision that
// reaches it is finished deterministically, with every remaining recommendation accepted.
MaxRounds int `json:"maxRounds,omitempty"`
// Fallback is "off" or "composer": only the second reaches the degraded deterministic composer,
// and it is unreachable otherwise (CD18).
Fallback string `json:"fallback,omitempty"`
// Repositories is the allowlist the candidate set is drawn from (CD5): the planner never plans
// for a repository this list does not carry. It is deliberately not human.mcp.sessionStart,
// which means "the form may offer to start the factory here".
Repositories []string `json:"repositories,omitempty"`
// Classes is the class table: the roles a plan's issues carry and the money they are charged
// against both come from here, never from the model (CD17).
Classes map[string]PlanClass `json:"classes,omitempty"`
}
PlanConfig is human.intake.plan: the switch, the route to the gateway, the cap, the repositories the planner may ever name (CD5) and the class table its roles and money come from (CD17).
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"`
// Auth is who vouches for a caller: "" or "key", a gateway that verified the run's token and
// injects ROOMS_MCP_KEY and the subject (production); "tokenreview", the broker itself asks the
// apiserver about the run's own bearer token, where no gateway stands in front (the demo).
Auth string `json:"auth,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 SlackDecideConfig ¶ added in v0.35.0
SlackDecideConfig is human.slackDecide: the sponsored principal (the Slack App) that may post a decision, and the one Slack workspace whose clicks are this broker's (v3.x Slack push approval D14). On, it serves POST /api/slack/decisions; off, the path is a 404. The class it decides is a constant (D13), so it is not configurable here.
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 ¶
type SponsoredConfig struct {
Name string `json:"name"`
ClientIDFile string `json:"clientIDFile"`
// Repositories is the principal's upper bound into a coordination family (v4 MR13): it has
// no GitHub login, so a child outside this list is restricted. Empty reads no child.
Repositories []string `json:"repositories,omitempty"`
}
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.