runner

package
v0.7.19 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package runner orchestrates a single end-to-end skill execution: load manifest + skill, call LLM, parse memory, publish, writeback.

Index

Constants

View Source
const (
	DefaultMaxTurns            = 20
	DefaultMCPToolCallTimeoutS = 60
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Deps

type Deps struct {
	ProviderFactory   func(name string) (llm.Provider, error)
	Publishers        map[string]publish.Publisher
	MCPManagerFactory func(ctx context.Context) mcpManager
	Now               func() time.Time
	// EventSink receives observability events during execution. May be nil.
	EventSink func(RunEvent)
}

Deps inject the runner's collaborators.

type EventType

type EventType string

EventType identifies a structured runner event.

const (
	EventMCPServerStartOK   EventType = "mcp.server.start.ok"
	EventMCPTurnStart       EventType = "mcp.turn.start"
	EventMCPToolCallOK      EventType = "mcp.tool.call.ok"
	EventMCPToolCallFail    EventType = "mcp.tool.call.fail"
	EventMCPToolCallTimeout EventType = "mcp.tool.call.timeout"
	// EventPhaseEnter marks entry into a coarse lifecycle phase
	// (boot|secrets|exec|publish|fail). Payload: {"phase": "<name>"} on
	// the happy path; {"phase":"fail","prev":"<name>"} on terminal error.
	EventPhaseEnter EventType = "phase.enter"
)

type RunEvent

type RunEvent struct {
	Type    EventType
	Payload map[string]any
}

RunEvent is a structured event the runner emits during execution.

type RunInput

type RunInput struct {
	RepoRoot     string
	ManifestPath string // relative to RepoRoot
	SkillPath    string // from manifest
	ScheduleName string

	RunID string

	Secrets *runnersecrets.Resolver

	LLMAPIKey     string
	LLMEndpoint   string // Azure AI Foundry only
	LLMDeployment string // Azure AI Foundry only

	DryRun   bool // don't publish, don't writeback, don't push
	SkipPush bool // writeback commit locally but don't push

	GitHubUsername string
	GitHubToken    string

	MCPServers []config.MCPServer
	MCPEnv     map[string]map[string]config.EnvValue
	MaxTurns   int
}

RunInput bundles all inputs to a single Run invocation.

type RunResult

type RunResult struct {
	Status         Status
	ErrorKind      string
	Usage          llm.Usage
	CostCents      int
	Output         string
	MemoryContent  string
	PublishResults []publish.Result
	WritebackSHA   string
	StartedAt      time.Time
	FinishedAt     time.Time
}

RunResult is the terminal state of a single run.

type Runner

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

Runner executes a single skill-schedule run.

func New

func New(d Deps) *Runner

New constructs a Runner.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, in RunInput) (RunResult, error)

Run executes a full skill invocation: load → LLM → parse → publish → writeback.

type Status

type Status string

Status is the terminal status of a Run.

const (
	StatusSucceeded      Status = "succeeded"
	StatusPartialFailure Status = "partial_failure"
	StatusFailed         Status = "failed"
)

Jump to

Keyboard shortcuts

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