http

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package http exposes HTTP endpoints for async execution requests and health checks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecuteHandler

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

ExecuteHandler handles execution requests from yaml-mcp-server.

func NewExecuteHandler

func NewExecuteHandler(svc *telegram.Service, cfg config.Config, log *slog.Logger) *ExecuteHandler

NewExecuteHandler creates a new execution handler.

func (*ExecuteHandler) ServeHTTP

func (h *ExecuteHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP handles /execute requests.

type ExecuteRequest

type ExecuteRequest struct {
	CorrelationID string               `json:"correlation_id"`
	Tool          executions.Tool      `json:"tool"`
	Arguments     map[string]any       `json:"arguments"`
	Spec          map[string]any       `json:"spec,omitempty"`
	Lang          string               `json:"lang,omitempty"`
	Markup        string               `json:"markup,omitempty"`
	Callback      *executions.Callback `json:"callback,omitempty"`
	TimeoutSec    int                  `json:"timeout_sec,omitempty"`
}

ExecuteRequest defines input payload for /execute.

type ExecuteResponse

type ExecuteResponse struct {
	Status        string `json:"status"`
	Result        any    `json:"result,omitempty"`
	CorrelationID string `json:"correlation_id,omitempty"`
}

ExecuteResponse defines output payload for /execute.

type Server

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

Server wraps HTTP server with readiness checks.

func New

func New(addr string, log *slog.Logger) *Server

New creates a new HTTP server.

func (*Server) Handle

func (s *Server) Handle(pattern string, handler http.Handler)

Handle registers a handler.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe starts the HTTP server.

func (*Server) SetReady

func (s *Server) SetReady(ready bool)

SetReady updates readiness state.

func (*Server) Shutdown

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

Shutdown gracefully stops the HTTP server.

Jump to

Keyboard shortcuts

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