Restart conversation support.
The idea here is to let the user restart the conversation, possibly with
a better prompt. This is a common manual workflow, and I'd like to make
it easier.
I hand wrote the agent.go stuff, but Sketch wrote the rest.
Co-Authored-By: sketch <hello@sketch.dev>
diff --git a/loop/agent_test.go b/loop/agent_test.go
index 61b057c..bde0d20 100644
--- a/loop/agent_test.go
+++ b/loop/agent_test.go
@@ -267,6 +267,8 @@
cumulativeUsageFunc func() ant.CumulativeUsage
resetBudgetFunc func(ant.Budget)
overBudgetFunc func() error
+ getIDFunc func() string
+ subConvoWithHistoryFunc func() *ant.Convo
}
func (m *MockConvoInterface) SendMessage(message ant.Message) (*ant.MessageResponse, error) {
@@ -324,6 +326,20 @@
return nil
}
+func (m *MockConvoInterface) GetID() string {
+ if m.getIDFunc != nil {
+ return m.getIDFunc()
+ }
+ return "mock-convo-id"
+}
+
+func (m *MockConvoInterface) SubConvoWithHistory() *ant.Convo {
+ if m.subConvoWithHistoryFunc != nil {
+ return m.subConvoWithHistoryFunc()
+ }
+ return nil
+}
+
// TestAgentProcessTurnWithNilResponseNilError tests the scenario where Agent.processTurn receives
// a nil value for initialResp and nil error from processUserMessage.
// This test verifies that the implementation properly handles this edge case.