refactor: extract runAgentLoop and related functions to loop_run.go

Move runAgentLoop (765 lines), runLLMIteration, executeToolCalls,
forceTextResponse, and updateToolContexts to loop_run.go. The original
runAgentLoop becomes a one-line delegation stub. Extract helper methods
cleanupHeartbeatWorktree, publishTaskCompletion, and
redirectMessageToolForTask for clarity.

This reduces loop.go from 2656 to 1575 lines and eliminates ~30 fork
insertion points from the upstream-shared file, significantly reducing
merge conflict surface.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
dj-oyu 2026-03-15 18:35:42 +09:00
parent 9d1b89fd97
commit 0fe20ed447
2 changed files with 1076 additions and 1082 deletions

File diff suppressed because it is too large Load diff

1075
pkg/agent/loop_run.go Normal file

File diff suppressed because it is too large Load diff