Documentation
¶
Overview ¶
Package poolcfg resolves how the measurement pool behaves from two stored settings — the mode word and the trusted key — and an environment handed in as a function. Nothing here touches the disk, the network, the clock or the process environment, so Resolve is a table of inputs and outputs and every case is reachable from a test.
Index ¶
Constants ¶
const ( DefaultRelayURL = "https://codeaf.agentfield.ai/pool" DefaultIndexURL = DefaultRelayURL + indexPath DefaultSubmitURL = DefaultRelayURL + submitPath DefaultMirrorURL = "https://raw.githubusercontent.com/Agent-Field/CodeAF/model-pool/pool/index.json" )
Addresses held when the environment offers nothing readable. The relay is the one base the resolver holds: the index and the submit addresses are read from beside it, and each keeps its own override. The mirror is a second index address — the relay's document copied to GitHub — held on its own, because it derives from nothing here.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Mode Mode
RelayURL string
IndexURL string
SubmitURL string
MirrorURL string
PublicKey string
TTL time.Duration
Source Sources
}
Config is the resolved pool configuration. Source names the origin of each field, and every field is resolved on its own: the mode does not change how the addresses or the TTL are read, and an unreadable URL does not disturb the TTL.
The relay is the base the index and submit addresses derive from: each is RelayURL with its own path appended, unless its own environment name overrides it. The mirror is a second index address held on its own, since it derives from nothing here; an empty one turns the fallback off. An empty PublicKey is the ordinary answer — it means the key the binary carries.
func Resolve ¶
Resolve resolves the pool configuration from the stored mode word, the stored public key and the environment behind lookup, which answers with a value and whether the name was set at all — a name that is set and empty is not the same as a name nobody set. A nil lookup is an environment in which nothing is set.
Every value is read with the space around it trimmed, and words are matched without regard to case. Resolve is pure: the same inputs give the same Config, it keeps nothing between calls, and many goroutines may call it at once.
func (Config) CanRead ¶
CanRead reports whether the pool may read measurements: whenever the mode is not off.
func (Config) CanSend ¶
CanSend reports whether the pool may send measurements: only when the mode is on and there is a submit address to send to.
func (Config) Quieted ¶ added in v0.4.0
Quieted is the config with sending capped by the telemetry off switch's other two rungs — the project file and the profile row — which the resolver cannot see because it reads no disk. An On becomes Read from "telemetry"; a Read or an Off is already sending nothing and is answered unchanged.
type Sources ¶
type Sources struct {
Mode string
RelayURL string
IndexURL string
SubmitURL string
MirrorURL string
PublicKey string
TTL string
}
Sources records where each resolved value came from. Every field holds one of four words: "default", "setting", "env" or "ci" — and Mode alone may hold a fifth, "telemetry", when the telemetry off switch capped it at Read.