agentsend

package
v0.0.54 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cancel

func Cancel(home string, sess Session, msgID string) error

Cancel removes a pending message from the queue.

func Enqueue

func Enqueue(home string, sess Session, text string) (string, error)

Enqueue appends a message to the session queue under flock and returns its id.

func MessageStatus

func MessageStatus(home string, sess Session, msgID string) (string, error)

MessageStatus reports whether a session-local message is still queued. Returns "pending" when the message is in the queue, "delivered" when the id was assigned but is no longer queued (delivered, cancelled, or timed out).

func SendToAgentSession added in v0.0.51

func SendToAgentSession(store agentstorage.Store, runner, agentSessionID, message string, waitOpts WaitOptions) (msgID string, err error)

SendToAgentSession resolves an agent session to a live TTY, enqueues a message, optionally starts the drainer, and waits per waitOpts.

func StartDrainer

func StartDrainer(home string, sess Session, provider agenttty.Provider)

StartDrainer launches a background loop that elects a drainer via flock and delivers pending messages FIFO when the terminal becomes writable.

func WaitForDelivery

func WaitForDelivery(home string, sess Session, msgID string, opts WaitOptions) error

WaitForDelivery polls until msgID is absent from the queue or a max-wait deadline expires.

Types

type Entry

type Entry struct {
	ID                string    `json:"id"`
	Text              string    `json:"text"`
	TerminalSessionID string    `json:"terminal_session_id"`
	Runner            string    `json:"runner"`
	EnqueuedAt        time.Time `json:"enqueued_at"`
}

Entry is one pending send-queue message.

type Session

type Session struct {
	Home              string
	Runner            string
	TerminalSessionID string
	ListenAddr        string
}

Session identifies a live terminal send queue.

type WaitMode

type WaitMode int

WaitMode controls how long the caller blocks after enqueue.

const (
	WaitDefault WaitMode = iota
	WaitNoWait
	WaitMaxWait
)

type WaitOptions

type WaitOptions struct {
	Mode         WaitMode
	MaxWait      time.Duration
	EnqueuedAt   time.Time
	StartDrainer bool
}

WaitOptions configures post-enqueue behavior.

Jump to

Keyboard shortcuts

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