http

package
v0.7.17 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package http provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.1 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

func NewHandler

func NewHandler(engine Engine) http.Handler

NewHandler creates a new HTTP handler for the engine.

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

Types

type ActionRequest

type ActionRequest struct {
	// Payload Dynamic payload depending on the action type.
	Payload interface{} `json:"payload"`

	// Type The type of action (e.g., RENDER_CONTENT, REQUEST_INPUT).
	Type string `json:"type"`
}

ActionRequest defines model for ActionRequest.

type ChiServerOptions

type ChiServerOptions struct {
	BaseURL          string
	BaseRouter       chi.Router
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type Engine

type Engine interface {
	ports.StatelessEngine
	Watch(ctx context.Context) (<-chan string, error)
}

Engine defines the interface for the Trellis state machine core.

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler
type NavigateJSONRequestBody = NavigateRequest

NavigateJSONRequestBody defines body for Navigate for application/json ContentType.

type NavigateRequest struct {
	// Input The user input or tool result.
	Input *NavigateRequest_Input `json:"input,omitempty"`
	State State                  `json:"state"`
}

NavigateRequest defines model for NavigateRequest.

type NavigateRequestInput0 = string

NavigateRequestInput0 defines model for .

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

NavigateRequest_Input The user input or tool result.

func (t NavigateRequest_Input) AsNavigateRequestInput0() (NavigateRequestInput0, error)

AsNavigateRequestInput0 returns the union data inside the NavigateRequest_Input as a NavigateRequestInput0

func (t NavigateRequest_Input) AsToolResult() (ToolResult, error)

AsToolResult returns the union data inside the NavigateRequest_Input as a ToolResult

func (t *NavigateRequest_Input) FromNavigateRequestInput0(v NavigateRequestInput0) error

FromNavigateRequestInput0 overwrites any union data inside the NavigateRequest_Input as the provided NavigateRequestInput0

func (t *NavigateRequest_Input) FromToolResult(v ToolResult) error

FromToolResult overwrites any union data inside the NavigateRequest_Input as the provided ToolResult

func (t NavigateRequest_Input) MarshalJSON() ([]byte, error)
func (t *NavigateRequest_Input) MergeNavigateRequestInput0(v NavigateRequestInput0) error

MergeNavigateRequestInput0 performs a merge with any union data inside the NavigateRequest_Input, using the provided NavigateRequestInput0

func (t *NavigateRequest_Input) MergeToolResult(v ToolResult) error

MergeToolResult performs a merge with any union data inside the NavigateRequest_Input, using the provided ToolResult

func (t *NavigateRequest_Input) UnmarshalJSON(b []byte) error

type RenderJSONRequestBody

type RenderJSONRequestBody = State

RenderJSONRequestBody defines body for Render for application/json ContentType.

type RenderResponse

type RenderResponse struct {
	Actions *[]ActionRequest `json:"actions,omitempty"`
	State   *State           `json:"state,omitempty"`

	// Terminal True if the current node has no outgoing transitions.
	Terminal *bool `json:"terminal,omitempty"`
}

RenderResponse defines model for RenderResponse.

type RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type Server

type Server struct {
	Engine  Engine
	Streams *StreamManager
}

Server implements the generated ServerInterface

func (*Server) GetGraph

func (s *Server) GetGraph(w http.ResponseWriter, r *http.Request)

GetGraph handles the GET /graph request.

func (*Server) GetHealth

func (s *Server) GetHealth(w http.ResponseWriter, r *http.Request)

GetHealth handles the GET /health request.

func (*Server) GetInfo

func (s *Server) GetInfo(w http.ResponseWriter, r *http.Request)

GetInfo handles the GET /info request.

func (*Server) Navigate

func (s *Server) Navigate(w http.ResponseWriter, r *http.Request)

Navigate handles the POST /navigate request.

func (*Server) Render

func (s *Server) Render(w http.ResponseWriter, r *http.Request)

Render handles the POST /render request.

func (*Server) Signal

func (s *Server) Signal(w http.ResponseWriter, r *http.Request)

Signal handles the POST /signal request.

func (*Server) SubscribeEvents

func (s *Server) SubscribeEvents(w http.ResponseWriter, r *http.Request, params SubscribeEventsParams)

SubscribeEvents handles the GET /events request (SSE).

type ServerInterface

type ServerInterface interface {
	// Subscribe to server-sent events for graph changes
	// (GET /events)
	SubscribeEvents(w http.ResponseWriter, r *http.Request, params SubscribeEventsParams)
	// Introspect the full state machine graph
	// (GET /graph)
	GetGraph(w http.ResponseWriter, r *http.Request)
	// Liveness probe
	// (GET /health)
	GetHealth(w http.ResponseWriter, r *http.Request)
	// Server metadata and version information
	// (GET /info)
	GetInfo(w http.ResponseWriter, r *http.Request)
	// Transition to the next state based on input
	// (POST /navigate)
	Navigate(w http.ResponseWriter, r *http.Request)
	// Get the current view (actions) for a given state
	// (POST /render)
	Render(w http.ResponseWriter, r *http.Request)
	// Send a global signal to the state machine
	// (POST /signal)
	Signal(w http.ResponseWriter, r *http.Request)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) GetGraph

func (siw *ServerInterfaceWrapper) GetGraph(w http.ResponseWriter, r *http.Request)

GetGraph operation middleware

func (*ServerInterfaceWrapper) GetHealth

func (siw *ServerInterfaceWrapper) GetHealth(w http.ResponseWriter, r *http.Request)

GetHealth operation middleware

func (*ServerInterfaceWrapper) GetInfo

GetInfo operation middleware

func (*ServerInterfaceWrapper) Navigate

func (siw *ServerInterfaceWrapper) Navigate(w http.ResponseWriter, r *http.Request)

Navigate operation middleware

func (*ServerInterfaceWrapper) Render

Render operation middleware

func (*ServerInterfaceWrapper) Signal

Signal operation middleware

func (*ServerInterfaceWrapper) SubscribeEvents

func (siw *ServerInterfaceWrapper) SubscribeEvents(w http.ResponseWriter, r *http.Request)

SubscribeEvents operation middleware

type SignalJSONBody

type SignalJSONBody struct {
	// Signal The name of the signal (e.g., "interrupt", "timeout")
	Signal string `json:"signal"`
	State  State  `json:"state"`
}

SignalJSONBody defines parameters for Signal.

type SignalJSONRequestBody

type SignalJSONRequestBody SignalJSONBody

SignalJSONRequestBody defines body for Signal for application/json ContentType.

type State

type State struct {
	// Actions List of actions to be performed (e.g., render content).
	Actions *[]ActionRequest `json:"actions,omitempty"`

	// CurrentNodeId The identifier of the active node.
	CurrentNodeId string `json:"current_node_id"`

	// History Trace of visited nodes.
	History *[]string `json:"history,omitempty"`

	// Locale Preferred language for the session.
	Locale *string `json:"locale,omitempty"`

	// Memory Key-value store for session variables.
	Memory *map[string]interface{} `json:"memory,omitempty"`

	// PendingToolCall ID of a tool call being waited on.
	PendingToolCall *string `json:"pending_tool_call,omitempty"`
	SessionId       *string `json:"session_id,omitempty"`

	// Status Current lifecycle status of the State.
	Status *string `json:"status,omitempty"`

	// Terminated Indicates if the execution has reached a sink state.
	Terminated *bool `json:"terminated,omitempty"`
}

State defines model for State.

type StreamManager added in v0.7.9

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

StreamManager handles active SSE connections

func NewStreamManager added in v0.7.9

func NewStreamManager() *StreamManager

func (*StreamManager) Broadcast added in v0.7.9

func (sm *StreamManager) Broadcast(sessionID string, msg string)

func (*StreamManager) Subscribe added in v0.7.9

func (sm *StreamManager) Subscribe(sessionID string) (chan string, func())

type SubscribeEventsParams added in v0.7.9

type SubscribeEventsParams struct {
	// SessionId Session ID to subscribe to for state updates
	SessionId *string `form:"session_id,omitempty" json:"session_id,omitempty"`

	// Watch Comma-separated list of fields to watch (e.g. "context,history")
	Watch *string `form:"watch,omitempty" json:"watch,omitempty"`
}

SubscribeEventsParams defines parameters for SubscribeEvents.

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type ToolResult

type ToolResult struct {
	Error *string `json:"error,omitempty"`

	// Id Corresponds to the ToolCall ID.
	Id      string `json:"id"`
	IsError *bool  `json:"is_error,omitempty"`

	// Result The output of the tool execution.
	Result interface{} `json:"result"`
}

ToolResult defines model for ToolResult.

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type Unimplemented

type Unimplemented struct{}

func (Unimplemented) GetGraph

func (_ Unimplemented) GetGraph(w http.ResponseWriter, r *http.Request)

Introspect the full state machine graph (GET /graph)

func (Unimplemented) GetHealth

func (_ Unimplemented) GetHealth(w http.ResponseWriter, r *http.Request)

Liveness probe (GET /health)

func (Unimplemented) GetInfo

func (_ Unimplemented) GetInfo(w http.ResponseWriter, r *http.Request)

Server metadata and version information (GET /info)

func (Unimplemented) Navigate

func (_ Unimplemented) Navigate(w http.ResponseWriter, r *http.Request)

Transition to the next state based on input (POST /navigate)

func (Unimplemented) Render

func (_ Unimplemented) Render(w http.ResponseWriter, r *http.Request)

Get the current view (actions) for a given state (POST /render)

func (Unimplemented) Signal

func (_ Unimplemented) Signal(w http.ResponseWriter, r *http.Request)

Send a global signal to the state machine (POST /signal)

func (Unimplemented) SubscribeEvents

func (_ Unimplemented) SubscribeEvents(w http.ResponseWriter, r *http.Request, params SubscribeEventsParams)

Subscribe to server-sent events for graph changes (GET /events)

type UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap

func (e *UnmarshalingParamError) Unwrap() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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