MCPcopy Index your code
hub / github.com/docker/docker-agent / buildSessionOpts

Method buildSessionOpts

cmd/root/run.go:1026–1035  ·  view source on GitHub ↗

buildSessionOpts returns the canonical set of session options derived from CLI flags and agent configuration. Both the initial session and spawned sessions use this method so their options never drift apart.

(agt *agent.Agent, req runtime.CreateSessionRequest)

Source from the content-addressed store, hash-verified

1024// CLI flags and agent configuration. Both the initial session and spawned
1025// sessions use this method so their options never drift apart.
1026func (f *runExecFlags) buildSessionOpts(agt *agent.Agent, req runtime.CreateSessionRequest) []session.Opt {
1027 return []session.Opt{
1028 session.WithMaxIterations(agt.MaxIterations()),
1029 session.WithMaxConsecutiveToolCalls(agt.MaxConsecutiveToolCalls()),
1030 session.WithMaxOldToolCallTokens(agt.MaxOldToolCallTokens()),
1031 session.WithToolsApproved(req.ToolsApproved),
1032 session.WithHideToolResults(req.HideToolResults),
1033 session.WithWorkingDir(req.WorkingDir),
1034 }
1035}
1036
1037// createSessionSpawner creates a function that can spawn new sessions with different working directories.
1038func (f *runExecFlags) createSessionSpawner(agentSource config.Source, sessStore session.Store) tui.SessionSpawner {

Callers 2

createSessionSpawnerMethod · 0.95

Calls 9

WithMaxIterationsFunction · 0.92
WithMaxOldToolCallTokensFunction · 0.92
WithToolsApprovedFunction · 0.92
WithHideToolResultsFunction · 0.92
WithWorkingDirFunction · 0.92
MaxIterationsMethod · 0.80
MaxOldToolCallTokensMethod · 0.80

Tested by

no test coverage detected