agy

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const BackendID = "agy"

BackendID is the canonical backend identifier.

Variables

View Source
var (
	ErrStartupTimeout       = errors.New("agy: startup timeout — no init event within 10s")
	ErrConversationMismatch = errors.New("agy: conversation_id mismatch")
	ErrLineTooLong          = errors.New("agy: JSONL line exceeds 50 MiB")
	ErrProcessDied          = errors.New("agy: process exited before result")
	ErrClientClosed         = errors.New("agy: client is closed")
)

Functions

This section is empty.

Types

type Provider

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

Provider implements the runtime.Provider interface for agy-based sessions.

func NewWithOptions

func NewWithOptions(opts runtime.StartOptions) *Provider

NewWithOptions creates a new Provider with the given start options.

func (*Provider) AnswerPermission

func (p *Provider) AnswerPermission(ctx context.Context, sessionID string, requestID string, response runtime.PermissionResponse) error

AnswerPermission delegates only to a session selected for RPC. Headless keeps its Phase 1 unsupported error.

func (*Provider) Cancel

func (p *Provider) Cancel(ctx context.Context, sessionID string) error

Cancel interrupts the active process for the given session and emits a cancelled session.end event. Cancel is idempotent per session — subsequent calls are no-ops.

func (*Provider) Capabilities

func (p *Provider) Capabilities(ctx context.Context) (runtime.Capabilities, error)

Capabilities returns the capabilities of the agy backend.

func (*Provider) Close

func (p *Provider) Close() error

Close shuts down the provider and all sessions. Idempotent.

func (*Provider) Events

func (p *Provider) Events(ctx context.Context, sessionID string) (<-chan events.Event, error)

Events subscribes to events for a session. The returned channel receives all events produced during Prompt calls (including session.start on first turn and session.end at completion).

The channel is buffered to 128. When the provided context is cancelled, the subscriber is removed and the channel is closed.

func (*Provider) Prompt

func (p *Provider) Prompt(ctx context.Context, sessionID string, prompt string) error

Prompt executes a turn on the given session.

First turn from Start: publishes the cached session.start, writes the prompt to the pending process's stdin, closes stdin, then relays all parsed events to subscribers until a terminal session.end.

Resumed first turn (Resume + Prompt): creates a new agy process with --conversation <id> --print <prompt>, validates the init, then relays all events to subscribers without emitting a duplicate session.start.

Subsequent turns: same as resumed first turn (creates a new process).

Prompt blocks until a terminal session.end arrives, process failure, context cancellation, or explicit Cancel. Exactly one session.end is emitted per turn.

func (*Provider) Resume

func (p *Provider) Resume(ctx context.Context, sessionID string) (runtime.Session, error)

Resume registers a logical session with no active process. The next Prompt will start a resumed agy process. Resume sets firstTurn=true but client=nil so that Prompt uses the resumed command construction path rather than the "write to pending process stdin" path.

func (*Provider) Start

Start selects a transport before registration. Headless keeps its resource-free provisional identity; RPC registers the host's already validated external conversation identity directly.

Directories

Path Synopsis
interop

Jump to

Keyboard shortcuts

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