harnessconfig

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 8 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 harnessconfig defines the shared model configuration contract. This file is the authoring entry point for Harness configuration: declare native provider support and parameter validation once, then bind that same Configuration when registering the Runtime Harness. Core admission, support descriptions and every Runtime execution/preparation entry consume it. Adapter-specific validation and native rendering remain private implementations. Execution lifecycle and operation qualification are separate contracts.

The current HarnessConfig wire object is defined by proto.HarnessConfig. Omission and {} mean no native parameters. Explicit null, arrays, repeated object members and objects above MaxHarnessConfigBytes are rejected by the shared decoder in native.go. Errors must omit submitted keys and values. Native schemas must reject unknown fields and any setting that overrides model, provider/authentication, workspace, tools/MCP, permissions or lifecycle controls. Never merge arbitrary host configuration into the frozen model configuration.

Acceptance obligates the adapter to apply every accepted parameter accurately through native configuration, SDK options or native Turn settings. Validate and prepare before native resources or model input; never ignore preparation errors, silently drop parameters or retry with weaker settings. Native resource cleanup and uncertain ownership follow the separate execution lifecycle contract.

Core freezes the model configuration per Session. Its meaning and explicit settings must hold for the first Turn, later Turns, native retries, tool continuations and recovery. A Runtime that cannot preserve a frozen snapshot rejects it without rewriting, migration or aliases. Native connection setup is direct: no model API proxy, passthrough gateway or protocol conversion, including inside an adapter. Protocol acceptance does not qualify model capabilities; operation and input requirements must still be checked before native submission.

Index

Constants

View Source
const MaxHarnessConfigBytes = 16 * 1024

Variables

View Source
var ErrHarnessConfig = errors.New("invalid or unsupported harness_config")

ErrHarnessConfig deliberately excludes caller-controlled keys and values.

View Source
var ErrModel = errors.New("model must be a nonempty model identifier")

Functions

func ValidateModel

func ValidateModel(value any) (string, error)

ValidateModel is shared by public admission and Runtime preparation.

Types

type Configuration

type Configuration struct {
	Providers []Provider
	// ValidateNativeConfig belongs to the selected adapter, never Core.
	ValidateNativeConfig func(proto.HarnessConfig) bool
}

Configuration is an adapter-owned declaration, not live provider readiness. Providers is ordered; its first entry is the default. An explicit empty declaration accepts no provider or nonempty native parameters. It is useful only for direct adapters whose model connection remains native-owned.

func (Configuration) AcceptsHarnessConfig

func (c Configuration) AcceptsHarnessConfig() bool

func (Configuration) Clone

func (c Configuration) Clone() Configuration

func (Configuration) ParseHarnessConfig

func (c Configuration) ParseHarnessConfig(raw json.RawMessage) (proto.HarnessConfig, error)

func (Configuration) ParseProvider

func (c Configuration) ParseProvider(raw any) (modelprovider.Provider, error)

ParseProvider validates the frozen bundle against this adapter's native declaration before launching a Harness. Unsupported snapshots are not rewritten.

func (Configuration) Prepare

func (c Configuration) Prepare(options map[string]any) (PreparedConfiguration, error)

Prepare validates the current model/provider/native-parameter contract before creating native resources. Other options belong to the execution contract.

func (Configuration) PrepareHarnessConfig

func (c Configuration) PrepareHarnessConfig(options map[string]any) (proto.HarnessConfig, error)

PrepareHarnessConfig copies the wire object before passing it to native code. An absent option means {}, while an explicitly supplied null is invalid.

func (Configuration) Provider

func (c Configuration) Provider(protocol string) (Provider, bool)

func (Configuration) Validate

func (c Configuration) Validate(protocol string, contextWindow, maxOutputTokens int32) error

func (Configuration) ValidateDeclaration

func (c Configuration) ValidateDeclaration() error

ValidateDeclaration rejects ambiguous support before registration. A caller must pass the declaration explicitly; there is no inferred built-in fallback.

func (Configuration) ValidateProtocol

func (c Configuration) ValidateProtocol(protocol string) error

type PreparedConfiguration

type PreparedConfiguration struct {
	Model         string
	Provider      *modelprovider.Provider
	HarnessConfig proto.HarnessConfig
}

PreparedConfiguration owns a validated snapshot without native side effects. Model and Provider may be absent only for the existing native-owned connection path. A supplied model must be a nonempty string; an explicit provider requires an explicit model. HarnessConfig is always an independently owned object.

type Provider

type Provider struct {
	Protocol            string
	RequiresTokenLimits bool
}

Provider is deliberately limited to configuration compatibility. Core owns credential admission and endpoint security; native launch options stay private.

type Registry

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

Registry is an immutable snapshot. Missing declarations remain unknown rather than inheriting another harness's configuration rules.

func NewRegistry

func NewRegistry(configurations map[string]Configuration) Registry

func (Registry) Lookup

func (r Registry) Lookup(kind string) (Configuration, bool)

func (Registry) SupportsProtocol

func (r Registry) SupportsProtocol(protocol string) bool

func (Registry) Validate

func (r Registry) Validate(kind, protocol string, contextWindow, maxOutputTokens int32) error

func (Registry) ValidateHarnessConfig

func (r Registry) ValidateHarnessConfig(kind string, raw json.RawMessage) error

ValidateHarnessConfig validates a selected adapter. An empty kind is for saved Agents without a selected Harness: at least one registered adapter must accept the object. Session admission always validates its resolved kind again.

func (Registry) ValidateProtocol

func (r Registry) ValidateProtocol(kind, protocol string) error

Directories

Path Synopsis
Code generated by scripts/generate-harness-catalog.py; DO NOT EDIT.
Code generated by scripts/generate-harness-catalog.py; DO NOT EDIT.
Package claudesdk owns the qualified Claude SDK provider declaration.
Package claudesdk owns the qualified Claude SDK provider declaration.
Package codex owns the qualified Codex provider configuration declaration.
Package codex owns the qualified Codex provider configuration declaration.
Package mcode owns the qualified MiniMax Code provider declaration.
Package mcode owns the qualified MiniMax Code provider declaration.

Jump to

Keyboard shortcuts

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