refactor(agent): address self-review comments on loop.go
- Move cmdRegistry init into struct literal (review comment #11) - Rename buildRuntime → buildCommandsRuntime for clarity (review comment #12) - Add comment to default switch case explaining passthrough (review comment #13) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3c2b6e8121
commit
7a43c3e065
1 changed files with 4 additions and 5 deletions
|
|
@ -101,10 +101,9 @@ func NewAgentLoop(
|
|||
state: stateManager,
|
||||
summarizing: sync.Map{},
|
||||
fallback: fallbackChain,
|
||||
cmdRegistry: commands.NewRegistry(commands.BuiltinDefinitions()),
|
||||
}
|
||||
|
||||
al.cmdRegistry = commands.NewRegistry(commands.BuiltinDefinitions())
|
||||
|
||||
return al
|
||||
}
|
||||
|
||||
|
|
@ -1471,7 +1470,7 @@ func (al *AgentLoop) handleCommand(
|
|||
return "", false
|
||||
}
|
||||
|
||||
rt := al.buildRuntime()
|
||||
rt := al.buildCommandsRuntime()
|
||||
executor := commands.NewExecutor(al.cmdRegistry, rt)
|
||||
|
||||
var commandReply string
|
||||
|
|
@ -1495,12 +1494,12 @@ func (al *AgentLoop) handleCommand(
|
|||
return commandReply, true
|
||||
}
|
||||
return "", true
|
||||
default:
|
||||
default: // OutcomePassthrough — let the message fall through to LLM
|
||||
return "", false
|
||||
}
|
||||
}
|
||||
|
||||
func (al *AgentLoop) buildRuntime() *commands.Runtime {
|
||||
func (al *AgentLoop) buildCommandsRuntime() *commands.Runtime {
|
||||
return &commands.Runtime{
|
||||
Config: al.cfg,
|
||||
GetModelInfo: func() (string, string) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue