Documentation
¶
Overview ¶
Package agentfields is the one set of rules for the strings of an agent that leaves a machine or comes from another: the patterns, closed sets and bounds the cockpit's export decoder enforces, shared by the publisher that builds the optional `agents` of a remote snapshot, the hub's snapshot model that validates it, and the fleet mapping that reads it back. Everything here is fail-closed: a value that does not match is blanked (an optional field) or drops the agent (an identifying one), so a path, an environment value or prose in a field never travels or renders.
Index ¶
Constants ¶
const ( KindSession = "session" KindRun = "run" )
The two kinds of agent.
const MaxTextBytes = 256
MaxTextBytes bounds a free-text field (the export decoder's maxFieldBytes).
Variables ¶
var ( Token = regexp.MustCompile(`^[A-Za-z0-9._:-]{1,64}$`) Model = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9._:/@+\[\]-]{0,63}$`) TaskName = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9._/-]{0,255}$`) Repository = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9._-]{0,99}/[A-Za-z0-9._-]{1,100}$`) )
The patterns. A token is a run or session identifier or a runtime name; a model is a token that may also hold the characters a model name uses, and never starts with a separator (so not an absolute path); a task is a task name as WB creates it (letters, digits, dots, underscores, dashes and slashes, not starting with a separator); a repository is owner/name.
var Activities = []string{"working", "blocked", "idle", "done", "unknown"}
Activities are the values of an agent's activity.
Functions ¶
func IsTaskName ¶
IsTaskName is the stricter rule the publisher and the hub apply to a task.
func UnsafeRune ¶
UnsafeRune reports whether character is a control or format character or a line or paragraph separator, which no published text may hold.
func UnsafeText ¶
UnsafeText reports whether character may not appear in a name: UnsafeRune, the replacement character, a private-use character, a space other than the ASCII one, and the characters that draw as blanks.
Types ¶
type Agent ¶
type Agent struct {
Kind, SessionID, RunID, Runtime, Model, State, Activity, Task, Repository string
}
Agent is the strings of one agent.
func Clean ¶
Clean applies the rules to an agent. It reports false when an identifying field fails (the kind, the state, the session or run identifier), and then the agent must be dropped; otherwise every other failing field is blanked. task is the rule for the task field: IsTaskName on the publish, hub and read sides. An empty value always passes: the field is simply absent.