codexrpc

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func StartProcess

func StartProcess(ctx context.Context, cfg ProcessConfig) (*Client, error)

func (*Client) Call

func (c *Client) Call(ctx context.Context, method string, params any, out any) error

func (*Client) Close

func (c *Client) Close() error

func (*Client) HandleRequest

func (c *Client) HandleRequest(method string, fn func(ctx context.Context, req Request) (any, *RPCError))

func (*Client) Initialize

func (c *Client) Initialize(ctx context.Context, info ClientInfo, experimental bool) (string, error)

func (*Client) InitializeWithOptions

func (c *Client) InitializeWithOptions(ctx context.Context, info ClientInfo, opts InitializeOptions) (string, error)

func (*Client) Notify

func (c *Client) Notify(ctx context.Context, method string, params any) error

func (*Client) OnNotification

func (c *Client) OnNotification(fn func(method string, params json.RawMessage))

type ClientInfo

type ClientInfo struct {
	Name    string `json:"name"`
	Title   string `json:"title,omitempty"`
	Version string `json:"version"`
}

type InitializeCapabilities

type InitializeCapabilities struct {
	ExperimentalAPI           bool     `json:"experimentalApi,omitempty"`
	OptOutNotificationMethods []string `json:"optOutNotificationMethods,omitempty"`
}

type InitializeOptions

type InitializeOptions struct {
	ExperimentalAPI           bool
	OptOutNotificationMethods []string
}

type Notification

type Notification struct {
	Method string          `json:"method"`
	Params json.RawMessage `json:"params,omitempty"`
}

type ProcessConfig

type ProcessConfig struct {
	Command string
	Args    []string
	Env     []string
	// WebSocketURL enables websocket transport. When set, one JSON-RPC message
	// is sent per text frame, and stdio is ignored for RPC payloads.
	WebSocketURL string
	// OnStderr is called for each line of stderr output from the process.
	// If nil, stderr is silently discarded.
	OnStderr func(line string)
	// OnProcessExit is called when the process exits with its exit error (nil if exit code 0).
	OnProcessExit func(err error)
}

type RPCError

type RPCError struct {
	Code    int             `json:"code"`
	Message string          `json:"message"`
	Data    json.RawMessage `json:"data,omitempty"`
}

type Request

type Request struct {
	ID     json.RawMessage `json:"id,omitempty"`
	Method string          `json:"method"`
	Params json.RawMessage `json:"params,omitempty"`
}

type Response

type Response struct {
	ID     json.RawMessage `json:"id"`
	Result json.RawMessage `json:"result,omitempty"`
	Error  *RPCError       `json:"error,omitempty"`
}

Jump to

Keyboard shortcuts

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