Help us shape the future of Go! Take the 2026 Go Developer Survey

agentctl

package
v1.29.2 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventUser       = "user"
	EventText       = "text"
	EventThinking   = "thinking"
	EventTool       = "tool"
	EventToolResult = "tool-result"
	EventRun        = "run"
	EventNotice     = "notice"
	EventError      = "error"
	EventEnd        = "end"
	EventDelivered  = "delivered"
)
View Source
const (
	EndStop    = "stop"
	EndAborted = "aborted"
	EndError   = "error"
)
View Source
const (
	Cap  = "agent"
	Kind = "agent"

	MaxPrompt    = 16 << 20
	InlinePrompt = 60 << 10
)

Variables

View Source
var (
	ErrNotAllowed = errors.New("this seven doesn't allow remote control from this device")
	ErrBusy       = errors.New("seven is busy")
	ErrTooLong    = fmt.Errorf("the prompt is longer than %d MiB", MaxPrompt>>20)
	ErrEmpty      = errors.New("the prompt is empty")
	ErrNotUTF8    = errors.New("the prompt is not UTF-8 text")
)

Functions

func Abort

func Abort(ctx context.Context, l *link.Link) (bool, error)

func Allowed

func Allowed(l *link.Link) bool

func CheckPrompt

func CheckPrompt(text string) error

func Clean

func Clean(s string) string

func OneLine

func OneLine(s string) string

func OneLineFull

func OneLineFull(s string) string

Types

type Event

type Event struct {
	T         string `json:"t"`
	ID        string `json:"id,omitempty"`
	Text      string `json:"text,omitempty"`
	Delta     string `json:"delta,omitempty"`
	Delivered string `json:"delivered,omitempty"`
	Call      string `json:"call,omitempty"`
	Name      string `json:"name,omitempty"`
	Summary   string `json:"summary,omitempty"`
	OK        *bool  `json:"ok,omitempty"`
	State     string `json:"state,omitempty"`
	Reason    string `json:"reason,omitempty"`
	Message   string `json:"message,omitempty"`
	Detail    string `json:"detail,omitempty"`

	Line []byte `json:"-"`
}

type PromptOptions

type PromptOptions struct {
	Text     string
	WhenBusy WhenBusy
	Thinking bool
}

type RenderOptions

type RenderOptions struct {
	Out      io.Writer
	Err      io.Writer
	OutStyle Style
	ErrStyle Style
	Thinking bool
	Users    bool
	Runs     bool
}

type Renderer

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

func NewRenderer

func NewRenderer(opts RenderOptions) *Renderer

func (*Renderer) Error

func (r *Renderer) Error(format string, args ...any)

func (*Renderer) Finish

func (r *Renderer) Finish()

func (*Renderer) Notice

func (r *Renderer) Notice(format string, args ...any)

func (*Renderer) Render

func (r *Renderer) Render(e Event)

func (*Renderer) Status

func (r *Renderer) Status(format string, args ...any)

type Stream

type Stream struct {
	Delivered string
	Head      string
	Gap       bool
	// contains filtered or unexported fields
}

func Prompt

func Prompt(ctx context.Context, l *link.Link, opts PromptOptions) (*Stream, error)

func Watch

func Watch(ctx context.Context, l *link.Link, opts WatchOptions) (*Stream, error)

func (*Stream) Close

func (st *Stream) Close() error

func (*Stream) Done

func (st *Stream) Done() <-chan struct{}

func (*Stream) Next

func (st *Stream) Next() (Event, error)

type Style

type Style struct {
	TTY   bool
	Color bool
}

type Tracker

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

func NewTracker

func NewTracker() *Tracker

func (*Tracker) Filter

func (t *Tracker) Filter(e Event) (Event, bool)

func (*Tracker) Reconnected

func (t *Tracker) Reconnected()

func (*Tracker) Since

func (t *Tracker) Since() string

type WatchOptions

type WatchOptions struct {
	Since    string
	Thinking bool
}

type WhenBusy

type WhenBusy string
const (
	FollowUp WhenBusy = "followUp"
	Steer    WhenBusy = "steer"
	Reject   WhenBusy = "reject"
)

Jump to

Keyboard shortcuts

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