(ctx context.Context, req *agentproto.CreateSubAgentRequest)
| 442 | } |
| 443 | |
| 444 | func (f *FakeAgentAPI) CreateSubAgent(ctx context.Context, req *agentproto.CreateSubAgentRequest) (*agentproto.CreateSubAgentResponse, error) { |
| 445 | f.Lock() |
| 446 | defer f.Unlock() |
| 447 | |
| 448 | f.logger.Debug(ctx, "create sub agent called", slog.F("req", req)) |
| 449 | |
| 450 | // Generate IDs for the new sub-agent. |
| 451 | subAgentID := uuid.New() |
| 452 | authToken := uuid.New() |
| 453 | |
| 454 | // Create the sub-agent proto object. |
| 455 | subAgent := &agentproto.SubAgent{ |
| 456 | Id: subAgentID[:], |
| 457 | Name: req.Name, |
| 458 | AuthToken: authToken[:], |
| 459 | } |
| 460 | |
| 461 | // Store the sub-agent in our map. |
| 462 | if f.subAgents == nil { |
| 463 | f.subAgents = make(map[uuid.UUID]*agentproto.SubAgent) |
| 464 | } |
| 465 | f.subAgents[subAgentID] = subAgent |
| 466 | if f.subAgentDirs == nil { |
| 467 | f.subAgentDirs = make(map[uuid.UUID]string) |
| 468 | } |
| 469 | f.subAgentDirs[subAgentID] = req.GetDirectory() |
| 470 | if f.subAgentDisplayApps == nil { |
| 471 | f.subAgentDisplayApps = make(map[uuid.UUID][]agentproto.CreateSubAgentRequest_DisplayApp) |
| 472 | } |
| 473 | f.subAgentDisplayApps[subAgentID] = req.GetDisplayApps() |
| 474 | if f.subAgentApps == nil { |
| 475 | f.subAgentApps = make(map[uuid.UUID][]*agentproto.CreateSubAgentRequest_App) |
| 476 | } |
| 477 | f.subAgentApps[subAgentID] = req.GetApps() |
| 478 | |
| 479 | // For a fake implementation, we don't create workspace apps. |
| 480 | // Real implementations would handle req.Apps here. |
| 481 | return &agentproto.CreateSubAgentResponse{ |
| 482 | Agent: subAgent, |
| 483 | AppCreationErrors: nil, |
| 484 | }, nil |
| 485 | } |
| 486 | |
| 487 | func (f *FakeAgentAPI) DeleteSubAgent(ctx context.Context, req *agentproto.DeleteSubAgentRequest) (*agentproto.DeleteSubAgentResponse, error) { |
| 488 | f.Lock() |
nothing calls this directly
no test coverage detected