Documentation
¶
Index ¶
- Constants
- Variables
- type Provider
- func (p *Provider) AnswerPermission(ctx context.Context, sessionID string, requestID string, ...) error
- func (p *Provider) Cancel(ctx context.Context, sessionID string) error
- func (p *Provider) Capabilities(ctx context.Context) (runtime.Capabilities, error)
- func (p *Provider) Close() error
- func (p *Provider) Events(ctx context.Context, sessionID string) (<-chan events.Event, error)
- func (p *Provider) Prompt(ctx context.Context, sessionID string, prompt string) error
- func (p *Provider) Resume(ctx context.Context, sessionID string) (runtime.Session, error)
- func (p *Provider) Start(ctx context.Context, opts runtime.StartOptions) (runtime.Session, error)
Constants ¶
const BackendID = "agy"
BackendID is the canonical backend identifier.
Variables ¶
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 ¶
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 ¶
Capabilities returns the capabilities of the agy backend.
func (*Provider) Events ¶
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 ¶
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 ¶
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.