sidecarbinding

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 23 Imported by: 1 module, 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 sidecarbinding is the runtime shared by every binding whose model lives behind a process boundary.

Turn generation, concurrent I/O, native floor, and native interaction are independent capabilities, but every combination needs the same machinery: a sidecar connection, mirrored trajectory, background reasoner, and a way to hand that reasoner's answer back. One runtime selected by ownership and capabilities is honest about that; one runtime per model species would drift.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPolicies

func DefaultPolicies(spec Spec) interaction.Policies

DefaultPolicies is the policy set a sidecar-backed binding runs by default.

The model is the fast provider, so the engine's rollout runs slow and hands the answer back rather than producing a second voice. The floor policy follows the declaration rather than the other way round, which is what keeps "who owns the floor" a single answer.

func ExternalInteractionPolicies

func ExternalInteractionPolicies(spec Spec, policies interaction.Policies) interaction.Policies

ExternalInteractionPolicies adapts the engine's general policy assembly to a sidecar voice. The sidecar is the only fast provider, so its event-loop rollout must remain slow-only; this copies only the policies that constitute the external interaction controller.

func HandOffText

func HandOffText(answer string) string

HandOffText is what the model is told when a background result arrives. It is a separate function so the wording can be asserted directly: this is the one place a second model's writing meets a voice, and the difference between stating and dictating is the difference between speech and recitation.

Types

type Binding

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

Binding is a sidecar-backed voice stack.

func New

func New(spec Spec, config Config) (*Binding, error)

New validates a declaration and its configuration.

func (*Binding) Capabilities

func (bind *Binding) Capabilities() binding.Capabilities

Capabilities reports what a session supports. Video and computer use depend on the model, and the sidecar protocol has no way to declare them yet, so they are reported off rather than guessed at.

func (*Binding) Name

func (bind *Binding) Name() string

Name is the registry identifier.

func (*Binding) Ownership

func (bind *Binding) Ownership() binding.Ownership

Ownership declares what the model provides and what the engine supplies.

func (*Binding) Start

func (bind *Binding) Start(ctx context.Context, options binding.Options) (binding.Runtime, error)

Start opens a sidecar session.

type Config

type Config struct {
	// Sidecar is how the model process is reached.
	Sidecar sidecar.Config
	// Instructions is the deployment's own instruction, passed to the model
	// and composed ahead of the slow phase instruction.
	Instructions string
	// Voice selects the model's voice, where it has more than one.
	Voice string
	// InputRate is the sample rate the engine sends. Zero selects 24 kHz.
	InputRate int

	// Slow is the background reasoner. It is what this binding adds to a model
	// that already speaks, so it is required.
	Slow          continuation.Provider
	SlowMaxTokens int
	// ModelCapabilities augments the preset's minimum capability declaration.
	// It is how a deployment describes a hybrid model without adding another
	// binding package or teaching this runtime a new species name.
	ModelCapabilities binding.StackCapabilities
	// Tools are deployment-owned actions installed beside client declarations.
	// FastComputerUse grants the sidecar only the bounded computer.* subset;
	// every call still crosses the engine authorization and execution boundary.
	Tools           []action.ToolSpec
	FastComputerUse bool
	ConfirmPolicy   action.PolicyDecision
	ActionAudit     func(action.Record)

	// Policies overrides the interaction policy set.
	Policies interaction.Policies
	// InteractionPerception is an optional policy-only streaming recogniser.
	// Its transcript is evidence for an engine-owned interaction model; the
	// voice model still receives raw audio and still produces speech directly,
	// so configuring it does not turn the foreground into an ASR/LLM/TTS
	// cascade.
	InteractionPerception func() (v1.PerceptionProvider, error)
	// InteractionPerceptionDescriptor identifies the policy-only evidence path
	// before the first utterance lazily opens it. It is evidence metadata, not a
	// second configuration source; the factory remains authoritative.
	InteractionPerceptionDescriptor v1.Descriptor
	// InteractionCadence is how often that recogniser is advanced. Zero uses
	// the audio observer's 200 ms reference cadence.
	InteractionCadence time.Duration
	// InteractionTimeout bounds one policy decision on the live path.
	InteractionTimeout time.Duration
	// Gate configures the engine's acoustic floor. It is unused when the model
	// owns the floor.
	Gate perception.GateConfig

	MaxPendingEvents int
	MediaRetention   session.MediaConfig
	Scheduler        clock.Scheduler
	// HandoffTimeout bounds how long a completed answer waits to be voiced.
	HandoffTimeout time.Duration
	// ClientToolTimeout bounds how long a client has to return results for
	// the tools it executes. Zero selects the default; negative disables the
	// deadline, which only a harness driving results by hand should do.
	ClientToolTimeout time.Duration
	Logf              func(string, ...any)
}

Config configures one sidecar-backed binding.

type Spec

type Spec struct {
	// Name is a preset or deployment identity used in configuration and evidence.
	Name string
	// Ownership selects providers for this session. It is independent of
	// Capabilities: a model can have a native interaction head while an engine
	// controller owns interaction for one benchmark cell.
	Ownership binding.Ownership
	// Capabilities declares what the configured stack can do. The sidecar's
	// ready frame augments this with runtime-discovered transport features.
	Capabilities binding.StackCapabilities
}

Spec is what a concrete binding declares about itself.

Jump to

Keyboard shortcuts

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