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 CreateForNeed(ctx context.Context, q *dbq.Queries, p authz.Principal, agentID uuid.UUID, ...) (uuid.UUID, error)
- 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, typ, slug string) (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)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateForNeed ¶
func CreateForNeed(ctx context.Context, q *dbq.Queries, p authz.Principal, agentID uuid.UUID, typ, slug string) (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. Idempotent: if the need is already bound it returns the bound resource id without creating anything. Callers authorize before calling; this is the pure provisioning step shared by lazy create-on-configure and the explicit "set up a new resource" action.
Types ¶
type Candidate ¶
Candidate is a resource that could satisfy a need: shape-compatible and owned by a principal in the caller's grantee set.
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 (*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 to the need after verifying the caller may bind it (owns it via its grantee set) and that its shape matches the need.
func (*Service) CreateResourceForNeed ¶
func (s *Service) CreateResourceForNeed(ctx context.Context, p authz.Principal, agentID uuid.UUID, typ, slug 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.