localstub

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package localstub implements a deterministic no-network backend for local dogfood and smoke tests. It is not a provider emulator and does not claim parity with any hosted API.

Index

Constants

View Source
const DefaultAssistantText = "[local-stub] deterministic assistant text"

DefaultAssistantText is used when text is empty or whitespace-only after normalization.

View Source
const DefaultToolArgs = "{}"

DefaultToolArgs is emitted when tool_name is set and tool_args is omitted/empty.

View Source
const ID = "local-stub"

ID is the registered backend factory kind for the standard distribution.

Variables

This section is empty.

Functions

func New

func New(cfg Config) execbackend.Backend

New returns an exec backend that emits a fixed canonical stream from cfg.

func NewFromYAML

func NewFromYAML(n yaml.Node) (execbackend.Backend, error)

NewFromYAML builds a backend from opaque plugin YAML (composition root).

Types

type Config

type Config struct {
	Text         string `yaml:"text"`
	InputTokens  int    `yaml:"input_tokens"`
	OutputTokens int    `yaml:"output_tokens"`
	ToolName     string `yaml:"tool_name"`
	// ToolArgs is the raw tool-call arguments delta emitted when ToolName is set.
	// Empty defaults to "{}". May be intentionally truncated/malformed JSON for
	// dogfood of canonical tool-call repair (issue #152).
	ToolArgs string `yaml:"tool_args"`
	// StreamErrorAfterTextDelta, when true, yields the normal stream through the first assistant
	// text delta then returns a non-recoverable error (dogfood invariant tests; not provider-like).
	StreamErrorAfterTextDelta bool `yaml:"stream_error_after_text_delta"`
}

Config is YAML configuration for the local-stub backend (see stage-five design).

func NormalizeConfig

func NormalizeConfig(raw Config) (Config, error)

NormalizeConfig applies defaults and validates counts and tool name.

func ParseConfig

func ParseConfig(n yaml.Node) (Config, error)

ParseConfig decodes and normalizes stub configuration from a plugin YAML node.

Jump to

Keyboard shortcuts

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