rpc

package
v0.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 19 Imported by: 0 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

Overview

Package rpc exposes the engine over JSON-RPC. It powers:

  • `sweef serve` — TCP/Unix socket server for SDKs (Node & Python)
  • stdio loop — used by the MCP bridge and `sweef call <method>`

Method names mirror CDP namespaces (Page.*, DOM.*, Network.*, Runtime.*) so the shim in internal/cdp can translate real DevTools traffic onto these, and so Playwright-style SDKs map 1:1 onto our verbs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LineDiff

func LineDiff(a, b string) string

LineDiff is a small LCS line diff (+ added, - removed); above ~16M cells it falls back to a multiset difference.

Types

type Params

type Params = map[string]any

type Server

type Server struct {

	// IdleTimeout, when > 0, makes ServeTCP return after that long without a
	// request (session daemons started by the CLI use it).
	IdleTimeout time.Duration
	// OnShutdown is invoked by the Browser.shutdown method (CLI `close`).
	OnShutdown func()
	// contains filtered or unexported fields
}

func NewServer

func NewServer(e *engine.Engine) *Server

func (*Server) Call

func (s *Server) Call(method string, raw json.RawMessage) (json.RawMessage, *protocol.RpcError)

Call executes one method and returns a JSON result or an RpcError.

func (*Server) ServePipe

func (s *Server) ServePipe(ctx context.Context, rw io.ReadWriteCloser, busEvents bool) error

ServePipe speaks framed protocol over an arbitrary ReadWriteCloser. Used for stdio (`sweef mcp`, `sweef call`) and sockets alike.

func (*Server) ServeTCP

func (s *Server) ServeTCP(ctx context.Context, addr string) error

ServeTCP listens for SDK connections. One goroutine per client; each is a few KB of stack until it starts working — fine even at hundreds of agents.

Jump to

Keyboard shortcuts

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