server

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Addr           string
	DevMode        bool
	Logger         *slog.Logger
	StaticFS       fs.FS // embedded web/dist files for production
	Version        string
	NotifyManager  *notify.Manager
	AgentManager   *agent.Manager
	GroupDMManager *agent.GroupDMManager
}

type Server

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

func New

func New(cfg Config) *Server

func (*Server) Handler

func (s *Server) Handler() http.Handler

func (*Server) Serve

func (s *Server) Serve(ln net.Listener) error

func (*Server) ServeAuth added in v0.17.0

func (s *Server) ServeAuth(ln net.Listener, resolver *auth.Resolver) error

ServeAuth serves the agent-facing auth-required listener using the supplied resolver. The handler chain is AuthMiddleware (sets Principal from Authorization header) → EnforceMiddleware (denies non-Owner principals on routes outside the allowlist) → mux.

Intended use: bind to 127.0.0.1 only, expose to local PTY processes via $KOJO_API_BASE. The public listener (Serve) bypasses auth and keeps the user UX intact.

func (*Server) ServeTLS

func (s *Server) ServeTLS(ln net.Listener, certFile, keyFile string) error

func (*Server) SetTLSConfig

func (s *Server) SetTLSConfig(tlsCfg *tls.Config)

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

type WSAttachmentMsg added in v0.5.0

type WSAttachmentMsg struct {
	Type        string                `json:"type"`
	Attachments []*session.Attachment `json:"attachments"`
}

type WSExitMsg

type WSExitMsg struct {
	Type     string `json:"type"`
	ExitCode int    `json:"exitCode"`
	Live     bool   `json:"live"`
}

type WSInputMsg

type WSInputMsg struct {
	Type string `json:"type"`
	Data string `json:"data"` // base64
}

type WSMessage

type WSMessage struct {
	Type string          `json:"type"`
	Data json.RawMessage `json:"data,omitempty"`
}

WebSocket message types

type WSOutputMsg

type WSOutputMsg struct {
	Type string `json:"type"`
	Data string `json:"data"` // base64
}

type WSResizeMsg

type WSResizeMsg struct {
	Type string `json:"type"`
	Cols int    `json:"cols"`
	Rows int    `json:"rows"`
}

type WSScrollbackMsg

type WSScrollbackMsg struct {
	Type string `json:"type"`
	Data string `json:"data"` // base64
}

type WSYoloDebugMsg

type WSYoloDebugMsg struct {
	Type string `json:"type"`
	Tail string `json:"tail"`
}

Jump to

Keyboard shortcuts

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