Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Log logger.Logger = logger.NewNullLogger()
Functions ¶
func RunJSONRPCServer ¶ added in v0.12.0
func RunJSONRPCServer(ctx context.Context, config ServerConfig) error
RunJSONRPCServer runs the stdio JSON-RPC 2.0 server. It performs the same bootstrap as RunServer (setup script registers handlers via runtime.jsonrpc.method/notification or runtime.plugin.serve/function), then serves requests from stdin until stdin closes or a terminating signal arrives.
When the setup script calls runtime.plugin.serve(), the server switches to the full Scriptling plugin protocol (scriptling.handshake, function.call, etc.) so that clients can load it with scriptling=True and receive auto-generated proxy libraries. Otherwise the plain JSON-RPC 2.0 loop runs.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents the HTTP server
func NewServer ¶
func NewServer(config ServerConfig) (*Server, error)
NewServer creates a new HTTP server
func (*Server) RunJSONRPCStdio ¶ added in v0.12.0
RunJSONRPCStdio serves JSON-RPC 2.0 requests from stdin, writing one response per line to stdout. Each request runs on a fresh Scriptling evaluator in its own goroutine; writes are serialised via a mutex. The call blocks until stdin closes (or returns on a fatal read/write error).
func (*Server) RunPluginServerStdio ¶ added in v0.15.0
RunPluginServerStdio serves the Scriptling plugin protocol over stdio using the pre-built plugin server.
type ServerConfig ¶
type ServerConfig struct {
Address string
ScriptFile string
LibDirs []string
Packages []string // Package (.zip) paths or URLs
Insecure bool // Allow self-signed HTTPS for package URLs
CacheDir string // Override default OS cache dir for remote packages
BearerToken string
AllowedPaths []string // Filesystem path restrictions (empty = no restrictions)
DisabledLibs []string // Built-in libraries to disable (empty = all enabled)
PluginDirs []string
PluginManager *scriptlingplugin.Manager
MCPToolsDir string // Empty means MCP disabled
MCPExecTool bool // Enable code execution tool
JSONRPC bool // Mount JSON-RPC over HTTP at /json-rpc
KVStoragePath string // Empty means in-memory KV store
WebRoot string // Directory to serve static files from (empty = disabled)
SecretRegistry *secretprovider.Registry
DockerSock string
PodmanSock string
TLSCert string
TLSKey string
TLSGenerate bool
// ExtraLibs, if set, registers additional libraries on every evaluator
// after the standard library set — the setup script and every json-rpc,
// http, mcp and websocket request handler. Host applications use this to
// expose their own libraries to served scripts.
ExtraLibs func(*scriptling.Scriptling)
}
ServerConfig holds the configuration for the HTTP server