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 ¶
- func New() engine.Plugin
- type ApprovalRule
- type CollectedEvent
- type MockResponse
- type Plugin
- func (p *Plugin) Capabilities() []engine.Capability
- func (p *Plugin) Collected() []CollectedEvent
- func (p *Plugin) ConfigSchema() []byte
- func (p *Plugin) Dependencies() []string
- func (p *Plugin) Done() <-chan struct{}
- func (p *Plugin) Emissions() []string
- func (p *Plugin) ID() string
- func (p *Plugin) Init(ctx engine.PluginContext) error
- func (p *Plugin) Name() string
- func (p *Plugin) Ready() error
- func (p *Plugin) Requires() []engine.Requirement
- func (p *Plugin) Shutdown(ctx context.Context) error
- func (p *Plugin) Subscriptions() []engine.EventSubscription
- func (p *Plugin) Version() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
ConfigSchema implements engine.ConfigSchemaProvider.
func (*Plugin) Dependencies ¶
func (*Plugin) Done ¶
func (p *Plugin) Done() <-chan struct{}
Done returns a channel that closes when the test session ends.
func (*Plugin) Init ¶
func (p *Plugin) Init(ctx engine.PluginContext) error
Init reads config and wires event handlers.
func (*Plugin) Ready ¶
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) Subscriptions ¶
func (p *Plugin) Subscriptions() []engine.EventSubscription