runtime

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package runtime defines the capability execution pipeline.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Capability

type Capability struct {
	ProjectID string
	Spec      ToolSpec
	Handler   Handler
}

type Handler

type Handler func(ctx context.Context, input json.RawMessage) (Result, error)

func RequireWorkTree

func RequireWorkTree(root string, next Handler) Handler

RequireWorkTree wraps a handler so it refuses to run outside a git work tree.

type Result

type Result struct {
	Status      string   `json:"status"`
	Summary     string   `json:"summary"`
	Data        any      `json:"data,omitempty"`
	Artifacts   []string `json:"artifacts"`
	Warnings    []string `json:"warnings"`
	NextActions []string `json:"next_actions"`
	TraceID     string   `json:"trace_id"`
}

func Execute

func Execute(ctx context.Context, c Capability, input json.RawMessage) (result Result)

func WorkTreeBlock

func WorkTreeBlock(ctx context.Context, root string) (Result, bool)

WorkTreeBlock returns a blocked envelope when root is not inside a git work tree. Repo-scoped tools use this instead of inspecting the wrong directory.

type RiskLevel

type RiskLevel string
const (
	RiskSafe        RiskLevel = "safe"
	RiskWrite       RiskLevel = "write"
	RiskDestructive RiskLevel = "destructive"
)

type ToolSpec

type ToolSpec struct {
	Name           string
	Version        string
	Risk           RiskLevel
	ReadOnly       bool
	Idempotent     bool
	OpenWorld      bool
	Timeout        time.Duration
	MaxInputBytes  int64
	MaxOutputBytes int64
}

func (ToolSpec) Validate

func (s ToolSpec) Validate() error

Jump to

Keyboard shortcuts

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