agentinstance

package
v1.0.0-rc.11 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	StateStarting = "starting"
	StateRunning  = "running"
	StateStopped  = "stopped"
	StateError    = "error"
	StateWarning  = "warning"
)
View Source
const (
	ChainACPSubcommand = "acp"
	ChainPathEnvVar    = "CONTENOX_ACP_CHAIN_PATH"
)
View Source
const AgentModeConfigOptionID = "contenox.agent-mode"
View Source
const AgentModelConfigOptionID = "contenox.agent-model"

Variables

View Source
var ErrNotFound = errors.New("agentinstance: instance not found")

Functions

This section is empty.

Types

type Event

type Event struct {
	Kind       EventKind        `json:"kind"`
	InstanceID string           `json:"instanceId"`
	AgentID    string           `json:"agentId"`
	AgentName  string           `json:"agentName"`
	State      string           `json:"state,omitempty"`
	SessionID  libacp.SessionID `json:"sessionId,omitempty"`
	ViewerID   string           `json:"viewerId,omitempty"`
	Controller bool             `json:"controller,omitempty"`
	Time       time.Time        `json:"time"`
}

type EventKind

type EventKind string
const (
	EventStateChange      EventKind = "state_change"
	EventAttach           EventKind = "attach"
	EventDetach           EventKind = "detach"
	EventUnsupervisedDeny EventKind = "unsupervised_permission"
)

type EventSink

type EventSink func(Event)

type FleetEntry

type FleetEntry struct {
	AgentID   string           `json:"agentId"`
	AgentName string           `json:"agentName"`
	Kind      string           `json:"kind"`
	Instances []InstanceStatus `json:"instances"`
}

func (FleetEntry) Running

func (e FleetEntry) Running() bool

type InstanceStatus

type InstanceStatus struct {
	ID         string    `json:"id"`
	AgentID    string    `json:"agentId"`
	AgentName  string    `json:"agentName"`
	Kind       string    `json:"kind"`
	State      string    `json:"state"`
	Sessions   int       `json:"sessions"`
	Viewers    int       `json:"viewers"`
	StartedAt  time.Time `json:"startedAt"`
	SessionIDs []string  `json:"sessionIds"`
}

type Manager

type Manager interface {
	Start(ctx context.Context, agentName, cwd string) (instanceID string, err error)

	StartResolved(ctx context.Context, agent *runtimetypes.Agent, cwd string) (instanceID string, err error)

	Attach(ctx context.Context, instanceID string, sessionID libacp.SessionID, viewer Viewer) (controllerGranted bool, err error)

	Detach(instanceID string, sessionID libacp.SessionID, viewerID string) error

	List(ctx context.Context) ([]FleetEntry, error)

	Get(instanceID string) (InstanceStatus, error)

	OpenSession(ctx context.Context, instanceID string, spec SessionSpec) (libacp.SessionID, error)

	Prompt(ctx context.Context, instanceID string, sessionID libacp.SessionID, prompt []libacp.ContentBlock) (libacp.StopReason, error)

	DeliverToSession(ctx context.Context, sessionID libacp.SessionID, n libacp.SessionNotification) error

	Cancel(instanceID string, sessionID libacp.SessionID) error

	CloseSession(instanceID string, sessionID libacp.SessionID) error

	SetConfigOption(ctx context.Context, instanceID string, sessionID libacp.SessionID, configID string, value libacp.SessionConfigOptionValue) error

	SessionConfigOptions(instanceID string, sessionID libacp.SessionID) ([]libacp.SessionConfigOption, error)

	AvailableCommands(instanceID string, sessionID libacp.SessionID) ([]libacp.AvailableCommand, error)

	Stop(instanceID string) error

	Close() error
}

func New

func New(agents agentregistryservice.Service, opts ...Option) Manager

type Option

type Option func(*manager)

func WithChainArgs

func WithChainArgs(args ...string) Option

func WithEventSink

func WithEventSink(sink EventSink) Option

func WithJournalSize

func WithJournalSize(n int) Option

func WithKillGrace

func WithKillGrace(d time.Duration) Option

func WithPermissionFallback

func WithPermissionFallback(fn PermissionFallback) Option

func WithRestart

func WithRestart(limit int) Option

func WithSelfExecutable

func WithSelfExecutable(path string) Option

func WithStderr

func WithStderr(w io.Writer) Option

type SessionSpec

type SessionSpec struct {
	Cwd string

	AdditionalDirectories []string

	McpServers []libacp.McpServer

	Meta json.RawMessage

	Terminal bool
}

type UnattendedPermission

type UnattendedPermission struct {
	InstanceID string
	AgentID    string
	AgentName  string
	SessionID  libacp.SessionID
	Request    libacp.RequestPermissionRequest
}

type Viewer

type Viewer interface {
	ID() string

	Deliver(ctx context.Context, n libacp.SessionNotification) error

	RequestPermission(ctx context.Context, req libacp.RequestPermissionRequest) (libacp.RequestPermissionResponse, error)
}

Jump to

Keyboard shortcuts

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