mirror of
https://github.com/Twigpine/zero.git
synced 2026-11-10 05:01:28 -10:00
* perf(providers): add provider capabilities and default turn-session adapter (PR7) * fix(providers): project effective reasoning efforts into capabilities * feat(agent): carry optimized turn sessions across mid-run model switches * test(agent): cover swap-time session open failure
22 lines
794 B
Go
22 lines
794 B
Go
package agent
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/Gitlawb/zero/internal/zeroruntime"
|
|
)
|
|
|
|
// sessionProvider adapts a TurnSession back to the Provider interface so the
|
|
// loop's existing Provider-shaped call sites (streamWithReconnect, the
|
|
// compaction summarizer, finalAnswerAfterMaxTurns) route their stream I/O
|
|
// through the session without any signature change. For the default adapter
|
|
// this reduces to the wrapped provider's StreamCompletion, so behavior is
|
|
// byte-identical; an optimized session (PR8) takes effect here transparently.
|
|
type sessionProvider struct {
|
|
session zeroruntime.TurnSession
|
|
}
|
|
|
|
func (s sessionProvider) StreamCompletion(ctx context.Context, request zeroruntime.CompletionRequest) (<-chan zeroruntime.StreamEvent, error) {
|
|
return s.session.Stream(ctx, request)
|
|
}
|