capability

package
v0.6.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package capability assembles optional coding-product behavior around the reusable agent SDK. It owns registration and composition only; permissions, persistence, and execution remain responsibilities of the coding engine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Definition

type Definition struct {
	Manifest       Manifest
	Tools          []ToolContribution
	PromptSections []string
	BeforeToolCall func(agent.BeforeToolCallCtx) (block bool, reason string)
	AfterToolCall  func(agent.AfterToolCallCtx) *agent.AfterToolCallResult
}

Definition is the complete, build-time contribution of one capability. Hooks execute in capability registration order.

type Manifest

type Manifest struct {
	ID      string
	Version string
}

Manifest identifies one capability contribution. Version is informational for built-in capabilities today and becomes the compatibility surface for a future external plugin adapter.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry collects capabilities while a coding session is being constructed. It is intentionally build-time only; callers should finish registration before handing its tools and hooks to an Agent.

func NewRegistry

func NewRegistry() *Registry

NewRegistry returns an empty capability registry.

func (*Registry) AfterToolCall

func (r *Registry) AfterToolCall() func(agent.AfterToolCallCtx) *agent.AfterToolCallResult

AfterToolCall returns a hook that applies capability overrides in registration order. Each hook observes the result produced by earlier hooks.

func (*Registry) BeforeToolCall

func (r *Registry) BeforeToolCall() func(agent.BeforeToolCallCtx) (bool, string)

BeforeToolCall returns the composed capability veto hook. The first block wins; a nil return means no capability registered this hook.

func (*Registry) Manifests

func (r *Registry) Manifests() []Manifest

Manifests returns registered capability metadata in registration order.

func (*Registry) PromptSections

func (r *Registry) PromptSections() []string

PromptSections returns stable system-prompt sections in registration order.

func (*Registry) Register

func (r *Registry) Register(def Definition) error

Register validates and atomically adds one capability definition.

func (*Registry) ToolSource

func (r *Registry) ToolSource(name string) (string, bool)

ToolSource returns the capability ID that currently provides name.

func (*Registry) Tools

func (r *Registry) Tools() []tools.Tool

Tools returns active tools in deterministic advertise order. Replacing a tool preserves its original position.

type ToolContribution

type ToolContribution struct {
	Tool    tools.Tool
	Replace bool
}

ToolContribution is one tool registered by a capability. Replace must be set explicitly when a capability intentionally overrides an existing tool.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL