summaryrefslogtreecommitdiff
path: root/libpanto-go/panto.go
diff options
context:
space:
mode:
authort <t@tjp.lol>2026-06-12 10:38:28 -0600
committert <t@tjp.lol>2026-06-12 11:06:18 -0600
commit7343898524f9f692620f4cb276f56cfde30f6269 (patch)
tree8cf0621d33c4ae7f292c95f4684e1e9590175ae8 /libpanto-go/panto.go
parentaf8ba87475bfae9c1b4fa70c88fb4c59630a5670 (diff)
fuzzy selectors for models and reasoning levels
Diffstat (limited to 'libpanto-go/panto.go')
-rw-r--r--libpanto-go/panto.go19
1 files changed, 19 insertions, 0 deletions
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