server

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Package server provides the gRPC server for yaad. Uses google.golang.org/grpc with a hand-written service descriptor (no protoc required — messages are JSON-encoded over gRPC).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ServeDashboard

func ServeDashboard(mux *http.ServeMux)

ServeDashboard serves the graph visualization dashboard at /yaad/ui.

Types

type GRPCEdge

type GRPCEdge struct {
	ID      string  `json:"id"`
	FromID  string  `json:"from_id"`
	ToID    string  `json:"to_id"`
	Type    string  `json:"type"`
	Acyclic bool    `json:"acyclic"`
	Weight  float64 `json:"weight"`
}

type GRPCNode

type GRPCNode struct {
	ID            string  `json:"id"`
	Type          string  `json:"type"`
	Content       string  `json:"content"`
	Summary       string  `json:"summary"`
	Scope         string  `json:"scope"`
	Project       string  `json:"project"`
	Tier          int     `json:"tier"`
	Tags          string  `json:"tags"`
	Confidence    float64 `json:"confidence"`
	SourceSession string  `json:"source_session"`
	SourceAgent   string  `json:"source_agent"`
}

type GRPCServer

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

GRPCServer implements the yaad gRPC service.

func NewGRPCServer

func NewGRPCServer(eng *engine.Engine, addr string) *GRPCServer

NewGRPCServer creates a gRPC server.

func (*GRPCServer) ListenAndServe

func (s *GRPCServer) ListenAndServe() error

ListenAndServe starts the gRPC server.

func (*GRPCServer) NotifyWatchers

func (s *GRPCServer) NotifyWatchers(event string, node *storage.Node)

NotifyWatchers broadcasts a memory event to all active WatchMemories streams.

type MCPServer

type MCPServer struct {

	// ToolProfile controls which tools are exposed.
	// "agent" = 8 core tools (saves ~800 tokens), "all" = all 15 tools.
	ToolProfile string
	// contains filtered or unexported fields
}

MCPServer wraps the MCP protocol server.

func NewMCPServer

func NewMCPServer(eng *engine.Engine, profile string) *MCPServer

NewMCPServer creates an MCP server with yaad tools registered. profile: "agent" (8 core tools, saves tokens) or "all" (15 tools, default).

func (*MCPServer) ServeStdio

func (s *MCPServer) ServeStdio() error

ServeStdio starts the MCP server on stdin/stdout.

type MemoryEvent

type MemoryEvent struct {
	Event string    `json:"event"` // created|updated|deleted
	Node  *GRPCNode `json:"node"`
}

type RESTServer

type RESTServer struct {
	SSE *SSEBroker
	// contains filtered or unexported fields
}

RESTServer serves the HTTP API.

func NewRESTServer

func NewRESTServer(eng *engine.Engine, addr string) *RESTServer

NewRESTServer creates a REST server.

func (*RESTServer) ListenAndServe

func (s *RESTServer) ListenAndServe() error

ListenAndServe starts the HTTP server.

func (*RESTServer) RegisterRoutes

func (s *RESTServer) RegisterRoutes(mux *http.ServeMux)

RegisterRoutes registers all routes on the given mux (useful for testing).

func (*RESTServer) WithEmbedder

func (s *RESTServer) WithEmbedder(p embeddings.Provider) *RESTServer

WithEmbedder sets the embedding provider for vector search.

func (*RESTServer) WithTLS

func (s *RESTServer) WithTLS(cfg *stdtls.Config) *RESTServer

WithTLS sets TLS config on the server.

type SSEBroker

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

SSEBroker manages Server-Sent Events subscriptions.

func NewSSEBroker

func NewSSEBroker() *SSEBroker

NewSSEBroker creates a new SSE broker.

func (*SSEBroker) Publish

func (b *SSEBroker) Publish(event string, data any)

Publish sends an event to all connected SSE clients.

func (*SSEBroker) ServeHTTP

func (b *SSEBroker) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP handles SSE connections at GET /yaad/events.

Jump to

Keyboard shortcuts

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