Documentation
¶
Index ¶
Constants ¶
const ( EnvID = "AIMS_AGENT_ID" EnvName = "AIMS_AGENT_NAME" EnvTool = "AIMS_AGENT_TOOL" EnvCwd = "AIMS_AGENT_CWD" EnvRoute = "AIMS_AGENT_ROUTE" EnvPending = "AIMS_AGENT_PENDING" EnvDepth = "AIMS_CONTEXT_DEPTH" )
Environment variable names — these MUST match the ones the bring() shell function exports (cmd/bring/shell/templates/*.tmpl). Reading them here is the only way client code learns the current context.
const ( TagContext = "this agent's host" TagNearby = "agent subnet (nearby)" )
Relevance group tags, shared so every completer labels the promoted groups identically. Normal has no tag — the completer keeps its own intrinsic group (locality, category, …) for those.
Variables ¶
This section is empty.
Functions ¶
func CurrentHost ¶
CurrentHost resolves the loaded agent to the host it runs on — the anchor for context-aware completion — and returns false when no context is loaded or it can't be resolved. It reads the agent (for its Host id) then the full host (with addresses/ports/trace), both over the teamclient RPC, never the DB directly. Best-effort: any error yields (nil, false) so callers degrade to the context-free path. The client must already be connected (call con.ConnectComplete first).
func PromotedOrder ¶
PromotedOrder prepends the relevance group tags, in their canonical order, to a completer's own intrinsic group order — so the agent's host and its subnet always render first, and every context-aware completer presents the same spatial convention.
func SubnetOf ¶
SubnetOf returns the address's subnet in CIDR form under the same netmask-free heuristic sameSubnet uses — a /24 for IPv4, a /64 for IPv6 — and false for a nil/unusable address. It is the companion to sameSubnet for callers that need the prefix itself (e.g. offering subnets as scan targets).
Types ¶
type Context ¶
type Context struct {
ID string
Name string
Tool string
Cwd string
Route string
Pending string
Depth int
}
Context is the loaded agent context, a cheap snapshot read straight from the environment that `aims bring` populated — no server round-trip. ID is the only field guaranteed present; the rest are the display snapshot bring emits.
type Relevance ¶
type Relevance int
Relevance ranks a completion candidate by its relationship to the loaded agent context. Higher is closer.
func RelevanceOfHost ¶
RelevanceOfHost classifies a host relative to the loaded agent host: Context if it IS the agent host, Nearby if it shares a subnet, else Normal. A nil agentHost (no context loaded) is always Normal, so callers get the context-free behaviour for free.
func RelevanceOfHostID ¶
RelevanceOfHostID classifies an entity that references a host only by id — a credential's HostId, a service's host — as Context when that is the agent host, else Normal. Subnet proximity needs addresses, which a bare id lacks, so Nearby is never returned here.