server

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Package server exposes Peen's client-facing Serbewr 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
	ListenAddress  string
	Metrics        *metrics.Metrics
	ServiceContext func() context.Context
}

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

type Server

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

Server owns Peen's Serbewr listener and its generated OpenAPI handler.

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) Serve

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

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

func (*Server) SignalSessionJob

SignalSessionJob stops one running job.

func (*Server) Stop added in v0.2.0

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

Stop shuts down Serbewr. It is safe to call after Serve has already stopped because Serbewr's shutdown is idempotent.

Jump to

Keyboard shortcuts

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