on main help sign in
chore: rename isSpinning to spinning
bbce33fKujtim Hoxha
internal/ui/chat/agent.go+2−2
@@ -46,7 +46,7 @@ func NewAgentToolMessageItem(
46 t := &AgentToolMessageItem{}
46 t := &AgentToolMessageItem{}
47 t.baseToolMessageItem = newBaseToolMessageItem(sty, toolCall, result, &AgentToolRenderContext{agent: t}, canceled)
47 t.baseToolMessageItem = newBaseToolMessageItem(sty, toolCall, result, &AgentToolRenderContext{agent: t}, canceled)
48 // For the agent tool we keep spinning until the tool call is finished.
48 // For the agent tool we keep spinning until the tool call is finished.
49− t.isSpinningFn = func(state IsSpinningState) bool {
49+ t.spinningFunc = func(state SpinningState) bool {
50 return state.Result == nil && !state.Canceled
50 return state.Result == nil && !state.Canceled
51 }
51 }
52 return t
52 return t
@@ -190,7 +190,7 @@ func NewAgenticFetchToolMessageItem(
190 t := &AgenticFetchToolMessageItem{}
190 t := &AgenticFetchToolMessageItem{}
191 t.baseToolMessageItem = newBaseToolMessageItem(sty, toolCall, result, &AgenticFetchToolRenderContext{fetch: t}, canceled)
191 t.baseToolMessageItem = newBaseToolMessageItem(sty, toolCall, result, &AgenticFetchToolRenderContext{fetch: t}, canceled)
192 // For the agentic fetch tool we keep spinning until the tool call is finished.
192 // For the agentic fetch tool we keep spinning until the tool call is finished.
193− t.isSpinningFn = func(state IsSpinningState) bool {
193+ t.spinningFunc = func(state SpinningState) bool {
194 return state.Result == nil && !state.Canceled
194 return state.Result == nil && !state.Canceled
195 }
195 }
196 return t
196 return t
internal/ui/chat/tools.go+11−11
@@ -50,16 +50,16 @@ type Compactable interface {
50 SetCompact(compact bool)
50 SetCompact(compact bool)
51}
51}
52
52
53−// IsSpinningState contains the state passed to IsSpinningFn for custom spinning logic.
53+// SpinningState contains the state passed to SpinningFunc for custom spinning logic.
54−type IsSpinningState struct {
54+type SpinningState struct {
55 ToolCall message.ToolCall
55 ToolCall message.ToolCall
56 Result *message.ToolResult
56 Result *message.ToolResult
57 Canceled bool
57 Canceled bool
58}
58}
59
59
60−// IsSpinningFn is a function type for custom spinning logic.
60+// SpinningFunc is a function type for custom spinning logic.
61// Returns true if the tool should show the spinning animation.
61// Returns true if the tool should show the spinning animation.
62−type IsSpinningFn func(state IsSpinningState) bool
62+type SpinningFunc func(state SpinningState) bool
63
63
64// DefaultToolRenderContext implements the default [ToolRenderer] interface.
64// DefaultToolRenderContext implements the default [ToolRenderer] interface.
65type DefaultToolRenderContext struct{}
65type DefaultToolRenderContext struct{}
@@ -130,9 +130,9 @@ type baseToolMessageItem struct {
130 hasCappedWidth bool
130 hasCappedWidth bool
131 // isCompact indicates this tool should render in compact mode.
131 // isCompact indicates this tool should render in compact mode.
132 isCompact bool
132 isCompact bool
133− // isSpinningFn allows tools to override the default spinning logic.
133+ // spinningFunc allows tools to override the default spinning logic.
134 // If nil, uses the default: !toolCall.Finished && !canceled.
134 // If nil, uses the default: !toolCall.Finished && !canceled.
135− isSpinningFn IsSpinningFn
135+ spinningFunc SpinningFunc
136
136
137 sty *styles.Styles
137 sty *styles.Styles
138 anim *anim.Anim
138 anim *anim.Anim
@@ -349,8 +349,8 @@ func (t *baseToolMessageItem) SetPermissionGranted(granted bool) {
349
349
350// isSpinning returns true if the tool should show animation.
350// isSpinning returns true if the tool should show animation.
351func (t *baseToolMessageItem) isSpinning() bool {
351func (t *baseToolMessageItem) isSpinning() bool {
352− if t.isSpinningFn != nil {
352+ if t.spinningFunc != nil {
353− return t.isSpinningFn(IsSpinningState{
353+ return t.spinningFunc(SpinningState{
354 ToolCall: t.toolCall,
354 ToolCall: t.toolCall,
355 Result: t.result,
355 Result: t.result,
356 Canceled: t.canceled,
356 Canceled: t.canceled,
@@ -359,9 +359,9 @@ func (t *baseToolMessageItem) isSpinning() bool {
359 return !t.toolCall.Finished && !t.canceled
359 return !t.toolCall.Finished && !t.canceled
360}
360}
361
361
362−// SetIsSpinningFn sets a custom function to determine if the tool should spin.
362+// SetSpinningFunc sets a custom function to determine if the tool should spin.
363−func (t *baseToolMessageItem) SetIsSpinningFn(fn IsSpinningFn) {
363+func (t *baseToolMessageItem) SetSpinningFunc(fn SpinningFunc) {
364− t.isSpinningFn = fn
364+ t.spinningFunc = fn
365}
365}
366
366
367// ToggleExpanded toggles the expanded state of the thinking box.
367// ToggleExpanded toggles the expanded state of the thinking box.