model

package
v0.1.8 Latest Latest
Warning

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

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

Documentation

Overview

Package model composes a typed coding configuration and credential store into an existing provider-neutral language model.

Index

Constants

View Source
const RetryBudget = 10

RetryBudget is the retry budget for one model request in a Coding run: ten replays of a failure that produced nothing, following the default the other agent frontends ship (Claude Code retries transient failures up to ten times; Grok Build's live retry state reports a budget in the same range). The backoff doubles from 500ms with full jitter, capped at 30s, and a provider Retry-After wins when it is longer.

Coding also hands this value to the Agent loop's stream recovery as its replay allowance, so a stream that failed after producing only reasoning — nothing a consumer has to retract — earns the same budget as a request that produced nothing at all. One value keeps the two owners from drifting apart.

View Source
const RetryWindowFloor = 10 * time.Minute

RetryWindowFloor is the shortest wall clock one model request may spend replaying, whatever the transport's idle bound is. The window bounds a whole replay episode rather than one attempt, so a short idle bound must not shrink it to where a brief outage exhausts it.

Variables

View Source
var ErrInvalid = errors.New("coding model: invalid configuration")

ErrInvalid means the resolved model or credential store is invalid.

Functions

func New

New constructs a native or compatible provider adapter from one complete immutable resolved snapshot.

func RetryWindowFor added in v0.1.8

func RetryWindowFor(streamIdleTimeout time.Duration) time.Duration

RetryWindowFor returns the wall clock one model request may spend replaying a failure that produced nothing, for a transport whose streaming idle bound is streamIdleTimeout: max(RetryWindowFloor, 2×idle). Zero selects ai.DefaultStreamIdleTimeout, the bound an unconfigured adapter applies, so an unset idle keeps the twenty-minute window Coding has always shipped.

The window bounds the scheduling of attempts, never one already in flight: a provider that has gone silent can spend a whole idle window on the attempt that is running, so the worst case is the window plus that attempt. It is also what the Agent loop's recovery episode is bounded by, through agent.WithStreamRecoveryWindow — one value feeds both owners.

Types

This section is empty.

Jump to

Keyboard shortcuts

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