v0.10.5

Helpers

Last updated


Standalone helper functions outside the Agent interfaces.

HTTP and model checks


SymbolSignatureDescription
NewHTTPClientfunc() *http.ClientTimeoutHTTPLong (15-minute) overall timeout
NewStreamHTTPClientfunc() *http.ClientTimeoutHTTPLong overall timeout plus a TimeoutHTTPShort (15-second) response-header timeout on a clone of http.DefaultTransport; used by codex, grok-oauth, and the Codex / Grok OAuth requests
SupportTemperaturefunc(providerName, model string) boolClaude, the gpt-5 family, deepseek-reasoner, and Gemini previews reject it
ResponsesAPIfunc(providerName, model string) boolChooses Responses over Chat Completions; for copilot it applies only when the model's supported_endpoints lists neither /responses nor /chat/completions
summary.VoiceReply (core/gemini/summary)func(ctx context.Context, text string) (string, error)Compresses text over 320 characters into a speakable reply via Gemini

Timing constants


SymbolValueUsed for
TimeoutHTTPShort15 sResponse-header timeout, model listing / usage queries, OAuth callback server read / write, Copilot model lookup and device-flow polling client
TimeoutHTTPLong15 minOverall timeout of request clients
TimeoutWait10 minUpper bound of device code polling (Codex, Copilot) and the Gemini stream idle window
IntervalBackoff5 sDevice code poll interval when the server sends none, and the step added on Copilot slow_down
ExpiryToken1 hCodex / Grok token lifetime when the token response has no expires_in, and the Gemini context-cache TTL
ExpirySafety60 sMargin before expiry at which tokens refresh and Gemini caches are treated as expired

Session


SymbolSignatureDescription
WithSessionIDfunc(ctx context.Context, id string) context.ContextAttaches a trimmed session ID; an empty ID returns ctx unchanged
SessionIDfunc(ctx context.Context) stringThe attached ID, or ""
SessionUUIDfunc(ctx context.Context) stringSHA-256 of the ID formatted as a UUID; "" when no ID is attached
WithCacheTTLfunc(ctx context.Context, ttl string) context.ContextAttaches a trimmed prompt-cache TTL such as "1h"; an empty value returns ctx unchanged
CacheTTLfunc(ctx context.Context) stringThe attached TTL, or ""


中文