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

Method NewSession

pkg/app/app.go:841–863  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

839}
840
841func (a *App) NewSession() {
842 if a.cancel != nil {
843 a.cancel()
844 a.cancel = nil
845 }
846 // Preserve user-controlled session flags
847 // so they don't reset to default on /new
848 var opts []session.Opt
849 if a.session != nil {
850 opts = append(opts,
851 session.WithToolsApproved(a.session.ToolsApproved),
852 session.WithHideToolResults(a.session.HideToolResults),
853 session.WithWorkingDir(a.session.WorkingDir),
854 )
855 }
856 a.session = session.New(opts...)
857 // Clear first message so it won't be re-sent on re-init
858 a.firstMessage = nil
859 a.firstMessageAttach = ""
860
861 // Re-emit startup info so the sidebar shows agent/tools info in the new session
862 a.reEmitStartupInfo(a.ctx())
863}
864
865// reEmitStartupInfo resets and re-emits startup info (agent, team, tools)
866// through the events channel so the sidebar updates.

Calls 5

reEmitStartupInfoMethod · 0.95
WithToolsApprovedFunction · 0.92
WithHideToolResultsFunction · 0.92
WithWorkingDirFunction · 0.92
NewFunction · 0.92