From 7343898524f9f692620f4cb276f56cfde30f6269 Mon Sep 17 00:00:00 2001 From: t Date: Fri, 12 Jun 2026 10:38:28 -0600 Subject: fuzzy selectors for models and reasoning levels --- libpanto-go/panto.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'libpanto-go') diff --git a/libpanto-go/panto.go b/libpanto-go/panto.go index 5644b61..da3bcb1 100644 --- a/libpanto-go/panto.go +++ b/libpanto-go/panto.go @@ -693,6 +693,25 @@ func (s *Stream) Close() { } } +// Reopen resets a failed stream back to its turn-open boundary so the caller +// can resume Next() after changing the agent config (e.g. catch a terminal +// bad-request, swap the provider config via Agent.SetConfig, and retry the +// SAME turn without re-appending the user message). It is valid only on a +// stream whose Next() has surfaced a terminal error; otherwise it returns an +// error. On success the stream's local error/done state is cleared so the +// iteration can continue. +func (s *Stream) Reopen() error { + if s == nil || s.ptr == nil { + return fmt.Errorf("reopen on a closed stream") + } + if C.panto_stream_reopen(s.ptr) != C.PANTO_OK { + return lastError() + } + s.err = nil + s.done = false + return nil +} + func (s *Stream) Next() (Event, bool, error) { if s.err != nil { return Event{}, false, s.err -- cgit v1.3