toolplugin

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APIVersion = "mekugi-tool-plugin/v1"

	ExecutionOutputBudgetBytes = 16 << 20
)

Variables

This section is empty.

Functions

func ConfigureProcessGroup

func ConfigureProcessGroup(command *exec.Cmd)

ConfigureProcessGroup makes command cancellation terminate descendants that inherited the command's standard streams instead of leaving Wait blocked.

func EnableFrontendOrphanCleanup

func EnableFrontendOrphanCleanup(ctx context.Context) (context.Context, error)

EnableFrontendOrphanCleanup is for a dedicated authenticated frontend process, not a router or test process that owns unrelated child commands.

func WithHostProcessGroup

func WithHostProcessGroup(ctx context.Context) context.Context

WithHostProcessGroup keeps executable frontend descendants in Codex's command group so stock cancellation can terminate the whole invocation.

Types

type ExecutionOutput

type ExecutionOutput struct {
	OmittedOutput *OmittedOutput `json:"omittedOutput,omitempty"`
	FailureClass  string         `json:"failureClass,omitempty"`
	Stdout        string         `json:"stdout"`
	Stderr        string         `json:"stderr"`
	ExitCode      int            `json:"exitCode"`
}

func Execute

func Execute(
	ctx context.Context,
	node, runtimeRoot, module string,
	index int,
	arguments []string,
	stdin *os.File,
	directory string,
	environment []string,
) (ExecutionOutput, error)

func ExecuteBuiltin

func ExecuteBuiltin(ctx context.Context, name string, args []string) (ExecutionOutput, error)

ExecuteBuiltin runs bundled readers in the authenticated frontend process. Configured plugins remain isolated JavaScript hosts, never native executors.

func FormatOutput

func FormatOutput(ctx context.Context, arguments []string) (ExecutionOutput, error)

FormatOutput formats bounded output entirely in the frontend process.

type OmittedOutput

type OmittedOutput struct {
	// Host-owned mcat provenance, not part of the plugin wire protocol.
	SourceRow  uint64 `json:"-"`
	MaxTokens  int    `json:"-"`
	StdoutKind string `json:"stdoutKind,omitempty"`
	StderrKind string `json:"stderrKind,omitempty"`
	Stdout     string `json:"stdout"`
	Stderr     string `json:"stderr"`
}

type Plugin

type Plugin struct {
	ID     string `json:"id"`
	Module string `json:"module"`
	Tools  []Tool `json:"tools"`
}

type Snapshot

type Snapshot struct {
	Root           string
	NodeExecutable string
	Plugins        []Plugin
	Diagnostics    []string
}

func Load

func Load(ctx context.Context, pluginDirectory, snapshotRoot string) (Snapshot, error)

type Tool

type Tool struct {
	Specification  json.RawMessage `json:"specification"`
	NativeExecutor string          `json:"nativeExecutor,omitempty"`
}

Jump to

Keyboard shortcuts

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