(ctx context.Context, _ *teamloader.LoadResult, req runtime.CreateSessionRequest)
| 204 | } |
| 205 | |
| 206 | func (b *remoteBackend) CreateSession(ctx context.Context, _ *teamloader.LoadResult, req runtime.CreateSessionRequest) (runtime.Runtime, *session.Session, func(), error) { |
| 207 | client, err := runtime.NewClient(b.flags.remoteAddress) |
| 208 | if err != nil { |
| 209 | return nil, nil, nil, fmt.Errorf("failed to create remote client: %w", err) |
| 210 | } |
| 211 | |
| 212 | sessTemplate := session.New( |
| 213 | session.WithToolsApproved(req.ToolsApproved), |
| 214 | ) |
| 215 | |
| 216 | sess, err := client.CreateSession(ctx, sessTemplate) |
| 217 | if err != nil { |
| 218 | return nil, nil, nil, err |
| 219 | } |
| 220 | |
| 221 | rt, err := runtime.NewRemoteRuntime(client, |
| 222 | runtime.WithRemoteCurrentAgent(req.AgentName), |
| 223 | runtime.WithRemoteAgentFilename(b.agentFileName), |
| 224 | ) |
| 225 | if err != nil { |
| 226 | return nil, nil, nil, fmt.Errorf("failed to create remote runtime: %w", err) |
| 227 | } |
| 228 | |
| 229 | slog.DebugContext(ctx, "Using remote runtime", "address", b.flags.remoteAddress, "agent", req.AgentName) |
| 230 | |
| 231 | cleanup := func() { |
| 232 | if err := rt.Close(); err != nil { |
| 233 | slog.ErrorContext(ctx, "Failed to close remote runtime", "error", err) |
| 234 | } |
| 235 | } |
| 236 | return rt, sess, cleanup, nil |
| 237 | } |
| 238 | |
| 239 | func (b *remoteBackend) Spawner(runtime.Runtime) tui.SessionSpawner { |
| 240 | return nil |
nothing calls this directly
no test coverage detected