Capabilities — diagram coverage (assembly side vs consumption side)

Updated · View the entry on sijie.xyz ↗

Same two-sided cut as connector-diagram-coverage: the assembly side (how capabilities register and get exposed per session) and the consumption side (what the loop actually holds). The plugin-loading types live on mcp-capability-plugins; skills runner types on skills-progressive-disclosure; frontend card types on ui-cards.

1 · Assembly side — registry, gates, session context

classDiagram
  class Capability {
    <<interface - capreg>>
    +ID() string
    +Shape() Shape
    +VisitorBinding(ctx, *AssembleInput) (*Binding, error)
    +OwnerMCPBindings() []*MCPBinding
    +SystemPromptFragment(ctx, *AssembleInput) string
    +SystemPromptFragmentID(ctx, *AssembleInput) string
  }
  class Registry {
    -caps []Capability - deterministic order, prompt hash depends on it
    -seen map[string]bool
    -origin map[string]Origin
    -gate EnableGate
    -depReg *DepRegistry
    -alwaysGranted []string
    -mu sync.RWMutex
    +SetEnableGate(g)
  }
  class AssembleInput {
    RoleSnapshot *access.RoleSnapshot
    OwnerID, Mode string
    Subject Subject
    Visitor access.VisitorProfile
    ConversationID string
  }
  class EnableGate {
    <<func type>>
    func(ctx, ownerID) map[string]bool
    the LIVE global layer
  }
  Registry o-- Capability : fixed order
  Capability ..> AssembleInput : per session
  Registry ..> EnableGate : exposure

AssembleInput is the whole session context a capability may see — it carries the frozen RoleSnapshot, so every binding decision happens against the freeze; EnableGate (the live global layer) is the only live input. (Members verified against internal/capabilities/capreg/types.go / registry.go on 2026-09-07: the former CodeID / MaxBookings fields are gone — the code identity now travels as Subject, and the booking cap is a config key of the capability's own manifest (max_bookings in backend/capabilities/calendar.book/manifest.yaml).)

2 · Consumption side — what a session actually holds

classDiagram
  class Binding {
    Close func()
    ClaimGate *ClaimGate
    Tools []BindingTool
    State CapabilityState
  }
  class CapabilityState {
    ID, Title string
    PolicySummary string
    Enabled bool
    QuotaRemaining *int32
    Extra json.RawMessage
  }
  class VisitorAgent {
    <<agentcore - the loop-facing product>>
    Labels map[string]string
    ReturnDirectly map[string]bool
    SystemPrompt string
    Tools []tool.BaseTool
  }
  Binding *-- CapabilityState
  VisitorAgent o-- Binding : assembled tools

Coverage checklist (anti-omission gate)

type / area diagrammed at verified
Capability, Registry, AssembleInput, EnableGate this page §1 ✓ code
Binding, CapabilityState, VisitorAgent this page §2 ✓ code
Manifest / Transport / Sandbox / PluginSpec mcp-capability-plugins ✓ code
skillRunnerCapability + tool inputs/outputs skills-progressive-disclosure ✓ code
cardKindFor / McpAppCard / GenericDumpCard ui-cards ✓ code
mcpclient transports (http / in-process / stdio) ☐ not yet diagrammed —
capsocket server + hostdesk op collection (hostop.Op, routes/hostdesk) capsocket (prose) ☐ no class diagram

Related notes