plugin

package
v1.5.157 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 10 Imported by: 1 module, 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 plugin provides a Go server for golder's existing stdio plugin v1 protocol. New cross-host tool integrations should generally use MCP instead.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(ctx context.Context, spec Spec) error

func ServeIO

func ServeIO(ctx context.Context, spec Spec, in io.Reader, out io.Writer) error

ServeIO serves until EOF, shutdown or cancellation. The caller owns in and must close it to interrupt a blocked read. Handlers must observe ctx. Calls are serialized, matching legacy plugin execution semantics.

Types

type Command

type Command struct {
	Name, Description string
	Handle            func(context.Context, string) (CommandResult, error)
}

type CommandResult

type CommandResult struct {
	Prompt        string         `json:"prompt,omitempty"`
	Notifications []Notification `json:"notifications,omitempty"`
}

type Event

type Event struct {
	Type string          `json:"type"`
	Data json.RawMessage `json:"data,omitempty"`
}

type Notification

type Notification struct {
	Message string `json:"message"`
	Type    string `json:"type,omitempty"`
}

type Spec

type Spec struct {
	APIVersion    string // empty or "1"; this SDK deliberately keeps the v1 wire
	ID, Version   string
	Tools         []Tool
	Commands      []Command
	Subscriptions []string
	OnEvent       func(context.Context, Event)
}

type Tool

type Tool struct {
	Spec   extension.ToolSpec
	Handle extension.ToolHandler
}

Jump to

Keyboard shortcuts

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