Documentation
¶
Overview ¶
Package capability enforces immutable AgentVersion grants at Gateway boundaries without coupling the Agent manifest vocabulary to persistence.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrDenied = errors.New("agent version capability denied")
Functions ¶
func MatchGrant ¶
MatchGrant is the single wildcard contract shared by every gateway: exact identifiers, global "*", or a suffix wildcard after a namespace separator ("search.*", "project/*") or a version separator ("weather@*", which floats across a tool's versions). Embedded wildcards never match.
Types ¶
type Authorizer ¶
type Authorizer struct {
// contains filtered or unexported fields
}
Authorizer resolves the immutable AgentVersion and enforces its symbolic grants. Legacy publications (no runtimes declaration) retain their tenant-policy behavior during the v1alpha1 compatibility window.
func NewAuthorizer ¶
func NewAuthorizer(versions store.AgentVersionStore) (*Authorizer, error)
func (*Authorizer) ToolFreeze ¶
func (a *Authorizer) ToolFreeze(ctx context.Context, tenantID, agentVersionRef string) (ToolFreeze, error)
ToolFreeze loads the immutable AgentVersion once and captures the state needed to decide tool visibility and invocation for the whole request. It is the freeze-aware counterpart of Authorize for the tool kind.
type Kind ¶
type Kind string
const ( Tool Kind = "tool" Model Kind = "model" Memory Kind = "memory" Secret Kind = "secret" // IPC is the grant kind for agent-to-agent messaging. A candidate is the // receiving AgentVersion reference the send addresses, so the grant // answers "which agents may this version write to" rather than "may this // version use the mailbox". IPC Kind = "ipc" )
type ToolFreeze ¶
type ToolFreeze struct {
// contains filtered or unexported fields
}
ToolFreeze resolves an AgentVersion's tool grants together with the publish-time version freeze (P1-08). A bare name or a name wildcard is frozen to the tool versions that already existed when the AgentVersion was published: registering a newer tool version afterward does not silently re-target an old, immutable publication. Two grant forms opt out of the freeze explicitly — a pinned "name@version" (an exact, immutable choice, so its registration time is irrelevant) and a floating "name@*" (the caller deliberately accepts version drift). Legacy publications (no runtimes declaration) keep tenant-policy behavior during the compatibility window and are not frozen.
The two grant vocabularies are kept apart: grants holds the capability vocabulary (bare names and wildcards), versionGrants the pinned and floating forms that decide the version.
func (ToolFreeze) Allow ¶
func (f ToolFreeze) Allow(name, version string, registeredAt time.Time) bool
Allow reports whether the AgentVersion may see or invoke this tool version. registeredAt is the descriptor's immutable registration time. A pinned grant matches its exact version regardless of when it was registered; a "name@*" floating grant matches any version of that name; a bare name or a name wildcard matches only versions registered no later than the AgentVersion's own publication (the freeze).
func (ToolFreeze) Enforced ¶
func (f ToolFreeze) Enforced() bool
Enforced reports whether the freeze applies. It is false for legacy publications, where every registered descriptor stays visible under the tenant-policy compatibility window.