worker

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const MaxFrameSize = 256 << 20

MaxFrameSize is the maximum allowed frame size (256MB). Frames exceeding this size are rejected to prevent OOM DoS attacks.

Variables

This section is empty.

Functions

func CanUseGopls added in v0.3.0

func CanUseGopls(workspaceRoot string) bool

func CanUsePyright

func CanUsePyright(workspaceRoot string) bool

CanUsePyright checks if Pyright is available for the workspace.

func CanUseTsserver

func CanUseTsserver(workspaceRoot string) bool

func DiscoverRepoRoot

func DiscoverRepoRoot(start string) (string, error)

func ErrUnsupportedBackend

func ErrUnsupportedBackend(backendType string) error

func FindBundledWorkerBinary

func FindBundledWorkerBinary(toolRoot string) (string, error)

func FindBundledWorkerBinaryForRID

func FindBundledWorkerBinaryForRID(toolRoot string, rid string) (string, error)

func FindInstalledWorkerBinary

func FindInstalledWorkerBinary() (string, error)

func FindInstalledWorkerBinaryForRID

func FindInstalledWorkerBinaryForRID(rid string) (string, error)

func HasDotnet

func HasDotnet() bool

func InstallWorker

func InstallWorker(toolRoot string, rid string) (string, error)

func InstalledWorkerDir

func InstalledWorkerDir() (string, error)

func InstalledWorkerDirForRID

func InstalledWorkerDirForRID(rid string) (string, error)

func ReadFrame

func ReadFrame(reader io.Reader, payload any) error

func ResolveRID

func ResolveRID() string

func ResolveToolRoot

func ResolveToolRoot(start string) (string, string)

func WriteFrame

func WriteFrame(writer io.Writer, payload any) error

Types

type Client

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

func NewClient

func NewClient(repoRoot string, workspace model.WorkspaceRegistration) (*Client, error)

func (*Client) Call

func (*Client) Close

func (c *Client) Close() error

func (*Client) PID

func (c *Client) PID() int

func (*Client) Start

func (c *Client) Start() error

type EphemeralCaller

type EphemeralCaller struct {
	RepoRoot string
}

func (EphemeralCaller) Call

func (EphemeralCaller) Status

func (e EphemeralCaller) Status() []model.WorkerStatus

type LSPClient

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

LSPClient implements RuntimeClient via a standard LSP server.

func NewGoplsClient added in v0.3.0

func NewGoplsClient(workspace model.WorkspaceRegistration) (*LSPClient, error)

func NewLSPClient

func NewLSPClient(config LSPConfig, workspace model.WorkspaceRegistration) *LSPClient

NewLSPClient creates a new generic LSP client.

func NewPyrightClient

func NewPyrightClient(workspace model.WorkspaceRegistration) (*LSPClient, error)

NewPyrightClient creates an LSPClient configured for Pyright.

func (*LSPClient) Call

Call dispatches a mi-lsp request to the LSP server.

func (*LSPClient) Close

func (c *LSPClient) Close() error

Close shuts down the LSP server.

func (*LSPClient) PID

func (c *LSPClient) PID() int

PID returns the LSP server process ID.

func (*LSPClient) Start

func (c *LSPClient) Start() error

Start spawns the LSP server and performs the initialize/initialized handshake.

type LSPConfig

type LSPConfig struct {
	ServerCmd   string
	ServerArgs  []string
	InitOptions map[string]any
}

LSPConfig configures a generic LSP backend.

type LaunchSpec

type LaunchSpec struct {
	Source        string
	CandidatePath string
	Command       string
	Args          []string
	WorkDir       string
}

func ResolveLaunchSpec

func ResolveLaunchSpec(toolRoot string) (LaunchSpec, error)

func ResolveLaunchSpecs added in v0.2.0

func ResolveLaunchSpecs(toolRoot string) ([]LaunchSpec, error)

type RuntimeClient

type RuntimeClient interface {
	Call(context.Context, model.WorkerRequest) (model.WorkerResponse, error)
	Close() error
	PID() int
}

func NewRuntimeClient

func NewRuntimeClient(repoRoot string, workspace model.WorkspaceRegistration, request model.WorkerRequest) (RuntimeClient, error)

type TsserverClient

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

func NewTsserverClient

func NewTsserverClient(workspace model.WorkspaceRegistration) (*TsserverClient, error)

func (*TsserverClient) Call

func (*TsserverClient) Close

func (c *TsserverClient) Close() error

func (*TsserverClient) PID

func (c *TsserverClient) PID() int

func (*TsserverClient) Start

func (c *TsserverClient) Start() error

type WorkerCandidateStatus

type WorkerCandidateStatus struct {
	Source          string `json:"source,omitempty"`
	Path            string `json:"path,omitempty"`
	ProtocolVersion string `json:"protocol_version,omitempty"`
	Compatible      bool   `json:"compatible,omitempty"`
	Error           string `json:"error,omitempty"`
}

type WorkerRuntimeInfo

type WorkerRuntimeInfo struct {
	RID          string                `json:"rid,omitempty"`
	ToolRoot     string                `json:"tool_root,omitempty"`
	ToolRootKind string                `json:"tool_root_kind,omitempty"`
	Dotnet       bool                  `json:"dotnet,omitempty"`
	InstallHint  string                `json:"install_hint,omitempty"`
	Selected     WorkerCandidateStatus `json:"selected,omitempty"`
	Bundled      WorkerCandidateStatus `json:"bundled,omitempty"`
	Installed    WorkerCandidateStatus `json:"installed,omitempty"`
	DevLocal     WorkerCandidateStatus `json:"dev_local,omitempty"`
}

func InspectWorkerRuntime

func InspectWorkerRuntime(toolRoot string, rid string) WorkerRuntimeInfo

Jump to

Keyboard shortcuts

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