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

Method CreateSession

cmd/root/backend.go:109–132  ·  view source on GitHub ↗
(ctx context.Context, loaded *teamloader.LoadResult, req runtime.CreateSessionRequest)

Source from the content-addressed store, hash-verified

107}
108
109func (b *localBackend) CreateSession(ctx context.Context, loaded *teamloader.LoadResult, req runtime.CreateSessionRequest) (runtime.Runtime, *session.Session, func(), error) {
110 store, err := b.sessionStore(ctx, req)
111 if err != nil {
112 stopToolSets(ctx, loaded.Team)
113 return nil, nil, nil, err
114 }
115
116 rt, sess, err := b.flags.createLocalRuntimeAndSession(ctx, loaded, req, store)
117 if err != nil {
118 stopToolSets(ctx, loaded.Team)
119 return nil, nil, nil, err
120 }
121
122 var once sync.Once
123 cleanup := func() {
124 once.Do(func() {
125 stopToolSets(ctx, loaded.Team)
126 if err := rt.Close(); err != nil {
127 slog.ErrorContext(ctx, "Failed to close runtime", "error", err)
128 }
129 })
130 }
131 return rt, sess, cleanup, nil
132}
133
134func (b *localBackend) Spawner(rt runtime.Runtime) tui.SessionSpawner {
135 return b.flags.createSessionSpawner(b.agentSource, rt.SessionStore())

Callers

nothing calls this directly

Calls 5

sessionStoreMethod · 0.95
stopToolSetsFunction · 0.85
DoMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected