Documentation
¶
Overview ¶
Package standalone provides a standalone HTTP server platform for omniagent.
The standalone platform runs a local HTTP server with:
- WebSocket control plane for real-time client connections
- Webhook endpoints for receiving messages from external services
- Health check endpoint for monitoring
- Graceful shutdown handling
Example Usage ¶
p, _ := standalone.New(standalone.Config{
Address: ":8080",
WebhookHandlers: map[string]http.Handler{
"/webhook/twilio/sms": twilioHandler,
},
})
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt)
defer cancel()
if err := p.Run(ctx, myAgent); err != nil {
log.Fatal(err)
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Address is the HTTP server listen address (default: ":8080").
Address string
// ReadTimeout is the HTTP read timeout (default: 30s).
ReadTimeout time.Duration
// WriteTimeout is the HTTP write timeout (default: 30s).
WriteTimeout time.Duration
// ShutdownTimeout is the graceful shutdown timeout (default: 10s).
ShutdownTimeout time.Duration
// Logger for platform logging.
Logger *slog.Logger
// WebhookHandlers maps paths to HTTP handlers for incoming webhooks.
// Example: {"/webhook/twilio/sms": twilioHandler}
WebhookHandlers map[string]http.Handler
// EnableWebSocket enables the WebSocket control plane (default: true).
EnableWebSocket bool
// EnableHealthCheck enables the /health endpoint (default: true).
EnableHealthCheck bool
// TLS configures TLS for the HTTP server.
TLS *TLSConfig
}
Config configures the standalone platform.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a Config with default values.
type Platform ¶
type Platform struct {
// contains filtered or unexported fields
}
Platform is a standalone HTTP server platform.
Click to show internal directories.
Click to hide internal directories.