Documentation
¶
Overview ¶
Package needs owns the agent-need → resource lifecycle for the sluggable resource types (connection, mcp_server, exec_endpoint): instantiating a resource from a need's declared shape, binding an existing resource to a need, and listing the resources that could satisfy a need.
A resource is always born from a need — the need's spec is the only source of the integration shape; a user supplies only credentials and ownership. So every create is "instantiate THIS need", never a freeform resource.
Index ¶
- func ConnectionCompatible(needSpec []byte, connection dbq.Connection) bool
- func CreateForNeed(ctx context.Context, q *dbq.Queries, p authz.Principal, agentID uuid.UUID, ...) (uuid.UUID, error)
- func MCPCompatible(needSpec []byte, server dbq.AgentMcpServer) bool
- type Candidate
- type NeedInfo
- type Service
- func (s *Service) BindExisting(ctx context.Context, p authz.Principal, agentID uuid.UUID, typ, slug string, ...) error
- func (s *Service) CreateResourceForNeed(ctx context.Context, p authz.Principal, agentID uuid.UUID, ...) (uuid.UUID, error)
- func (s *Service) ListCandidates(ctx context.Context, p authz.Principal, agentID uuid.UUID, typ, slug string) ([]Candidate, error)
- func (s *Service) ListNeeds(ctx context.Context, p authz.Principal, agentID uuid.UUID) ([]NeedInfo, error)
- func (s *Service) Unbind(ctx context.Context, p authz.Principal, agentID uuid.UUID, typ, slug string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectionCompatible ¶
func ConnectionCompatible(needSpec []byte, connection dbq.Connection) bool
ConnectionCompatible reports structural compatibility without considering OAuth scope readiness.
func CreateForNeed ¶
func CreateForNeed(ctx context.Context, q *dbq.Queries, p authz.Principal, agentID uuid.UUID, typ, slug, displayName string, createNew bool) (uuid.UUID, error)
CreateForNeed instantiates the resource an agent's need declares — from the need's frozen spec — as a NEW resource owned by p, and binds it to the need. Unless createNew is set, an existing binding is targeted. createNew always instantiates a UUID-named resource and replaces the binding for non-OAuth resources; OAuth resources stay provisional until callback succeeds.
func MCPCompatible ¶
func MCPCompatible(needSpec []byte, server dbq.AgentMcpServer) bool
MCPCompatible reports structural compatibility without considering OAuth scope readiness.
Types ¶
type Candidate ¶
type Candidate struct {
ResourceID uuid.UUID
Name string
DisplayName string
Slug string
Readiness string
Authorized bool
Configured bool
AgentCount int32
Required []string
Missing []string
Capabilities []string
}
Candidate is a shape-compatible resource the caller may bind through ownership or a resource grant.
type NeedInfo ¶
type NeedInfo struct {
Type string
Slug string
Description string
Bound bool
BoundResourceID uuid.UUID
}
NeedInfo is one of an agent's declared needs and whether it's bound yet.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service exposes the operator-facing need lifecycle: create a resource for a need, bind an existing one, and list compatible candidates.
func NewService ¶
func (*Service) BindExisting ¶
func (s *Service) BindExisting(ctx context.Context, p authz.Principal, agentID uuid.UUID, typ, slug string, resourceID uuid.UUID) error
BindExisting binds an existing resource after checking agent admin, resource bind capability, and shape compatibility in one transaction.
func (*Service) CreateResourceForNeed ¶
func (s *Service) CreateResourceForNeed(ctx context.Context, p authz.Principal, agentID uuid.UUID, typ, slug, displayName string) (uuid.UUID, error)
CreateResourceForNeed instantiates a new resource for the need, owned by the caller, and binds it. Agent-admin gated.
func (*Service) ListCandidates ¶
func (s *Service) ListCandidates(ctx context.Context, p authz.Principal, agentID uuid.UUID, typ, slug string) ([]Candidate, error)
ListCandidates returns the caller's resources (owned by its grantee set) whose frozen shape matches the need — the resources it can bind for reuse.