core

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package core provides the canonical agent definition types. Agent definitions use the multi-agent-spec types as the canonical form, which maps losslessly to Claude Code, Kiro CLI, and OpenAI Codex.

Index

Constants

View Source
const (
	ModelHaiku  = multiagentspec.ModelHaiku
	ModelSonnet = multiagentspec.ModelSonnet
	ModelOpus   = multiagentspec.ModelOpus
)

Model constants from multiagentspec.

View Source
const DefaultDirMode fs.FileMode = 0700

DefaultDirMode is the default permission for generated directories.

View Source
const DefaultFileMode fs.FileMode = 0600

DefaultFileMode is the default permission for generated files.

Variables

View Source
var DefaultRegistry = NewRegistry()

DefaultRegistry is the global adapter registry.

Functions

func AdapterNames

func AdapterNames() []string

AdapterNames returns adapter names from the default registry.

func MarshalMarkdownAgent

func MarshalMarkdownAgent(agent *Agent) []byte

MarshalMarkdownAgent converts an Agent to Markdown + YAML frontmatter bytes.

func Register

func Register(adapter Adapter)

Register adds an adapter to the default registry.

func WriteAgentsToDir

func WriteAgentsToDir(agents []*Agent, dir string, adapterName string) error

WriteAgentsToDir writes multiple agents to a directory using the specified adapter.

func WriteCanonicalFile

func WriteCanonicalFile(agent *Agent, path string) error

WriteCanonicalFile writes a canonical agent file in Markdown + YAML frontmatter format.

func WriteCanonicalJSON

func WriteCanonicalJSON(agent *Agent, path string) error

WriteCanonicalJSON writes a canonical agent.json file (for validation/schema compatibility).

Types

type Adapter

type Adapter interface {
	// Name returns the adapter identifier (e.g., "claude", "gemini").
	Name() string

	// FileExtension returns the file extension for agent files.
	FileExtension() string

	// DefaultDir returns the default directory name for agents.
	DefaultDir() string

	// Parse converts tool-specific bytes to canonical Agent.
	Parse(data []byte) (*Agent, error)

	// Marshal converts canonical Agent to tool-specific bytes.
	Marshal(agent *Agent) ([]byte, error)

	// ReadFile reads from path and returns canonical Agent.
	ReadFile(path string) (*Agent, error)

	// WriteFile writes canonical Agent to path.
	WriteFile(agent *Agent, path string) error
}

Adapter converts between canonical Agent definitions and tool-specific formats.

func GetAdapter

func GetAdapter(name string) (Adapter, bool)

GetAdapter returns an adapter from the default registry.

type AdapterError

type AdapterError struct {
	Name string
}

AdapterError indicates an unknown adapter was requested.

func (*AdapterError) Error

func (e *AdapterError) Error() string

type Agent

type Agent = multiagentspec.Agent

Agent is an alias for multiagentspec.Agent. This is the canonical agent definition type used across all platforms.

func NewAgent

func NewAgent(name, description string) *Agent

NewAgent creates a new Agent with the given name and description.

func ParseMarkdownAgent

func ParseMarkdownAgent(data []byte, path string) (*Agent, error)

ParseMarkdownAgent parses a Markdown file with YAML frontmatter into an Agent. Deprecated: Use multiagentspec.ParseAgentMarkdown directly.

func ReadCanonicalDir

func ReadCanonicalDir(dir string) ([]*Agent, error)

ReadCanonicalDir reads all agent files (.md or .json) from a directory. This delegates to multiagentspec.LoadAgentsFromDir for markdown files.

func ReadCanonicalFile

func ReadCanonicalFile(path string) (*Agent, error)

ReadCanonicalFile reads a canonical agent file (Markdown + YAML frontmatter or JSON). The format is auto-detected based on file extension or content.

type MarshalError

type MarshalError struct {
	Format string
	Err    error
}

MarshalError indicates a failure to marshal agent data.

func (*MarshalError) Error

func (e *MarshalError) Error() string

func (*MarshalError) Unwrap

func (e *MarshalError) Unwrap() error

type Model added in v0.7.0

type Model = multiagentspec.Model

Model is an alias for multiagentspec.Model.

type ParseError

type ParseError struct {
	Format string
	Path   string
	Err    error
}

ParseError indicates a failure to parse agent data.

func (*ParseError) Error

func (e *ParseError) Error() string

func (*ParseError) Unwrap

func (e *ParseError) Unwrap() error

type ReadError

type ReadError struct {
	Path string
	Err  error
}

ReadError indicates a failure to read a file.

func (*ReadError) Error

func (e *ReadError) Error() string

func (*ReadError) Unwrap

func (e *ReadError) Unwrap() error

type Registry

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

Registry manages adapter registration and lookup.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new adapter registry.

func (*Registry) AdapterNames

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

AdapterNames returns all registered adapter names sorted alphabetically.

func (*Registry) GetAdapter

func (r *Registry) GetAdapter(name string) (Adapter, bool)

GetAdapter returns an adapter by name.

func (*Registry) Register

func (r *Registry) Register(adapter Adapter)

Register adds an adapter to the registry.

type Task added in v0.7.0

type Task = multiagentspec.Task

Task is an alias for multiagentspec.Task.

type WriteError

type WriteError struct {
	Path string
	Err  error
}

WriteError indicates a failure to write a file.

func (*WriteError) Error

func (e *WriteError) Error() string

func (*WriteError) Unwrap

func (e *WriteError) Unwrap() error

Jump to

Keyboard shortcuts

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