Rename cancelInnerLoop to cancelTurn to match refactored naming
- Updated all references to cancelInnerLoop and CancelInnerLoop
- Changed method and variable names to match the new processTurn naming
- Updated references in related files: server/loophttp.go and termui/termui.go
Co-Authored-By: sketch <hello@sketch.dev>
diff --git a/loop/agent.go b/loop/agent.go
index 1d6755e..563273d 100644
--- a/loop/agent.go
+++ b/loop/agent.go
@@ -46,7 +46,7 @@
// Loop begins the agent loop returns only when ctx is cancelled.
Loop(ctx context.Context)
- CancelInnerLoop(cause error)
+ CancelTurn(cause error)
CancelToolUse(toolUseID string, cause error) error
@@ -291,10 +291,10 @@
// called by termui inside its repl loop.
outbox chan AgentMessage
- // protects cancelInnerLoop
- cancelInnerLoopMu sync.Mutex
+ // protects cancelTurn
+ cancelTurnMu sync.Mutex
// cancels potentially long-running tool_use calls or chains of them
- cancelInnerLoop context.CancelCauseFunc
+ cancelTurn context.CancelCauseFunc
// protects following
mu sync.Mutex
@@ -798,11 +798,11 @@
return a.convo.CancelToolUse(toolUseID, cause)
}
-func (a *Agent) CancelInnerLoop(cause error) {
- a.cancelInnerLoopMu.Lock()
- defer a.cancelInnerLoopMu.Unlock()
- if a.cancelInnerLoop != nil {
- a.cancelInnerLoop(cause)
+func (a *Agent) CancelTurn(cause error) {
+ a.cancelTurnMu.Lock()
+ defer a.cancelTurnMu.Unlock()
+ if a.cancelTurn != nil {
+ a.cancelTurn(cause)
}
}
@@ -813,13 +813,13 @@
return
default:
ctxInner, cancel := context.WithCancelCause(ctxOuter)
- a.cancelInnerLoopMu.Lock()
- // Set .cancelInnerLoop so the user can cancel whatever is happening
+ a.cancelTurnMu.Lock()
+ // Set .cancelTurn so the user can cancel whatever is happening
// inside the conversation loop without canceling this outer Loop execution.
- // This CancelInnerLoop func is intended be called from other goroutines,
+ // This cancelTurn func is intended be called from other goroutines,
// hence the mutex.
- a.cancelInnerLoop = cancel
- a.cancelInnerLoopMu.Unlock()
+ a.cancelTurn = cancel
+ a.cancelTurnMu.Unlock()
a.processTurn(ctxInner) // Renamed from InnerLoop to better reflect its purpose
cancel(nil)
}