extensions

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bridge

func Bridge(extensionTool ExtensionTool) toolspkg.Tool

Bridge projects an extension tool to the source-aware tool namespace. Invalid inputs are returned unchanged; callers that need strict validation should use RegisterBridgedTool.

func CanTransitionMCP

func CanTransitionMCP(from, to ExtensionStatus) bool

func NormalizeLegacySkill

func NormalizeLegacySkill(skill skillspkg.Skill) skillspkg.Skill

func ResolvePolicyToolSets

func ResolvePolicyToolSets(policy skillspkg.ToolPolicy, bindings []BridgeBinding) (map[string]struct{}, map[string]struct{}, error)

func SkillExtensionID

func SkillExtensionID(skillName string) string

SkillExtensionID builds the canonical extension id from a skill name. It intentionally prefixes with "skill." even when the input already has that prefix to keep backward compatibility with existing extension ids.

func StableToolKey

func StableToolKey(source ExtensionKind, extensionID, toolName string) (string, error)

func ValidateMCPTransition

func ValidateMCPTransition(from, to ExtensionStatus) error

Types

type BridgeBinding

type BridgeBinding struct {
	Source       ExtensionKind
	ExtensionID  string
	OriginalName string
	StableKey    string
}

func RegisterBridgedTool

func RegisterBridgedTool(registry *toolspkg.Registry, extensionTool ExtensionTool) (BridgeBinding, error)

func RegisterBridgedToolWithOptions

func RegisterBridgedToolWithOptions(registry *toolspkg.Registry, extensionTool ExtensionTool, opts BridgeRegisterOptions) (BridgeBinding, error)

type BridgeRegisterOptions

type BridgeRegisterOptions struct {
	AllowOriginalNameShadowBuiltin bool
}

type CapabilitySet

type CapabilitySet struct {
	Prompts   int
	Resources int
	Tools     int
	Commands  int
}

type ErrorCode

type ErrorCode string
const (
	ErrCodeInvalidSource     ErrorCode = "invalid_source"
	ErrCodeInvalidManifest   ErrorCode = "invalid_manifest"
	ErrCodeInvalidExtension  ErrorCode = "invalid_extension"
	ErrCodeInvalidTransition ErrorCode = "invalid_transition"
	ErrCodeNotFound          ErrorCode = "not_found"
	ErrCodeDuplicate         ErrorCode = "duplicate_extension"
	ErrCodeAlreadyLoaded     ErrorCode = "already_loaded"
	ErrCodeConflict          ErrorCode = "conflict"
	ErrCodeBusy              ErrorCode = "busy"
	ErrCodeLoadFailed        ErrorCode = "load_failed"
	ErrCodeUnloadFailed      ErrorCode = "unload_failed"
)

type Extension

type Extension interface {
	Info() ExtensionInfo
	ResolveTools(ctx context.Context) ([]ExtensionTool, error)
	Health(ctx context.Context) (HealthSnapshot, error)
}

Extension models a loadable extension source (for example skill or mcp). Implementations should keep failures local to the extension instance and expose health degradation through Health rather than process-level errors.

type ExtensionError

type ExtensionError struct {
	Code    ErrorCode
	Message string
	Err     error
}

func (*ExtensionError) CodeString

func (e *ExtensionError) CodeString() string

func (*ExtensionError) Error

func (e *ExtensionError) Error() string

func (*ExtensionError) Unwrap

func (e *ExtensionError) Unwrap() error

type ExtensionEvent

type ExtensionEvent struct {
	Type        string
	ExtensionID string
	Kind        ExtensionKind
	Status      ExtensionStatus
	Reason      string
	ErrorCode   ErrorCode
	OccurredAt  string
	Message     string
}

type ExtensionInfo

type ExtensionInfo struct {
	ID           string
	Name         string
	Kind         ExtensionKind
	Version      string
	Title        string
	Description  string
	Source       ExtensionSource
	Status       ExtensionStatus
	Capabilities CapabilitySet
	Manifest     Manifest
	Health       HealthSnapshot
}

func (ExtensionInfo) IsZero

func (info ExtensionInfo) IsZero() bool

func (ExtensionInfo) Valid

func (info ExtensionInfo) Valid() bool

type ExtensionKind

type ExtensionKind string
const (
	ExtensionMCP   ExtensionKind = "mcp"
	ExtensionSkill ExtensionKind = "skill"
)

type ExtensionScope

type ExtensionScope string
const (
	ExtensionScopeBuiltin ExtensionScope = "builtin"
	ExtensionScopeUser    ExtensionScope = "user"
	ExtensionScopeProject ExtensionScope = "project"
	ExtensionScopeRemote  ExtensionScope = "remote"
)

type ExtensionSource

type ExtensionSource struct {
	Scope ExtensionScope
	Ref   string
}

type ExtensionStatus

type ExtensionStatus string
const (
	ExtensionStatusUnknown  ExtensionStatus = "unknown"
	ExtensionStatusPending  ExtensionStatus = "pending"
	ExtensionStatusLoaded   ExtensionStatus = "loaded"
	ExtensionStatusActive   ExtensionStatus = "active"
	ExtensionStatusReady    ExtensionStatus = "ready"
	ExtensionStatusDegraded ExtensionStatus = "degraded"
	ExtensionStatusFailed   ExtensionStatus = "failed"
	ExtensionStatusStopped  ExtensionStatus = "stopped"
)

type ExtensionTool

type ExtensionTool struct {
	Source      ExtensionKind
	ExtensionID string
	Tool        toolspkg.Tool
}

type HealthSnapshot

type HealthSnapshot struct {
	Status       ExtensionStatus
	Message      string
	LastError    ErrorCode
	CheckedAtUTC string
}

type HealthTester

type HealthTester interface {
	Test(ctx context.Context, extensionID string) (HealthSnapshot, error)
}

HealthTester is an optional manager capability used by /mcp and CLI health checks to force a server probe and return the latest snapshot.

type Invalidator

type Invalidator interface {
	Invalidate(extensionID string)
}

Invalidator is an optional manager capability for marking extension runtime caches dirty so the next sync can refresh eagerly.

type Manager

type Manager interface {
	Load(ctx context.Context, source string) (ExtensionInfo, error)
	Unload(ctx context.Context, extensionID string) error
	Get(ctx context.Context, extensionID string) (ExtensionInfo, error)
	List(ctx context.Context) ([]ExtensionInfo, error)
}

func NewManager

func NewManager(workspace string) Manager

func NewManagerWithDirs

func NewManagerWithDirs(workspace, builtinDir, userDir, projectDir string) Manager

type Manifest

type Manifest struct {
	Name         string
	Version      string
	Title        string
	Description  string
	Kind         ExtensionKind
	Source       ExtensionSource
	Capabilities CapabilitySet
}

type NopManager

type NopManager struct{}

NopManager keeps extension layer explicit while integration is incremental.

func (NopManager) Get

func (NopManager) Get(_ context.Context, extensionID string) (ExtensionInfo, error)

func (NopManager) Invalidate

func (NopManager) Invalidate(_ string)

func (NopManager) List

func (NopManager) Load

func (NopManager) Reload

func (NopManager) Reload(_ context.Context) error

func (NopManager) ResolveAllTools

func (NopManager) ResolveAllTools(_ context.Context) ([]ExtensionTool, error)

func (NopManager) Test

func (NopManager) Unload

func (NopManager) Unload(_ context.Context, _ string) error

type Reloader

type Reloader interface {
	Reload(ctx context.Context) error
}

Reloader is an optional manager capability for force-refreshing extension runtime state (for example after config mutations).

type ToolResolver

type ToolResolver interface {
	ResolveAllTools(ctx context.Context) ([]ExtensionTool, error)
}

ToolResolver is an optional manager capability for resolving extension tools into bridgeable tool definitions for registry sync.

type ToolUseContext

type ToolUseContext struct {
	SessionID corepkg.SessionID
	TaskID    corepkg.TaskID
	TraceID   corepkg.TraceID
	Workspace string
	Metadata  map[string]string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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