shim

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveName

func ResolveName() (string, error)

ResolveName picks the peer name in this order:

  1. $INTERCOM_NAME if non-empty.
  2. The basename of the current working directory.

Returns an error if neither yields a valid peer name.

func Run

func Run(parentCtx context.Context, cfg Config) error

Run is the shim's main loop. It returns when stdin EOFs (Claude Code detaches), ctx cancels, or a fatal error occurs.

Returns nil on clean shutdown, non-nil on configuration errors or fatal I/O failures.

Types

type Config

type Config struct {
	// Name is the peer name. If empty, ResolveName is used.
	Name string
	// Version is reported to both the MCP client and broker. Required.
	Version string
	// SocketPath is the broker's Unix socket. Required.
	SocketPath string
	// BrokerBin is the path to the binary used to auto-spawn the broker.
	// If empty, os.Executable() is used.
	BrokerBin string
	// Stdin/Stdout: where MCP frames flow. Defaults to os.Stdin/os.Stdout.
	Stdin  io.Reader
	Stdout io.Writer
	// Logger sinks structured logs. Defaults to slog on stderr.
	Logger *slog.Logger
}

Config configures Run.

type InvalidNameError

type InvalidNameError struct {
	Name   string
	Source string // human-readable origin: "INTERCOM_NAME", "cwd basename", ""
}

InvalidNameError describes a peer name that didn't pass validation.

func (*InvalidNameError) Error

func (e *InvalidNameError) Error() string

Jump to

Keyboard shortcuts

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