driver

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0, MIT Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package driver implements the out-of-process JSON/NDJSON subject driver client backed by the containment supervisor.

Index

Constants

View Source
const HandshakeFlag = "--docpresser-handshake"

HandshakeFlag is the argument that asks a driver to describe itself.

View Source
const ProtocolVersion = "docpresser-driver/v0"

ProtocolVersion identifies the Wave 1 stdin/stdout driver wire contract.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Name         string
	Role         string
	Command      string
	Args         []string
	DriverSHA256 string
	// contains filtered or unexported fields
}

Client invokes an out-of-process subject driver under containment supervision.

func NewClient

func NewClient(specStr, role string) (*Client, error)

NewClient constructs a subject driver client from a specification string "name=command [args...]" and role ("target" or "baseline").

func (*Client) ExecuteCase

func (c *Client) ExecuteCase(ctx context.Context, pc model.PackCase, inputBytes []byte) (model.Observation, error)

ExecuteCase runs a single PackCase against the subject driver inside the containment supervisor.

func (*Client) Handshake added in v0.2.0

func (c *Client) Handshake(ctx context.Context) error

Handshake runs the driver once with HandshakeFlag (appended after its own arguments) under containment and records the identity it reports. It fails on any timeout, crash, oversized or malformed reply, wrong protocol version, or empty identity field; there is no placeholder fallback.

func (*Client) Metadata

func (c *Client) Metadata() (model.SubjectMetadata, error)

Metadata returns the SubjectMetadata for run-manifest.json. It requires a completed Handshake.

type Handshake added in v0.2.0

type Handshake struct {
	Version        string   `json:"version"`
	Subject        string   `json:"subject"`
	SubjectVersion string   `json:"subject_version"`
	Language       string   `json:"language"`
	Engine         string   `json:"engine"`
	Formats        []string `json:"formats"`
	Operations     []string `json:"operations"`
}

Handshake is the single JSON object a driver prints for HandshakeFlag.

type Request

type Request struct {
	Version     string             `json:"version"`
	CaseID      string             `json:"case_id"`
	Format      string             `json:"format"`
	Operation   string             `json:"operation"`
	Profile     string             `json:"profile,omitempty"`
	InputBase64 string             `json:"input_base64"`
	Budgets     *model.CaseBudgets `json:"budgets,omitempty"`
}

Request is sent as a single JSON line on stdin to a subject driver.

type Response

type Response struct {
	Version        string   `json:"version"`
	CaseID         string   `json:"case_id"`
	Subject        string   `json:"subject,omitempty"`
	SubjectVersion string   `json:"subject_version,omitempty"`
	Status         string   `json:"status"`
	OutputSHA256   string   `json:"output_sha256,omitempty"`
	OutputBytes    int64    `json:"output_bytes,omitempty"`
	DocumentCount  int      `json:"document_count,omitempty"`
	EventCount     int      `json:"event_count,omitempty"`
	CanonicalValue string   `json:"canonical_value,omitempty"`
	ErrorPhase     string   `json:"error_phase,omitempty"`
	ErrorCode      string   `json:"error_code,omitempty"`
	ParseNs        int64    `json:"parse_ns,omitempty"`
	EmitNs         int64    `json:"emit_ns,omitempty"`
	HazardsFound   []string `json:"hazards_found,omitempty"`
}

Response is emitted as a single JSON line on stdout by a subject driver.

Jump to

Keyboard shortcuts

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