MCPcopy Create free account
hub / github.com/codehamr/codehamr / dispatchNextTool

Method dispatchNextTool

internal/tui/model.go:1053–1061  ·  view source on GitHub ↗

dispatchNextTool pops the next pending tool call and runs it. Every tool flows through runToolCall; none are special-cased. lastToolKey records this call's target so the failure nudge can tell when the model keeps retrying the same failing operation (see recordToolOutcome).

()

Source from the content-addressed store, hash-verified

1051 m.turnStart = time.Time{}
1052 m.turnTokens = 0
1053}
1054
1055// handleStreamClosed drives what happens after one round's stream finishes:
1056// dispatch the next pending tool call, or, if none, finalize the turn and
1057// hand control back. A turn ends precisely when the assistant emits no tool
1058// calls; there is no loop tool to land on.
1059func (m Model) handleStreamClosed() (tea.Model, tea.Cmd) {
1060 m.stream = nil
1061 // Stale close from a cancelled turn (handleCtrlC / EventError reset phase
1062 // to idle).
1063 if !m.phase.active() {
1064 return m, nil

Callers 2

updateMethod · 0.95
handleStreamClosedMethod · 0.95

Calls 4

appendLineMethod · 0.95
InlineStatusFunction · 0.92
toolTargetKeyFunction · 0.85
runToolCallFunction · 0.85

Tested by

no test coverage detected