daemon

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: EUPL-1.2 Imports: 7 Imported by: 0

Documentation

Index

Examples

Constants

View Source
const (
	DaemonName     = "violet"
	DefaultVersion = "dev"
)

Variables

This section is empty.

Functions

func DefaultSocketPath

func DefaultSocketPath() (string, error)
Example
core.Println("DefaultSocketPath")
Output:
DefaultSocketPath

Types

type Handler

type Handler func(context.Context, Request) (Response, error)

Handler processes one action request.

type Registry

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

Registry maps daemon actions to handlers. It preserves registration order so the info response is stable and human-readable.

func DefaultRegistryForDaemon

func DefaultRegistryForDaemon() *Registry
Example
core.Println("DefaultRegistryForDaemon")
Output:
DefaultRegistryForDaemon

func NewRegistry

func NewRegistry(name, version string) *Registry
Example

Generated runnable examples for file-aware public API coverage.

core.Println("NewRegistry")
Output:
NewRegistry

func (*Registry) Actions

func (r *Registry) Actions() []string
Example
core.Println("Registry_Actions")
Output:
Registry_Actions

func (*Registry) Dispatch

func (r *Registry) Dispatch(ctx context.Context, req Request) (Response, error)
Example
core.Println("Registry_Dispatch")
Output:
Registry_Dispatch

func (*Registry) Register

func (r *Registry) Register(action string, handler Handler) error
Example
core.Println("Registry_Register")
Output:
Registry_Register

type Request

type Request struct {
	Action string `json:"action"`
	Text   string `json:"text,omitempty"`
	Prompt string `json:"prompt,omitempty"`
	Model  string `json:"model,omitempty"`
}

Request is one JSON-line frame from a local Violet client.

type Response

type Response map[string]any

Response is encoded as one complete JSON-line frame. Streaming responses are intentionally deferred so the initial UDS contract stays simple.

type Server

type Server struct {
	SocketPath string
	Registry   *Registry
	ModelPaths map[string]string
}

func NewServer

func NewServer(cfg ServerConfig) *Server
Example

Generated runnable examples for file-aware public API coverage.

core.Println("NewServer")
Output:
NewServer

func (*Server) ListenAndServe

func (s *Server) ListenAndServe(ctx context.Context) error
Example
core.Println("Server_ListenAndServe")
Output:
Server_ListenAndServe

type ServerConfig

type ServerConfig struct {
	SocketPath string
	Registry   *Registry

	// ModelPaths is populated from config/env by cmd/violet. Violet is one
	// process for multiple configured models; actual model loading is a follow-up
	// and should load once at startup, with restart as the swap mechanism.
	ModelPaths map[string]string
}

Jump to

Keyboard shortcuts

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