bridge

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package bridge exposes local bridge endpoints for editor and remote clients.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Capabilities

func Capabilities() []string

Capabilities returns the JSON-RPC bridge methods advertised during initialization.

Types

type EditorIdentity

type EditorIdentity struct {
	Editor    string    `json:"editor"`
	Version   string    `json:"version,omitempty"`
	Workspace string    `json:"workspace"`
	Trusted   bool      `json:"trusted"`
	TrustedAt time.Time `json:"trusted_at,omitempty"`
}

type EditorOpenFile

type EditorOpenFile struct {
	Path     string    `json:"path"`
	OpenedAt time.Time `json:"opened_at,omitempty"`
}

type EditorSelection

type EditorSelection struct {
	Path        string    `json:"path"`
	StartLine   int       `json:"start_line"`
	StartColumn int       `json:"start_column,omitempty"`
	EndLine     int       `json:"end_line"`
	EndColumn   int       `json:"end_column,omitempty"`
	Text        string    `json:"text,omitempty"`
	UpdatedAt   time.Time `json:"updated_at,omitempty"`
}

type EditorState

type EditorState struct {
	Identity  *EditorIdentity  `json:"identity,omitempty"`
	OpenFile  *EditorOpenFile  `json:"open_file,omitempty"`
	Selection *EditorSelection `json:"selection,omitempty"`
	UpdatedAt time.Time        `json:"updated_at,omitempty"`
}

type Error

type Error struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type FaultEvent

type FaultEvent struct {
	ID          string    `json:"id"`
	Action      string    `json:"action"`
	Args        []string  `json:"args,omitempty"`
	Category    string    `json:"category"`
	Severity    string    `json:"severity"`
	Recoverable bool      `json:"recoverable"`
	Message     string    `json:"message"`
	Remediation string    `json:"remediation"`
	CreatedAt   time.Time `json:"created_at"`
}

type Notification

type Notification struct {
	JSONRPC string `json:"jsonrpc"`
	Method  string `json:"method"`
	Params  any    `json:"params,omitempty"`
}

type Request

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

type Response

type Response struct {
	JSONRPC string `json:"jsonrpc"`
	ID      any    `json:"id,omitempty"`
	Result  any    `json:"result,omitempty"`
	Error   *Error `json:"error,omitempty"`
}

type Server

type Server struct {
	Sessions   *session.Store
	Version    string
	Workspace  string
	ConfigHome string
	TrustToken string
	Executable string
	MCPServers map[string]config.MCPServerConfig
}

func (Server) BridgeFaults

func (s Server) BridgeFaults() ([]FaultEvent, error)

func (Server) ClearBridgeFaults

func (s Server) ClearBridgeFaults() error

func (Server) ClearEditorState

func (s Server) ClearEditorState() error

func (Server) EditorState

func (s Server) EditorState() (EditorState, error)

func (Server) EditorStatePath

func (s Server) EditorStatePath() (string, error)

func (Server) IdentifyEditor

func (s Server) IdentifyEditor(params json.RawMessage) (*EditorIdentity, error)

func (Server) InitializeResult

func (s Server) InitializeResult() map[string]any

InitializeResult returns the stdio bridge initialization payload.

func (Server) OpenEditorFile

func (s Server) OpenEditorFile(params json.RawMessage) (*EditorOpenFile, error)

func (Server) RecordBridgeFault

func (s Server) RecordBridgeFault(action string, args []string) (FaultEvent, error)

func (Server) Serve

func (s Server) Serve(in io.Reader, out io.Writer) error

func (Server) SetEditorSelection

func (s Server) SetEditorSelection(params json.RawMessage) (*EditorSelection, error)

Jump to

Keyboard shortcuts

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