skills

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAllSkillTools

func CreateAllSkillTools(repo skill.Repository, executor Executor) []tool.Tool

CreateAllSkillTools creates all skill tools including list, load, and run. This function exists to provide a convenient way to create all skill tools at once. Without this function, callers would need to create each tool separately.

func CreateSkillTools

func CreateSkillTools(repo skill.Repository, executor Executor) []tool.Tool

CreateSkillTools creates both skill_load and skill_run tools. This function exists to provide a convenient way to create both skill tools at once. Without this function, callers would need to create each tool separately.

func LoadSkillsFromConfig

func LoadSkillsFromConfig(ctx context.Context, roots ...string) ([]tool.Tool, error)

LoadSkillsFromConfig loads skills from the configuration. This function exists to initialize the skills system based on the Genie configuration. Without this function, we could not load skills from the config file. It supports multiple skills roots including local paths and remote HTTPS URLs.

func NewListSkillsTool

func NewListSkillsTool(repo skill.Repository) tool.Tool

NewListSkillsTool creates a new ListSkillsTool. This function exists to initialize the list_skills tool with a repository. Without this function, we could not create the list_skills tool.

func NewSkillLoadTool

func NewSkillLoadTool(repo skill.Repository) tool.Tool

NewSkillLoadTool creates a new SkillLoadTool. This function exists to initialize the skill_load tool with a repository. Without this function, we could not create the skill_load tool.

func NewSkillRunTool

func NewSkillRunTool(repo skill.Repository, executor Executor) tool.Tool

NewSkillRunTool creates a new SkillRunTool. This function exists to initialize the skill_run tool with a repository and executor. Without this function, we could not create the skill_run tool.

Types

type ExecuteRequest

type ExecuteRequest struct {
	SkillPath   string            // Absolute path to skill directory
	ScriptPath  string            // Relative path to script within skill
	Args        []string          // Command-line arguments for script
	InputFiles  map[string]string // Input files (name -> content)
	Environment map[string]string // Additional environment variables
	Timeout     time.Duration     // Execution timeout (0 = use default)
}

ExecuteRequest contains parameters for script execution. This struct exists to encapsulate all execution parameters in one place. Without this struct, Execute() would have many individual parameters.

type ExecuteResponse

type ExecuteResponse struct {
	Output      string            // Combined stdout/stderr
	Error       string            // Error message if execution failed
	ExitCode    int               // Script exit code
	OutputFiles map[string]string // Output files (name -> content)
}

ExecuteResponse contains the results of script execution. This struct exists to return all execution results in one place. Without this struct, Execute() would need multiple return values.

type Executor

type Executor interface {
	Execute(ctx context.Context, req ExecuteRequest) (ExecuteResponse, error)
}

Executor executes skill scripts. This interface exists to abstract script execution and enable testing with fake implementations. Without this interface, we would be tightly coupled to local script execution.

type ExecutorConfig

type ExecutorConfig struct {
	// MaxWorkspaceSize is the maximum total size of workspace files in bytes.
	// 0 means unlimited. Default: 100MB
	MaxWorkspaceSize int64
	// MaxOutputFileSize is the maximum size of a single output file in bytes.
	// 0 means unlimited. Default: 10MB
	MaxOutputFileSize int64
	// DefaultTimeout is the default execution timeout if not specified in request.
	// 0 means no default timeout. Default: 5 minutes
	DefaultTimeout time.Duration
}

ExecutorConfig contains configuration for the executor. This struct exists to provide configurable resource limits. Without this struct, we couldn't control resource usage.

func DefaultExecutorConfig

func DefaultExecutorConfig() ExecutorConfig

DefaultExecutorConfig returns sensible default configuration.

type ListSkillsRequest

type ListSkillsRequest struct {
}

ListSkillsRequest is the request for list_skills. This struct exists to define the input schema for the list_skills tool. Without this struct, the tool would not have a proper schema.

type ListSkillsResponse

type ListSkillsResponse struct {
	Skills []SkillSummary `json:"skills"`
	Count  int            `json:"count"`
}

ListSkillsResponse is the response for list_skills. This struct exists to return the list of available skills. Without this struct, we could not return structured skill summaries.

func (ListSkillsResponse) MarshalJSON

func (r ListSkillsResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements custom JSON marshaling for tool responses. This is needed because the trpc-agent-go function tool expects JSON responses.

type ListSkillsTool

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

ListSkillsTool provides a tool for listing available skills. This struct exists to enable agents to discover what skills are available. Without this struct, agents would not know which skills they can use.

type LocalExecutor

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

LocalExecutor implements Executor for local script execution. This struct exists to provide local script execution with workspace isolation. Without this struct, we would not be able to execute skills locally.

func NewLocalExecutor

func NewLocalExecutor(baseWorkDir string) *LocalExecutor

NewLocalExecutor creates a new LocalExecutor with default configuration. This function exists to initialize the executor with a base workspace directory. Without this function, we could not create executor instances.

func NewLocalExecutorWithConfig

func NewLocalExecutorWithConfig(baseWorkDir string, config ExecutorConfig) *LocalExecutor

NewLocalExecutorWithConfig creates a new LocalExecutor with custom configuration. This function exists to allow customization of resource limits. Without this function, users could not configure executor behavior.

func (*LocalExecutor) Execute

Execute implements Executor. This method exists to execute skill scripts with proper workspace isolation and cleanup. Without this method, we could not run skill scripts.

type SkillLoadRequest

type SkillLoadRequest struct {
	SkillName string `json:"skill_name" jsonschema:"description=Name of the skill to load,required"`
}

SkillLoadRequest is the request for skill_load. This struct exists to define the input schema for the skill_load tool. Without this struct, agents would not know how to call the tool.

type SkillLoadResponse

type SkillLoadResponse struct {
	Name         string   `json:"name"`
	Description  string   `json:"description"`
	Instructions string   `json:"instructions"`
	Documents    []string `json:"documents,omitempty"`
	Error        string   `json:"error,omitempty"`
}

SkillLoadResponse is the response for skill_load. This struct exists to return skill instructions to the agent. Without this struct, we could not return structured skill information.

func (SkillLoadResponse) MarshalJSON

func (r SkillLoadResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements custom JSON marshaling for tool responses. This is needed because the trpc-agent-go function tool expects JSON responses.

type SkillLoadTool

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

SkillLoadTool provides the skill_load tool for loading skill instructions. This struct exists to enable agents to discover and load skill instructions. Without this struct, agents could not access skill documentation.

type SkillRunRequest

type SkillRunRequest struct {
	SkillName   string            `json:"skill_name" jsonschema:"description=Name of the skill to run,required"`
	ScriptPath  string            `` /* 129-byte string literal not displayed */
	Args        []string          `json:"args,omitempty" jsonschema:"description=Arguments to pass to the script"`
	InputFiles  map[string]string `json:"input_files,omitempty" jsonschema:"description=Map of filename to content for input files"`
	Environment map[string]string `json:"environment,omitempty" jsonschema:"description=Additional environment variables"`
}

SkillRunRequest is the request for skill_run. This struct exists to define the input schema for the skill_run tool. Without this struct, agents would not know how to call the tool.

type SkillRunResponse

type SkillRunResponse struct {
	Output      string            `json:"output"`
	Error       string            `json:"error,omitempty"`
	ExitCode    int               `json:"exit_code"`
	OutputFiles map[string]string `json:"output_files,omitempty"`
}

SkillRunResponse is the response for skill_run. This struct exists to return execution results to the agent. Without this struct, we could not return structured execution results.

func (SkillRunResponse) MarshalJSON

func (r SkillRunResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements custom JSON marshaling for tool responses. This is needed because the trpc-agent-go function tool expects JSON responses.

type SkillRunTool

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

SkillRunTool provides the skill_run tool for executing skills. This struct exists to enable agents to execute skill scripts. Without this struct, agents could not run skills.

type SkillSummary

type SkillSummary = skill.Summary

SkillSummary represents a skill summary in the list response. This is an alias for skill.Summary from trpc-agent-go.

type ToolProvider

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

ToolProvider wraps a skill repository and executor and satisfies the tools.ToolProviders interface so skill tools can be passed directly to tools.NewRegistry. Without this, skill tool construction would be inlined in the registry.

func NewToolProvider

func NewToolProvider(repo skill.Repository, executor Executor) *ToolProvider

NewToolProvider creates a ToolProvider for skills tools. Callers are responsible for creating the repository and executor.

func (*ToolProvider) GetTools

func (p *ToolProvider) GetTools() []tool.Tool

GetTools returns all skill tools (load, run, list) wired to the underlying repository and executor.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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