Documentation
¶
Index ¶
- Variables
- func FileServerWithIndexFallback(chatBasePath string) http.Handler
- func FormatMessage(agentType mf.AgentType, message string) []st.MessagePart
- func SetupProcess(ctx context.Context, config SetupProcessConfig) (*termexec.Process, error)
- type AgentStatus
- type ErrorBody
- type Event
- type EventEmitter
- func (e *EventEmitter) EmitError(message string, level st.ErrorLevel)
- func (e *EventEmitter) EmitMessages(newMessages []st.ConversationMessage)
- func (e *EventEmitter) EmitScreen(newScreen string)
- func (e *EventEmitter) EmitStatus(newStatus st.ConversationStatus)
- func (e *EventEmitter) Subscribe() (int, <-chan Event, []Event)
- func (e *EventEmitter) Unsubscribe(chanId int)
- type EventEmitterOption
- type EventType
- type Message
- type MessageRequest
- type MessageRequestBody
- type MessageResponse
- type MessageType
- type MessageUpdateBody
- type MessagesResponse
- type ScreenUpdateBody
- type Server
- type ServerConfig
- type SetupACPConfig
- type SetupACPResult
- type SetupProcessConfig
- type StatusChangeBody
- type StatusResponse
- type Transport
- type UploadRequest
- type UploadResponse
Constants ¶
This section is empty.
Variables ¶
var AgentStatusValues = []AgentStatus{ AgentStatusStable, AgentStatusRunning, }
var MessageTypeValues = []MessageType{ MessageTypeUser, MessageTypeRaw, }
var TransportValues = []Transport{ TransportPTY, TransportACP, }
Functions ¶
func FileServerWithIndexFallback ¶ added in v0.2.0
FileServerWithIndexFallback creates a file server that serves the given filesystem and falls back to index.html for any path that doesn't match a file
func FormatMessage ¶
func FormatMessage(agentType mf.AgentType, message string) []st.MessagePart
func SetupProcess ¶
Types ¶
type AgentStatus ¶
type AgentStatus string
const ( AgentStatusRunning AgentStatus = "running" AgentStatusStable AgentStatus = "stable" )
type ErrorBody ¶ added in v0.12.0
type ErrorBody struct {
Message string `json:"message" doc:"Error message"`
Level st.ErrorLevel `json:"level" doc:"Error level"`
Time time.Time `json:"time" doc:"Timestamp when the error occurred"`
}
type EventEmitter ¶
type EventEmitter struct {
// contains filtered or unexported fields
}
func NewEventEmitter ¶
func NewEventEmitter(opts ...EventEmitterOption) *EventEmitter
func (*EventEmitter) EmitError ¶ added in v0.12.0
func (e *EventEmitter) EmitError(message string, level st.ErrorLevel)
func (*EventEmitter) EmitMessages ¶ added in v0.12.0
func (e *EventEmitter) EmitMessages(newMessages []st.ConversationMessage)
EmitMessages assumes that only the last message can change or new messages can be added. If a new message is injected between existing messages (identified by Id), the behavior is undefined.
func (*EventEmitter) EmitScreen ¶ added in v0.12.0
func (e *EventEmitter) EmitScreen(newScreen string)
func (*EventEmitter) EmitStatus ¶ added in v0.12.0
func (e *EventEmitter) EmitStatus(newStatus st.ConversationStatus)
func (*EventEmitter) Subscribe ¶
func (e *EventEmitter) Subscribe() (int, <-chan Event, []Event)
Subscribe returns: - a subscription ID that can be used to unsubscribe. - a channel for receiving events. - a list of events that allow to recreate the state of the conversation right before the subscription was created.
func (*EventEmitter) Unsubscribe ¶
func (e *EventEmitter) Unsubscribe(chanId int)
type EventEmitterOption ¶ added in v0.12.0
type EventEmitterOption func(*EventEmitter)
func WithAgentType ¶ added in v0.12.0
func WithAgentType(agentType mf.AgentType) EventEmitterOption
func WithClock ¶ added in v0.12.0
func WithClock(clock quartz.Clock) EventEmitterOption
func WithSubscriptionBufSize ¶ added in v0.12.0
func WithSubscriptionBufSize(size uint) EventEmitterOption
type Message ¶
type Message struct {
Id int `` /* 136-byte string literal not displayed */
Content string `` /* 215-byte string literal not displayed */
Role st.ConversationRole `json:"role" doc:"Role of the message author"`
Time time.Time `json:"time" doc:"Timestamp of the message"`
}
Message represents a message
type MessageRequest ¶
type MessageRequest struct {
Body MessageRequestBody `json:"body" doc:"Message content and type"`
}
MessageRequest represents a request to create a new message
type MessageRequestBody ¶
type MessageRequestBody struct {
Content string `json:"content" example:"Hello, agent!" doc:"Message content"`
Type MessageType `` /* 451-byte string literal not displayed */
}
type MessageResponse ¶
type MessageResponse struct {
Body struct {
Ok bool `` /* 256-byte string literal not displayed */
}
}
MessageResponse represents a newly created message
type MessageType ¶
type MessageType string
const ( MessageTypeUser MessageType = "user" MessageTypeRaw MessageType = "raw" )
type MessageUpdateBody ¶
type MessagesResponse ¶
type MessagesResponse struct {
Body struct {
Messages []Message `json:"messages" nullable:"false" doc:"List of messages"`
}
}
MessagesResponse represents the list of messages
type ScreenUpdateBody ¶
type ScreenUpdateBody struct {
Screen string `json:"screen"`
}
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents the HTTP server
func NewServer ¶
func NewServer(ctx context.Context, config ServerConfig) (*Server, error)
NewServer creates a new server instance
func (*Server) GetOpenAPI ¶
func (*Server) Handler ¶ added in v0.3.1
Handler returns the underlying chi.Router for testing purposes.
func (*Server) NormalizeSchema ¶ added in v0.8.0
type ServerConfig ¶ added in v0.3.3
type SetupACPConfig ¶ added in v0.12.0
type SetupACPResult ¶ added in v0.12.0
type SetupACPResult struct {
AgentIO *acpio.ACPAgentIO
Wait func() error // Calls cmd.Wait() and returns exit error
Done chan struct{} // Close this when Wait() returns to clean up goroutine
}
SetupACPResult contains the result of setting up an ACP process.
func SetupACP ¶ added in v0.12.0
func SetupACP(ctx context.Context, config SetupACPConfig) (*SetupACPResult, error)
type SetupProcessConfig ¶ added in v0.2.2
type StatusChangeBody ¶
type StatusChangeBody struct {
Status AgentStatus `json:"status" doc:"Agent status"`
AgentType mf.AgentType `json:"agent_type" doc:"Type of the agent being used by the server."`
}
type StatusResponse ¶
type StatusResponse struct {
Body struct {
Status AgentStatus `` /* 158-byte string literal not displayed */
AgentType mf.AgentType `json:"agent_type" doc:"Type of the agent being used by the server."`
Transport Transport `json:"transport" doc:"Backend transport being used ('acp' or 'pty')."`
}
}
StatusResponse represents the server status