testio

package
v0.31.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package testio provides a non-interactive IO plugin for integration testing. It replaces nexus.io.tui in test configs, feeding scripted inputs, collecting all bus events, and handling approvals per scenario configuration.

When mock_responses is configured, the plugin intercepts LLM requests and injects synthetic responses — no real LLM calls, no API key needed.

The plugin is designed to be driven by pkg/testharness but can also be used standalone in any test config.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() engine.Plugin

New creates a new test IO plugin instance.

Types

type ApprovalRule

type ApprovalRule struct {
	Match  string // substring match on tool call or description
	Action string // "approve" or "deny"
}

ApprovalRule controls how the plugin responds to approval requests.

type CollectedEvent

type CollectedEvent struct {
	Type      string
	Source    string
	Timestamp time.Time
	Payload   any
	Causation engine.EventCausation
}

CollectedEvent is a bus event captured during the test run.

type MockResponse

type MockResponse struct {
	Content   string
	ToolCalls []events.ToolCallRequest
}

MockResponse is a synthetic LLM response injected instead of a real API call.

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

Plugin is the test IO plugin. It feeds scripted inputs into the engine, collects all bus events, and auto-responds to approvals per config.

func (*Plugin) Capabilities

func (p *Plugin) Capabilities() []engine.Capability

func (*Plugin) Collected

func (p *Plugin) Collected() []CollectedEvent

Collected returns all events captured during the run. Safe to call after Done() is closed.

func (*Plugin) ConfigSchema

func (p *Plugin) ConfigSchema() []byte

ConfigSchema implements engine.ConfigSchemaProvider.

func (*Plugin) Dependencies

func (p *Plugin) Dependencies() []string

func (*Plugin) Done

func (p *Plugin) Done() <-chan struct{}

Done returns a channel that closes when the test session ends.

func (*Plugin) Emissions

func (p *Plugin) Emissions() []string

func (*Plugin) ID

func (p *Plugin) ID() string

func (*Plugin) Init

func (p *Plugin) Init(ctx engine.PluginContext) error

Init reads config and wires event handlers.

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) Ready

func (p *Plugin) Ready() error

Ready emits session start and arms the timeout watchdog. Inputs are NOT fed from here: see handleCoreReady.

func (*Plugin) Requires

func (p *Plugin) Requires() []engine.Requirement

func (*Plugin) Shutdown

func (p *Plugin) Shutdown(ctx context.Context) error

Shutdown unsubscribes all handlers.

func (*Plugin) Subscriptions

func (p *Plugin) Subscriptions() []engine.EventSubscription

func (*Plugin) Version

func (p *Plugin) Version() string

Jump to

Keyboard shortcuts

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