Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunBackend ¶
func RunBackend(ctx context.Context, config RunnerConfig) error
RunBackend runs a backend process with common error handling and logging. It handles: - Socket cleanup - Argument sanitization for logging - Process lifecycle management - Error channel handling - Context cancellation
func ValidateEnv ¶ added in v1.1.35
ValidateEnv checks that every entry in env is in "KEY=VALUE" form with a non-empty key. It returns an error describing the first malformed entry.
Types ¶
type ErrorTransformer ¶ added in v1.0.12
ErrorTransformer is a function that transforms raw error output into a more user-friendly message. Backends can provide their own implementation to customize error presentation.
type RunnerConfig ¶
type RunnerConfig struct {
// BackendName is the display name of the backend (e.g., "llama.cpp", "vLLM")
BackendName string
// Socket is the unix socket path
Socket string
// BinaryPath is the path to the backend binary
BinaryPath string
// SandboxPath is the sandbox directory path
SandboxPath string
// SandboxConfig is the sandbox configuration string
SandboxConfig string
// Args are the command line arguments
Args []string
// Logger provides logging functionality
Logger Logger
// ServerLogWriter provides a writer for server logs
ServerLogWriter io.WriteCloser
// ErrorTransformer is an optional function to transform error output
// into a more user-friendly message. If nil, the raw output is used.
ErrorTransformer ErrorTransformer
// Env is an optional list of extra environment variables for the backend
// process, each in "KEY=VALUE" form. These are appended to the current
// process environment. If nil or empty, the backend inherits the parent
// env as-is (an empty non-nil slice is treated the same as nil).
Env []string
}
RunnerConfig holds configuration for a backend runner
Click to show internal directories.
Click to hide internal directories.