capability

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package capability owns the stable abilities exposed by the Runtime. Concrete tools are implementation details bound through provider adapters.

Index

Constants

View Source
const (
	InternetSearch     = "internet.search"
	InternetFetch      = "internet.fetch"
	GitHubSearch       = "github.search"
	WeatherCurrent     = "weather.current"
	MapsRoute          = "maps.route"
	FilesystemList     = "filesystem.list"
	FilesystemSearch   = "filesystem.search"
	FilesystemRead     = "filesystem.read"
	FilesystemEdit     = "filesystem.edit"
	FilesystemWrite    = "filesystem.write"
	PythonExecute      = "python.execute"
	SystemShell        = "system.shell"
	SystemWait         = "system.wait"
	BrowserSearch      = "browser.search"
	BrowserTask        = "browser.task"
	BrowserOpen        = "browser.open"
	BrowserNavigate    = "browser.navigate"
	BrowserLogin       = "browser.login"
	BrowserRead        = "browser.read"
	BrowserObserve     = "browser.observe"
	BrowserAction      = "browser.action"
	BrowserWait        = "browser.wait"
	BrowserDownload    = "browser.download"
	BrowserScreenshot  = "browser.screenshot"
	BrowserPointer     = "browser.pointer"
	BrowserAutomation  = "browser.automation"
	BrowserClose       = "browser.close"
	DesktopAction      = "desktop.action"
	PlanningTodo       = "planning.todo"
	PlanningEnter      = "planning.enter"
	PlanningExit       = "planning.exit"
	TaskCreate         = "task.create"
	TaskGet            = "task.get"
	TaskList           = "task.list"
	TaskUpdate         = "task.update"
	InteractionAsk     = "interaction.ask"
	AutomationSchedule = "automation.schedule"
	OrchestrationGoal  = "orchestration.goal"
	ImageGenerate      = "media.image.generate"
	VideoGenerate      = "media.video.generate"
)

Variables

View Source
var GlobalRegistry = NewRegistry()

Functions

func BrowserIDs added in v1.0.0

func BrowserIDs() []string

func ClientBoundModelNames added in v0.1.4

func ClientBoundModelNames() []string

ClientBoundModelNames returns the model function names of every registered client-bound capability in the global registry.

func IsBrowser added in v1.0.0

func IsBrowser(id string) bool

func IsClientBound added in v0.1.4

func IsClientBound(id string) bool

IsClientBound reports whether a capability executes on the user's device rather than on the server. Client-bound tools return an actionprotocol payload that must be dispatched through an OnAction sink, so they can only be fulfilled by the streaming execution path.

func IsDesktop added in v1.0.0

func IsDesktop(id string) bool

func ModelName

func ModelName(id string) string

ModelName encodes a dotted capability ID as an API-compatible function name.

func Wrap

func Wrap(definition Definition, provider tool.BaseTool) tool.BaseTool

Wrap exposes a concrete provider through a capability contract.

Types

type Definition

type Definition struct {
	ID                  string                    `json:"id" yaml:"id"`
	Description         string                    `json:"description" yaml:"description"`
	Input               map[string]string         `json:"input,omitempty" yaml:"input,omitempty"`
	Output              string                    `json:"output,omitempty" yaml:"output,omitempty"`
	ReadOnly            bool                      `json:"read_only" yaml:"read_only"`
	Risk                string                    `json:"risk" yaml:"risk"`
	RiskFloor           string                    `json:"risk_floor,omitempty" yaml:"risk_floor,omitempty"`
	Status              Status                    `json:"status" yaml:"status"`
	Provider            string                    `json:"provider,omitempty" yaml:"provider,omitempty"`
	ProviderVersion     string                    `json:"provider_version,omitempty" yaml:"provider_version,omitempty"`
	Permissions         map[string]any            `json:"permissions,omitempty" yaml:"permissions,omitempty"`
	ObservationContract string                    `json:"observation_contract,omitempty" yaml:"observation_contract,omitempty"`
	Preconditions       []protocol.WorldCondition `json:"preconditions" yaml:"preconditions"`
	ExpectedEffects     []protocol.WorldEffect    `json:"expected_effects" yaml:"expected_effects"`
	Postconditions      []protocol.WorldCondition `json:"postconditions" yaml:"postconditions"`
	Reason              string                    `json:"reason,omitempty" yaml:"reason,omitempty"`
}

Definition is a provider-independent capability contract.

type Factory

type Factory func(basePath string) (tool.BaseTool, error)

type Namespace added in v1.0.0

type Namespace string
const (
	NamespaceBrowser Namespace = "browser"
	NamespaceDesktop Namespace = "desktop"
)

func NamespaceOf added in v1.0.0

func NamespaceOf(id string) Namespace

NamespaceOf returns the first segment of a canonical dotted capability ID.

type Registry

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

func NewRegistry

func NewRegistry() *Registry

func (*Registry) ClientBoundModelNames added in v0.1.4

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

ClientBoundModelNames returns the model function names of every registered client-bound capability. Used to strip these tools from non-streaming runs, where their actions cannot be dispatched.

func (*Registry) FindByModelName

func (r *Registry) FindByModelName(name string) (Definition, bool)

func (*Registry) Get

func (r *Registry) Get(id string) (Definition, bool)

func (*Registry) IDsInNamespace added in v1.0.0

func (r *Registry) IDsInNamespace(namespace Namespace) []string

func (*Registry) List

func (r *Registry) List() []Definition

func (*Registry) Register

func (r *Registry) Register(definition Definition, factory Factory) error

func (*Registry) RegisterExternal added in v1.0.0

func (r *Registry) RegisterExternal(definition Definition, factory Factory) error

RegisterExternal registers a verified provider loaded from the private plugin Registry. External entries are removable as one unit during a safe reload; built-in registrations are never replaced.

func (*Registry) RemoveExternal added in v1.0.0

func (r *Registry) RemoveExternal()

RemoveExternal drops only dynamically loaded provider registrations. It is used before config reload so disabled/revoked versions cannot remain live.

func (*Registry) RemoveExternalProvider added in v1.0.0

func (r *Registry) RemoveExternalProvider(provider, version string)

RemoveExternalProvider rolls back a partially registered provider package.

func (*Registry) Resolve

func (r *Registry) Resolve(basePath string, ids []string) ([]tool.BaseTool, []string, error)

Resolve creates model-callable adapters for available capability IDs.

type Set added in v1.0.0

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

Set keeps capability IDs unique while preserving their insertion order.

func NewSet added in v1.0.0

func NewSet(ids ...string) *Set

func (*Set) Add added in v1.0.0

func (s *Set) Add(ids ...string)

func (*Set) Contains added in v1.0.0

func (s *Set) Contains(id string) bool

func (*Set) IDs added in v1.0.0

func (s *Set) IDs() []string

func (*Set) Remove added in v1.0.0

func (s *Set) Remove(ids ...string)

func (*Set) RemoveMatching added in v1.0.0

func (s *Set) RemoveMatching(match func(string) bool)

func (*Set) RetainMatching added in v1.0.0

func (s *Set) RetainMatching(match func(string) bool)

type Status

type Status string
const (
	StatusAvailable   Status = "available"
	StatusUnavailable Status = "unavailable"
)

Jump to

Keyboard shortcuts

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