acp

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Overview

Package acp exposes the Coding Runtime through Agent Client Protocol v1.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalid means ACP input is malformed or unsupported.
	ErrInvalid = errors.New("coding acp: invalid input")
	// ErrSessionNotFound means no active ACP session owns the supplied ID.
	ErrSessionNotFound = errors.New("coding acp: session not found")
	// ErrSessionBusy means a prompt is already active for the session.
	ErrSessionBusy = errors.New("coding acp: session busy")
	// ErrClosed means the ACP server or session has been closed.
	ErrClosed = errors.New("coding acp: closed")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Factory   SessionFactory
	AgentInfo Implementation
	Limits    Limits
	Logger    *slog.Logger
}

Config supplies process-level ACP dependencies.

type Controller

Controller is the narrow Runtime surface consumed by ACP sessions.

type Implementation

type Implementation struct {
	Name    string
	Title   string
	Version string
}

Implementation is the protocol-neutral identity advertised by the ACP adapter. The SDK representation stays private to this package.

type Limits

type Limits struct {
	MaxSessions     int
	MaxMCPServers   int
	MaxPromptBlocks int
	MaxPromptBytes  int
	MaxBinaryBytes  int
	ListPageSize    int
}

Limits bound one ACP process and its untrusted protocol input.

func DefaultLimits

func DefaultLimits() Limits

DefaultLimits returns conservative process and request bounds.

type Server

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

Server owns one ACP connection and its active Runtime sessions.

func New

func New(config Config) (*Server, error)

New returns an idle ACP v1 server.

func (*Server) Close

func (s *Server) Close(ctx context.Context) error

Close cancels and closes every active Runtime once.

func (*Server) Serve

func (s *Server) Serve(ctx context.Context, input io.Reader, output io.Writer) error

Serve starts line-delimited JSON-RPC over the supplied streams and blocks until the peer disconnects or ctx is cancelled. Stdout must be passed as output without sharing it with application logs.

type SessionFactory

type SessionFactory interface {
	Open(context.Context, SessionSpec) (Controller, error)
	List(context.Context) ([]SessionMetadata, error)
	Delete(context.Context, string) error
}

SessionFactory owns Runtime construction and durable metadata discovery.

type SessionMetadata

type SessionMetadata struct {
	ID        string
	CWD       string
	Title     string
	UpdatedAt time.Time
}

SessionMetadata is the durable subset returned by session/list.

type SessionSpec

type SessionSpec struct {
	ID             string
	CWD            string
	MCPDefinitions mcp.Definitions
}

SessionSpec identifies one Runtime to create or reopen.

Jump to

Keyboard shortcuts

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