Repository navigation
v0.7.0
Upgrading from v0.6.0
The module path is now github.com/felinics/twilight. v0.7.0 is the first tag under it, so replace the github.com/memohai/twilight imports and run go get github.com/felinics/twilight@v0.7.0.
The text-generation client layer is removed (#53). Model.Generate and Model.Stream take an sdk.Request and are the only chat entry points. GenerateText, StreamText, MaxSteps, tool execution and approval, and the MCP client are gone; the caller runs tools and loops. ToolArguments, ToolOutput and Request.ProviderOptions hold RFC 8785 canonical JSON (#54), and RawJSONOutput returns an error.
Provider failures are *sdk.APIError: non-2xx responses, error events inside a stream (StatusCode 0), and failed video jobs. Read the cause with sdk.KindOf(err), which returns one of authentication, permission_denied, quota_exhausted, rate_limited, server_error or unknown. The set is open, so a switch on it needs a default branch. Error() has no stable format and no longer starts with api error. Code that matches the error text, such as a regexp on api error 5\d\d to decide whether to retry, stops matching and must move to KindOf. RetryAfter() reads retry-after-ms and Retry-After.
A stream that ends before its terminal event emits an ErrorPart wrapping sdk.ErrStreamIncomplete, followed by a FinishPart with FinishReasonError. It used to end as a success.
Provider.Test returns error: nil when the provider is reachable and accepts the credentials. ProviderTestResult, ProviderStatus and ClassifyProbeStatus are removed. VideoProvider requires Name(), and VideoError has a Kind.
edge.EdgeTTSVoices is replaced by Voices(), which returns a copy.
sdk.WithClientRequestID(ctx, id) sends a caller-chosen request ID to the providers that accept one. Nothing is sent when it is not set.
- edge:
- provider:
- sdk:
🚀 Features
🐞 Bug Fixes
- anthropic:
- ci:
- completions:
- errorformat:
- headers:
- opencode-go:
- openrouter:
- provider:
- Replay invalid tool arguments as {} on string-typed wire fields - by @Fodesu in #58 (22d89)
- Bound the error body NewHTTPError reads; match Copilot test errors by field - by @HoneyBBQ (9969f)
- Leave 501 and 505 unclassified - by @HoneyBBQ (7bf57)
- Read ElevenLabs and MiniMax request IDs from the headers they send on errors - by @HoneyBBQ (d267e)
- sdk: