Documentation
¶
Overview ¶
Package server exposes Peen's client-facing Serbewr HTTP API.
Index ¶
- Constants
- Variables
- type Dependencies
- type Server
- func (s *Server) CancelSession(ctx context.Context, request api.CancelSessionRequestObject) (api.CancelSessionResponseObject, error)
- func (s *Server) CancelSessionAgentRun(ctx context.Context, request api.CancelSessionAgentRunRequestObject) (api.CancelSessionAgentRunResponseObject, error)
- func (s *Server) GetSession(ctx context.Context, request api.GetSessionRequestObject) (api.GetSessionResponseObject, error)
- func (s *Server) ListMessages(ctx context.Context, request api.ListMessagesRequestObject) (api.ListMessagesResponseObject, error)
- func (s *Server) ListSessionAgentRunEvents(ctx context.Context, request api.ListSessionAgentRunEventsRequestObject) (api.ListSessionAgentRunEventsResponseObject, error)
- func (s *Server) ListSessionAgentRuns(ctx context.Context, request api.ListSessionAgentRunsRequestObject) (api.ListSessionAgentRunsResponseObject, error)
- func (s *Server) ListSessionEvents(ctx context.Context, request api.ListSessionEventsRequestObject) (api.ListSessionEventsResponseObject, error)
- func (s *Server) ListSessionJobs(ctx context.Context, request api.ListSessionJobsRequestObject) (api.ListSessionJobsResponseObject, error)
- func (s *Server) PublishSessionEvent(ctx context.Context, request api.PublishSessionEventRequestObject) (api.PublishSessionEventResponseObject, error)
- func (s *Server) ReadSessionJobOutput(ctx context.Context, request api.ReadSessionJobOutputRequestObject) (api.ReadSessionJobOutputResponseObject, error)
- func (s *Server) SendMessage(ctx context.Context, request api.SendMessageRequestObject) (api.SendMessageResponseObject, error)
- func (s *Server) Serve(ctx context.Context) error
- func (s *Server) SignalSessionJob(ctx context.Context, request api.SignalSessionJobRequestObject) (api.SignalSessionJobResponseObject, error)
- func (s *Server) Stop(ctx context.Context) error
Constants ¶
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 ¶
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 ¶
func (s *Server) CancelSession( ctx context.Context, request api.CancelSessionRequestObject, ) (api.CancelSessionResponseObject, error)
CancelSession asks an active agent turn to stop without deleting its session.
func (*Server) CancelSessionAgentRun ¶
func (s *Server) CancelSessionAgentRun( ctx context.Context, request api.CancelSessionAgentRunRequestObject, ) (api.CancelSessionAgentRunResponseObject, error)
CancelSessionAgentRun stops one child agent without ending its parent turn.
func (*Server) GetSession ¶
func (s *Server) GetSession( ctx context.Context, request api.GetSessionRequestObject, ) (api.GetSessionResponseObject, error)
GetSession returns durable metadata and active-turn state for one session.
func (*Server) ListMessages ¶
func (s *Server) ListMessages( ctx context.Context, request api.ListMessagesRequestObject, ) (api.ListMessagesResponseObject, error)
ListMessages returns one stable bounded durable transcript page.
func (*Server) ListSessionAgentRunEvents ¶
func (s *Server) ListSessionAgentRunEvents( ctx context.Context, request api.ListSessionAgentRunEventsRequestObject, ) (api.ListSessionAgentRunEventsResponseObject, error)
ListSessionAgentRunEvents follows what one child agent is doing.
func (*Server) ListSessionAgentRuns ¶
func (s *Server) ListSessionAgentRuns( ctx context.Context, request api.ListSessionAgentRunsRequestObject, ) (api.ListSessionAgentRunsResponseObject, error)
ListSessionAgentRuns reports the child agents this session has launched.
func (*Server) ListSessionEvents ¶
func (s *Server) ListSessionEvents( ctx context.Context, request api.ListSessionEventsRequestObject, ) (api.ListSessionEventsResponseObject, error)
ListSessionEvents reports what is waiting without consuming it.
func (*Server) ListSessionJobs ¶
func (s *Server) ListSessionJobs( ctx context.Context, request api.ListSessionJobsRequestObject, ) (api.ListSessionJobsResponseObject, error)
ListSessionJobs reports the commands this session has started.
func (*Server) PublishSessionEvent ¶
func (s *Server) PublishSessionEvent( ctx context.Context, request api.PublishSessionEventRequestObject, ) (api.PublishSessionEventResponseObject, error)
PublishSessionEvent records an outside report against a session.
func (*Server) ReadSessionJobOutput ¶
func (s *Server) ReadSessionJobOutput( ctx context.Context, request api.ReadSessionJobOutputRequestObject, ) (api.ReadSessionJobOutputResponseObject, error)
ReadSessionJobOutput returns a bounded window of one job's output.
func (*Server) SendMessage ¶
func (s *Server) SendMessage( ctx context.Context, request api.SendMessageRequestObject, ) (api.SendMessageResponseObject, error)
SendMessage runs one durable agent turn as JSON or an SSE stream.
func (*Server) SignalSessionJob ¶
func (s *Server) SignalSessionJob( ctx context.Context, request api.SignalSessionJobRequestObject, ) (api.SignalSessionJobResponseObject, error)
SignalSessionJob stops one running job.