skill_executor

package
v1.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package executor implements skill execution with sandboxing.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSkillAlreadyLoaded is returned when loading a skill that's already loaded.
	ErrSkillAlreadyLoaded = errors.New("executor: skill already loaded")

	// ErrSkillNotFound is returned when skill doesn't exist.
	ErrSkillNotFound = errors.New("executor: skill not found")

	// ErrNilSkill is returned when skill is nil.
	ErrNilSkill = errors.New("executor: nil skill")

	// ErrEmptySkillID is returned when skill ID is empty.
	ErrEmptySkillID = errors.New("executor: empty skill ID")

	// ErrNoWasmBytes is returned when skill has no Wasm module.
	ErrNoWasmBytes = errors.New("executor: skill has no wasm bytes")
)
View Source
var ErrNilExecutionPlan = errors.New("executor: nil execution plan")

ErrNilExecutionPlan is returned when execution plan is nil.

Functions

This section is empty.

Types

type DefaultExecutor

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

DefaultExecutor implements SkillExecutor with real Wasm execution.

func NewDefaultExecutor

func NewDefaultExecutor() *DefaultExecutor

NewDefaultExecutor creates a new executor.

func NewDefaultExecutorWithRuntime

func NewDefaultExecutorWithRuntime(rt *wasm.Runtime, tools toolrunner.ToolRunner) *DefaultExecutor

NewDefaultExecutorWithRuntime creates an executor with Wasm execution.

func (*DefaultExecutor) CanExecute

func (e *DefaultExecutor) CanExecute(ctx context.Context, skillID string) (bool, error)

CanExecute checks if the skill can be executed.

func (*DefaultExecutor) Execute

Execute runs a skill with the given input.

func (*DefaultExecutor) ExecuteFromPlan

ExecuteFromPlan executes a validated execution plan.

This is the PREFERRED entry point for skill execution. It:

  1. Validates the plan is not nil and has a skill ID
  2. Serializes plan.Arguments to JSON
  3. Calls the underlying Execute method

Direct calls to Execute with raw bytes are discouraged.

func (*DefaultExecutor) ExecutePlan

ExecutePlan runs a multi-step execution plan using a StepRunner.

func (*DefaultExecutor) Get

func (e *DefaultExecutor) Get(id string) (skills.Skill, error)

Get retrieves a skill by ID.

func (*DefaultExecutor) GetSkill

func (e *DefaultExecutor) GetSkill(ctx context.Context, skillID string) (skills.Skill, error)

GetSkill returns a loaded skill by ID.

func (*DefaultExecutor) List

func (e *DefaultExecutor) List() []string

List returns all loaded skill IDs.

func (*DefaultExecutor) ListSkills

func (e *DefaultExecutor) ListSkills(ctx context.Context) []string

ListSkills returns all loaded skill IDs.

func (*DefaultExecutor) LoadSkill

func (e *DefaultExecutor) LoadSkill(ctx context.Context, s skills.Skill) error

LoadSkill prepares a skill for execution.

func (*DefaultExecutor) LoadSkillWithWasm

func (e *DefaultExecutor) LoadSkillWithWasm(ctx context.Context, s skills.Skill, wasmBytes []byte) error

LoadSkillWithWasm loads a skill with its Wasm module bytes.

func (*DefaultExecutor) SetToolRunner

func (e *DefaultExecutor) SetToolRunner(tools toolrunner.ToolRunner)

SetToolRunner updates the tool runner.

func (*DefaultExecutor) SkillCount

func (e *DefaultExecutor) SkillCount() int

SkillCount returns the number of loaded skills.

func (*DefaultExecutor) UnloadSkill

func (e *DefaultExecutor) UnloadSkill(ctx context.Context, skillID string) error

UnloadSkill removes a skill from execution.

type StepRunner

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

StepRunner executes a single step from an execution plan.

func NewStepRunner

func NewStepRunner(executor *DefaultExecutor, tools toolrunner.ToolRunner) *StepRunner

NewStepRunner creates a new step runner.

func (*StepRunner) RunStep

RunStep executes one step and records the result in the execution context.

type WasmSkill

type WasmSkill interface {
	skills.Skill
	WasmBytes() []byte
}

WasmSkill extends skills.Skill with Wasm bytes.

Jump to

Keyboard shortcuts

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