agent

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2025 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServerTypeUnix = "unix"
	ServerTypeTCP  = "tcp"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// ServerType defines how the JSONRPC API is exposed: "unix" or "tcp".
	ServerType string

	// SocketPath for the JSONRPC server (used if ServerType is "unix")
	SocketPath string

	// ListenAddr is the address to listen on for connections (e.g., "localhost:8080" or "localhost:0" for dynamic port).
	// Used if ServerType is "websocket".
	ListenAddr string

	// LLM configuration
	Provider    string
	ModelID     string
	APIKey      string
	Endpoint    string
	Temperature float32
	MaxTokens   int

	// Persona configuration
	PersonaID string

	// Logging configuration
	LogLevel    string
	LogFilePath string

	// Tool configuration
	EnableTools        bool
	ToolApprovalPolicy string
	ConfigPath         string

	// Streaming configuration
	NoStream bool
}

Config contains configuration options for the agent server

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default configuration for the agent server

type ConnectRPCServer added in v0.1.0

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

ConnectRPCServer implements the ConnectRPC services for the agent.

func NewConnectRPCServer added in v0.1.0

func NewConnectRPCServer(opts ...ConnectServerOption) (*ConnectRPCServer, error)

NewConnectRPCServer creates a new ConnectRPC server.

func (*ConnectRPCServer) ConfigureAgent added in v0.1.0

--- AgentServiceHandler Implementations ---

func (*ConnectRPCServer) Converse added in v0.1.0

--- ChatServiceHandler Stubs ---

func (*ConnectRPCServer) GetAgentStatus added in v0.1.0

func (*ConnectRPCServer) GetConversation added in v0.1.0

func (*ConnectRPCServer) ListConversations added in v0.1.0

--- ChatServiceHandler Implementations (non-Converse) ---

func (*ConnectRPCServer) RemoveConversation added in v0.1.0

func (*ConnectRPCServer) Serve added in v0.1.0

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

Serve starts the ConnectRPC server and blocks until the context is canceled or an error occurs.

type ConnectRPCServerConfig added in v0.1.0

type ConnectRPCServerConfig struct {
	ListenAddress string
	Listener      net.Listener
	Logger        *slog.Logger

	LLMClient        *llm.Client
	PersonaRegistry  *persona.Registry
	MCPManager       mcp.Manager // Corrected: interface type
	ChatManager      *chat.Manager
	InitialPersonaID string

	// LLM Configuration to be stored by ConnectRPCServer
	LLMProviderName           string
	LLMModelID                string
	LLMAPIKey                 string
	LLMEndpoint               string
	LLMTemperature            float32
	LLMMaxTokens              int
	InitialLogLevel           string                    // Store the initial log level string
	InitialToolApprovalPolicy *ToolApprovalPolicyConfig // Added back
}

ConnectRPCServerConfig holds configuration for the ConnectRPC server.

type ConnectServerOption added in v0.1.0

type ConnectServerOption func(*ConnectRPCServerConfig) error

ConnectServerOption defines a functional option for configuring the ConnectRPCServer.

func WithConnectChatManager added in v0.1.0

func WithConnectChatManager(chatManager *chat.Manager) ConnectServerOption

WithConnectChatManager sets the ChatManager.

func WithConnectInitialLogLevel added in v0.1.0

func WithConnectInitialLogLevel(level string) ConnectServerOption

WithConnectInitialLogLevel sets the initial log level string.

func WithConnectInitialPersonaID added in v0.1.0

func WithConnectInitialPersonaID(personaID string) ConnectServerOption

WithConnectInitialPersonaID sets the initial persona ID for the server.

func WithConnectInitialToolApprovalPolicy added in v0.1.0

func WithConnectInitialToolApprovalPolicy(policy *ToolApprovalPolicyConfig) ConnectServerOption

WithConnectInitialToolApprovalPolicy sets the initial tool approval policy.

func WithConnectLLMClient added in v0.1.0

func WithConnectLLMClient(client *llm.Client) ConnectServerOption

WithConnectLLMClient sets the LLM client.

func WithConnectLLMConfig added in v0.1.0

func WithConnectLLMConfig(provider, model, apiKey, endpoint string, temp float32, maxTokens int) ConnectServerOption

WithConnectLLMConfig sets the initial LLM configuration parameters.

func WithConnectListenAddress added in v0.1.0

func WithConnectListenAddress(address string) ConnectServerOption

WithConnectListenAddress sets the listen address for the server.

func WithConnectListener added in v0.1.0

func WithConnectListener(listener net.Listener) ConnectServerOption

WithConnectListener sets a pre-configured listener for the server.

func WithConnectLogger added in v0.1.0

func WithConnectLogger(logger *slog.Logger) ConnectServerOption

WithConnectLogger sets the logger for the server.

func WithConnectMCPManager added in v0.1.0

func WithConnectMCPManager(manager mcp.Manager) ConnectServerOption

WithConnectMCPManager sets the MCP Manager for the server.

func WithConnectPersonaRegistry added in v0.1.0

func WithConnectPersonaRegistry(registry *persona.Registry) ConnectServerOption

WithConnectPersonaRegistry sets the persona registry.

type ToolApprovalAction added in v0.1.0

type ToolApprovalAction int

ToolApprovalAction defines the possible actions for a tool call.

const (
	ToolApprovalActionUnspecified ToolApprovalAction = iota
	ToolApprovalActionApprove
	ToolApprovalActionDeny
	ToolApprovalActionRequireClientApproval
)

func (ToolApprovalAction) String added in v0.1.0

func (a ToolApprovalAction) String() string

type ToolApprovalPolicyConfig added in v0.1.0

type ToolApprovalPolicyConfig struct {
	DefaultAction        ToolApprovalAction            `json:"default_action"`
	ToolSpecificPolicies map[string]ToolApprovalAction `json:"tool_specific_policies"`
}

ToolApprovalPolicyConfig holds the configuration for tool approval.

func DefaultToolApprovalPolicy added in v0.1.0

func DefaultToolApprovalPolicy() ToolApprovalPolicyConfig

Jump to

Keyboard shortcuts

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