rawdriver

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package rawdriver executes registry-bound raw HTTP scenarios through the origin-restricted transport and the evidence-first evaluation pipeline.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssertionSpec

type AssertionSpec struct {
	AssertionID     string
	RequirementID   string
	Role            schema.AssertionRole
	Oracle          schema.ArtifactPin
	EvaluatorDigest schema.Digest
	Check           CheckKind
	AllowedValues   []string
	ExpectedUsage   *TokenUsage
}

AssertionSpec binds an executable check to its catalog requirement, oracle, and protected evaluator digest.

type BodyBudget

type BodyBudget struct {
	RequestBytes  int64
	ResponseBytes int64
}

BodyBudget is an enforced per-scenario body boundary. RequestBytes applies to the canonical JSON body; ResponseBytes applies before parsing or CAS persistence.

type CheckKind

type CheckKind string

CheckKind selects one bounded assertion over the normalized exchange. Core JSON, relationship, and stream-state checks always run in addition to this scenario-specific assertion.

const (
	CheckArgumentsString   CheckKind = "arguments_string"
	CheckOutputIndexes     CheckKind = "output_indexes"
	CheckStreamingToolCall CheckKind = "streaming_tool_call"
	CheckFinishReason      CheckKind = "finish_reason"
	CheckTerminalEvent     CheckKind = "terminal_event"
	CheckStableToolCallID  CheckKind = "stable_tool_call_id"
	CheckNoUnknownEvent    CheckKind = "no_unknown_event"
	CheckClosedReasoning   CheckKind = "closed_reasoning"
	CheckUsageConsistent   CheckKind = "usage_consistent"
	CheckValidUTF8         CheckKind = "valid_utf8"
	CheckRequiredEnvelope  CheckKind = "required_response_envelope"
	CheckStreamMediaType   CheckKind = "stream_media_type"
	CheckNoPostTerminal    CheckKind = "no_post_terminal_data"
)

type Config

type Config struct {
	Registry            Registry
	Transport           *transport.Client
	Store               *cas.Store
	Redactor            *redaction.Redactor
	Producer            schema.Producer
	NewID               IDSource
	Now                 func() time.Time
	MaxObservationBytes int
}

type IDSource

type IDSource func() (schema.InstanceID, error)

type MemoryRegistry

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

MemoryRegistry is a concurrency-safe synthetic registry suitable for local execution and tests. Register clones all mutable input.

func NewMemoryRegistry

func NewMemoryRegistry(scenarios ...Scenario) (*MemoryRegistry, error)

func (*MemoryRegistry) Clear

func (registry *MemoryRegistry) Clear()

Clear releases all registered request material after one local execution. Mutable bodies are overwritten before references are dropped. Header values are strings and cannot be reliably erased by Go; they remain process-memory only and are never accepted by a persistence API before redaction.

func (*MemoryRegistry) Estimate

func (registry *MemoryRegistry) Estimate(decision schema.ScenarioDecision) (budget.Usage, error)

func (*MemoryRegistry) Lookup

func (registry *MemoryRegistry) Lookup(planDigest schema.Digest, decision schema.ScenarioDecision) (Scenario, error)

func (*MemoryRegistry) Register

func (registry *MemoryRegistry) Register(input Scenario) error

type Protocol

type Protocol string

Protocol identifies the provider wire shape interpreted by the built-in normalizer. It is deliberately closed; unknown protocols require a new, reviewed decoder rather than falling through to a permissive guess.

const (
	ProtocolOpenAIChat      Protocol = "openai-chat"
	ProtocolOpenAIResponses Protocol = "openai-responses"
	ProtocolAnthropic       Protocol = "anthropic-messages"
)

type Registry

type Registry interface {
	Estimate(schema.ScenarioDecision) (budget.Usage, error)
	Lookup(schema.Digest, schema.ScenarioDecision) (Scenario, error)
}

Registry performs both the pre-reservation estimate lookup and the exact plan-bound execution lookup required by executor.Runner.

type Runner

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

Runner implements executor.Runner. It owns no endpoint URL and therefore cannot bypass the exact origin already frozen into transport.Client.

func New

func New(config Config) (*Runner, error)

func (*Runner) Estimate

func (runner *Runner) Estimate(decision schema.ScenarioDecision) (budget.Usage, error)

func (*Runner) Finalize

func (runner *Runner) Finalize(_ context.Context, plan schema.FinalizerPlan) (budget.Usage, error)

func (*Runner) Run

func (runner *Runner) Run(ctx context.Context, invocation executor.Invocation) (executor.Outcome, error)

type Scenario

type Scenario struct {
	PlanDigest     schema.Digest
	ID             string
	Driver         schema.ArtifactPin
	Protocol       Protocol
	Method         string
	Path           string
	Headers        http.Header
	Body           json.RawMessage
	Streaming      bool
	ExpectedStatus int
	Budget         BodyBudget
	Assertion      AssertionSpec
}

Scenario is the immutable request and oracle material returned by the registry. No origin is present here: the only origin comes from transport's separately authorized exact-origin client.

type TokenUsage

type TokenUsage struct {
	Input  int64
	Output int64
	Total  *int64
}

TokenUsage is an exact synthetic expectation. It is only used by a scenario whose catalog assertion explicitly checks deterministic fixture usage.

Jump to

Keyboard shortcuts

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