runtime

package
v0.21.2 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventChildQuestion = "child.question"
)

Shared runtime event names.

Variables

This section is empty.

Functions

func ExitCodeForStopReason added in v0.1.0

func ExitCodeForStopReason(stopReason string) int

ExitCodeForStopReason returns Avenor's locked process exit code for a terminal ACP stop reason.

func StopReasonForExitCode added in v0.7.2

func StopReasonForExitCode(exitCode int) string

StopReasonForExitCode is the inverse of ExitCodeForStopReason. Returns an empty string for exit code 1 (generic failure) since there is no canonical stop reason for that case.

Types

type AgentResult added in v0.14.0

type AgentResult struct {
	SessionID   string   `json:"session_id"`
	StopReason  string   `json:"stop_reason"`
	ExitCode    int      `json:"exit_code"`
	OutputFiles []string `json:"output_files,omitempty"`
}

AgentResult holds the result of a completed agent session.

type Capabilities

type Capabilities struct {
	Backend             string
	Permissions         bool
	Resume              bool
	ExternalServerURL   bool
	SubprocessDiscovery bool
	ModelSelection      bool
}

Capabilities describes what a runtime backend supports.

type ChildQuestionPayload added in v0.14.0

type ChildQuestionPayload struct {
	RuntimeID string `json:"runtime_id"`
	SessionID string `json:"session_id"`
	ChildID   string `json:"child_id"`
	Message   string `json:"message"`
	RequestID string `json:"request_id"`
}

ChildQuestionPayload is the shared contract for child->parent clarification events emitted by the supervisor and consumed by orchestrators.

func (ChildQuestionPayload) Fields added in v0.14.0

func (p ChildQuestionPayload) Fields() map[string]any

Fields returns the event field map used in events.Event.Fields.

type PermissionResponse

type PermissionResponse struct {
	Allow    bool
	OptionID string
	Message  string
}

PermissionResponse is the response to a permission request.

type Provider

type Provider interface {
	Start(ctx context.Context, opts StartOptions) (Session, error)
	Resume(ctx context.Context, sessionID string) (Session, error)
	Prompt(ctx context.Context, sessionID string, prompt string) error
	Cancel(ctx context.Context, sessionID string) error
	Events(ctx context.Context, sessionID string) (<-chan events.Event, error)
	AnswerPermission(ctx context.Context, sessionID string, requestID string, response PermissionResponse) error
	Capabilities(ctx context.Context) (Capabilities, error)
}

Provider is the interface that all ACP runtime backends must implement.

type Session

type Session struct {
	SessionID string
	Backend   string
	Dir       string
	PID       int // Consumed by longe halt (SIGTERM); set by opencode-acp backend. 0 otherwise.
}

Session represents an active ACP session.

type StartOptions

type StartOptions struct {
	Agent     string
	Label     string
	Dir       string
	ServerURL string
	Model     string
	RuntimeID string         // supervisor-assigned runtime ID (rt_N), for parent-child routing
	Broker    *broker.Broker // optional shared broker instance; backends may create their own if nil
}

StartOptions holds options for starting a new session.

func MergeStartOptions added in v0.16.0

func MergeStartOptions(base, override StartOptions) StartOptions

MergeStartOptions returns a new StartOptions with non-zero fields from override applied over base. Use this to combine provider-scoped defaults with per-start overrides.

Directories

Path Synopsis
Package broker provides a harness-agnostic run broker for agent communication.
Package broker provides a harness-agnostic run broker for agent communication.
Package claude implements a channel-less runtime.Provider for Claude Code.
Package claude implements a channel-less runtime.Provider for Claude Code.
Package claudechannel implements a runtime.Provider for Claude Code via channels + tmux.
Package claudechannel implements a runtime.Provider for Claude Code via channels + tmux.
terminal
Package terminal provides an abstraction for interactive terminal sessions.
Package terminal provides an abstraction for interactive terminal sessions.
Package factory constructs runtime.Provider instances by backend name.
Package factory constructs runtime.Provider instances by backend name.
Package opencodehttp implements a runtime.Provider that communicates with opencode serve over its HTTP API (SSE event stream + REST endpoints).
Package opencodehttp implements a runtime.Provider that communicates with opencode serve over its HTTP API (SSE event stream + REST endpoints).

Jump to

Keyboard shortcuts

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