server

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Package server exposes Peen's client-facing Echo HTTP API.

Index

Constants

View Source
const (
	// ErrorCodeInvalidSessionID reports a malformed X-Session-ID header.
	ErrorCodeInvalidSessionID aichteeteapee.ErrorCode = "INVALID_SESSION_ID"
	// ErrorCodeSessionNotFound reports a well-formed but unknown session ID.
	ErrorCodeSessionNotFound aichteeteapee.ErrorCode = "SESSION_NOT_FOUND"
	// ErrorCodeSessionBusy reports a session with an already active turn.
	ErrorCodeSessionBusy aichteeteapee.ErrorCode = "SESSION_BUSY"
	// ErrorCodeTurnCancelled reports a turn that ended because its session
	// was explicitly cancelled.
	ErrorCodeTurnCancelled aichteeteapee.ErrorCode = "TURN_CANCELLED"
	// ErrorCodeUserMessageQueueFull reports an active turn that cannot accept
	// another queued user message.
	ErrorCodeUserMessageQueueFull = aichteeteapee.ErrorCode(
		"USER_MESSAGE_QUEUE_FULL",
	)
)

Peen's documented contract distinguishes four session-scoped failures that aichteeteapee's generic codes would otherwise collapse into NOT_FOUND, CONFLICT, and BAD_REQUEST. aichteeteapee.ErrorCode is a plain string alias, so Peen defines its own values on it rather than rolling a separate error envelope.

Variables

View Source
var ErrMissingDependency = errors.New("HTTP server dependency is required")

ErrMissingDependency reports an incomplete HTTP server constructor input.

Functions

This section is empty.

Types

type Dependencies

type Dependencies struct {
	Runtime  agent.API
	APIToken string
	Metrics  *metrics.Metrics
}

Dependencies are the transport-neutral operations required by the API.

type Server

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

Server owns Peen's Echo router and HTTP lifecycle.

func New

func New(deps Dependencies) (*Server, error)

New constructs a fully-wired HTTP server without opening a listener.

func (*Server) CancelSession

CancelSession asks an active agent turn to stop without deleting its session.

func (*Server) CancelSessionAgentRun

CancelSessionAgentRun stops one child agent without ending its parent turn.

func (*Server) GetSession

GetSession returns durable metadata and active-turn state for one session.

func (*Server) ListMessages

ListMessages returns one stable bounded durable transcript page.

func (*Server) ListSessionAgentRunEvents

ListSessionAgentRunEvents follows what one child agent is doing.

func (*Server) ListSessionAgentRuns

ListSessionAgentRuns reports the child agents this session has launched.

func (*Server) ListSessionEvents

ListSessionEvents reports what is waiting without consuming it.

func (*Server) ListSessionJobs

ListSessionJobs reports the commands this session has started.

func (*Server) PublishSessionEvent

PublishSessionEvent records an outside report against a session.

func (*Server) ReadSessionJobOutput

ReadSessionJobOutput returns a bounded window of one job's output.

func (*Server) SendMessage

SendMessage runs one durable agent turn as JSON or an SSE stream.

func (*Server) Serve

func (s *Server) Serve(ctx context.Context, address string) error

Serve listens until the service context is cancelled or the listener fails.

func (*Server) ServeListener

func (s *Server) ServeListener(
	ctx context.Context,
	listener net.Listener,
) error

ServeListener serves a caller-owned listener until its context ends.

func (*Server) SignalSessionJob

SignalSessionJob stops one running job.

Jump to

Keyboard shortcuts

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