server

package
v0.0.0-...-eaa2a7e Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddToManager

func AddToManager(mgr manager.Manager, port string) error

AddToManager adds the API server to a controller manager

Types

type APIServer

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

APIServer represents the REST API server

func NewAPIServer

func NewAPIServer(client client.Client, port string) *APIServer

NewAPIServer creates a new API server

func (*APIServer) Router

func (s *APIServer) Router() *gin.Engine

Router returns the gin router for testing

func (*APIServer) Start

func (s *APIServer) Start(ctx context.Context) error

Start begins listening for requests in a goroutine

func (*APIServer) Stop

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

Stop gracefully shuts down the server

type AgentResponse

type AgentResponse struct {
	Namespace    string                     `json:"namespace"`
	Name         string                     `json:"name"`
	LLM          string                     `json:"llm"`
	SystemPrompt string                     `json:"systemPrompt"`
	MCPServers   map[string]MCPServerConfig `json:"mcpServers,omitempty"`
	Status       string                     `json:"status,omitempty"`       // e.g., "Ready", "Error", "Pending"
	StatusDetail string                     `json:"statusDetail,omitempty"` // Additional status details
	Ready        bool                       `json:"ready,omitempty"`        // Indicates if agent is ready
}

AgentResponse defines the structure of the response body for agent endpoints

type ChannelTokenRef

type ChannelTokenRef struct {
	Name string `json:"name"` // Name of the secret
	Key  string `json:"key"`  // Key in the secret data
}

ChannelTokenRef defines a reference to a secret containing the channel token

type CreateAgentRequest

type CreateAgentRequest struct {
	Namespace    string                     `json:"namespace,omitempty"`  // Optional, defaults to "default"
	Name         string                     `json:"name"`                 // Required
	LLM          LLMDefinition              `json:"llm"`                  // Required
	SystemPrompt string                     `json:"systemPrompt"`         // Required
	MCPServers   map[string]MCPServerConfig `json:"mcpServers,omitempty"` // Optional
}

CreateAgentRequest defines the structure of the request body for creating an agent

type CreateTaskRequest

type CreateTaskRequest struct {
	Namespace     string        `json:"namespace,omitempty"`     // Optional, defaults to "default"
	AgentName     string        `json:"agentName"`               // Required
	UserMessage   string        `json:"userMessage,omitempty"`   // Optional if contextWindow is provided
	ContextWindow []acp.Message `json:"contextWindow,omitempty"` // Optional if userMessage is provided
	BaseURL       string        `json:"baseURL,omitempty"`       // Optional, base URL for the contact channel
	ChannelToken  string        `json:"channelToken,omitempty"`  // Optional, token for the contact channel API
}

CreateTaskRequest defines the structure of the request body for creating a task

type LLMDefinition

type LLMDefinition struct {
	Name     string `json:"name"`
	Provider string `json:"provider"`
	Model    string `json:"model"`
	APIKey   string `json:"apiKey"`
}

LLMDefinition defines the structure for the LLM definition in the agent request

type MCPServerConfig

type MCPServerConfig struct {
	Transport    string            `json:"transport"`              // Required: "stdio" or "http"
	Command      string            `json:"command,omitempty"`      // Required for stdio transport
	Args         []string          `json:"args,omitempty"`         // Required for stdio transport
	URL          string            `json:"url,omitempty"`          // Required for http transport
	Env          map[string]string `json:"env,omitempty"`          // Optional environment variables
	Secrets      map[string]string `json:"secrets,omitempty"`      // Optional secrets
	Status       string            `json:"status,omitempty"`       // e.g., "Ready", "Error", "Pending"
	StatusDetail string            `json:"statusDetail,omitempty"` // Additional status details
	Ready        bool              `json:"ready,omitempty"`        // Indicates if MCP server is ready/connected
}

MCPServerConfig defines the configuration for an MCP server

type RunnableServer

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

func NewRunnableServer

func NewRunnableServer(client client.Client, port string) *RunnableServer

NewRunnableServer creates a new server that can be added to the controller manager

func (*RunnableServer) NeedLeaderElection

func (r *RunnableServer) NeedLeaderElection() bool

NeedLeaderElection implements the LeaderElectionRunnable interface

func (*RunnableServer) Start

func (r *RunnableServer) Start(ctx context.Context) error

Start starts the API server and implements the manager.Runnable interface

type UpdateAgentRequest

type UpdateAgentRequest struct {
	LLM          string                     `json:"llm"`                  // Required
	SystemPrompt string                     `json:"systemPrompt"`         // Required
	MCPServers   map[string]MCPServerConfig `json:"mcpServers,omitempty"` // Optional
}

UpdateAgentRequest defines the structure of the request body for updating an agent

type V1Beta3ConversationCreated

type V1Beta3ConversationCreated struct {
	IsTest        bool   `json:"is_test"`
	Type          string `json:"type"`
	ChannelAPIKey string `json:"channel_api_key"`
	Event         struct {
		UserMessage      string `json:"user_message"`
		ContactChannelID int    `json:"contact_channel_id"`
		AgentName        string `json:"agent_name"`
		ThreadID         string `json:"thread_id,omitempty"` // Optional thread ID for conversation continuity
	} `json:"event"`
}

V1Beta3ConversationCreated defines the structure for V1Beta3 conversation events

Jump to

Keyboard shortcuts

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